Skip to content

feat: fork pattern v2#15771

Open
jif-oai wants to merge 2 commits intomainfrom
jif/advanced-fork
Open

feat: fork pattern v2#15771
jif-oai wants to merge 2 commits intomainfrom
jif/advanced-fork

Conversation

@jif-oai
Copy link
Collaborator

@jif-oai jif-oai commented Mar 25, 2026

Adds this:

properties.insert(
            "fork_turns".to_string(),
            JsonSchema::String {
                description: Some(
                    "Optional MultiAgentV2 fork mode. Use `none`, `all`, or a positive integer string such as `3` to fork only the most recent turns."
                        .to_string(),
                ),
            },
        );
        ```

@jif-oai
Copy link
Collaborator Author

jif-oai commented Mar 25, 2026

@codex review

@jif-oai jif-oai changed the title feat: communication pattern v2 feat: fork pattern v2 Mar 25, 2026
Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3c8197a9e5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +59 to +62
RolloutItem::EventMsg(EventMsg::ThreadRolledBack(rollback)) => {
let num_turns = usize::try_from(rollback.num_turns).unwrap_or(usize::MAX);
let new_len = fork_turn_positions.len().saturating_sub(num_turns);
fork_turn_positions.truncate(new_len);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Apply rollback to user turns, not all fork boundaries

ThreadRolledBackEvent.num_turns is defined as a count of user turns, but fork_turn_positions_in_rollout truncates a list that also contains trigger_turn assistant envelopes. In histories with trigger envelopes, a rollback can remove the wrong boundary, so truncate_rollout_to_last_n_fork_turns picks an incorrect keep_idx and forks stale/incorrect context.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant