Skip to content

Avoid reopening v2 descendants on resume#26997

Merged
jif-oai merged 9 commits into
mainfrom
jif/cleanup-ma
Jun 8, 2026
Merged

Avoid reopening v2 descendants on resume#26997
jif-oai merged 9 commits into
mainfrom
jif/cleanup-ma

Conversation

@jif-oai

@jif-oai jif-oai commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Why

Multi-agent v2 residency is intended to keep only the threads that need to be live. The existing rollout resume path still walked persisted open descendants and reopened the entire descendant tree when resuming a v2 root, which turns resume into an eager reload of work that should stay unloaded until it is explicitly needed.

The interrupted-agent path has a related residency issue. Interrupted agents remain open by design, so an idle interrupted resident should be eligible for eviction just like an idle completed or errored resident. Otherwise a resident set full of interrupted agents can consume every v2 slot and block later spawns or reloads with AgentLimitReached.

What Changed

  • Return early from resume_agent_from_rollout after resuming a v2 thread so persisted v2 descendants are not reopened eagerly.
  • Treat idle Interrupted v2 residents as unloadable in the LRU residency path.
  • Add focused coverage for v2 root resume leaving descendants unloaded and for eviction of an idle interrupted v2 resident when a new slot is needed.

Verification

Added targeted codex-core tests covering:

  • v2 root resume with persisted descendants, verifying only the root is loaded after resume.
  • residency eviction of an idle interrupted v2 agent when the resident set is full.

@jif-oai jif-oai requested a review from a team as a code owner June 8, 2026 12:50
@jif-oai jif-oai changed the title feat: cleanup ma Clean up multi-agent v2 resume residency Jun 8, 2026

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

Copy link
Copy Markdown
Contributor

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: ab28c845a6

ℹ️ 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 thread codex-rs/core/src/agent/control/spawn.rs Outdated
Comment thread codex-rs/core/src/agent/control/spawn.rs Outdated
@jif-oai

jif-oai commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@jif-oai jif-oai changed the title Clean up multi-agent v2 resume residency Avoid reopening v2 descendants on resume Jun 8, 2026

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

Copy link
Copy Markdown
Contributor

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: e61af26e42

ℹ️ 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 thread codex-rs/core/src/agent/control/spawn.rs Outdated
Comment thread codex-rs/core/src/agent/control_tests.rs
@jif-oai jif-oai merged commit 0526cb5 into main Jun 8, 2026
30 checks passed
@jif-oai jif-oai deleted the jif/cleanup-ma branch June 8, 2026 14:44
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant