Skip to content

[2/5] Split step capture from environment refresh#31912

Draft
aibrahim-oai wants to merge 1 commit into
step-context/collaboration-statefrom
step-context/split-capture
Draft

[2/5] Split step capture from environment refresh#31912
aibrahim-oai wants to merge 1 commit into
step-context/collaboration-statefrom
step-context/split-capture

Conversation

@aibrahim-oai

@aibrahim-oai aibrahim-oai commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Why

Step capture currently combines constructing a request-scoped holder with refreshing environments, capability roots, AGENTS.md, and MCP state. Splitting the function itself lets the next stacked change retain a lightweight step on the active task without moving refresh work earlier in the task lifecycle.

What changed

  • Make Session::capture_step_context the synchronous lightweight phase, using the turn environment and currently published MCP runtime.
  • Move the former asynchronous environment, capability-root, AGENTS.md, and MCP refresh body into StepContext::refresh_env.
  • Update every existing capture boundary to call capture_step_context(...).refresh_env(...).await, including sampling, compaction, prewarm, history/debug, and test callers.

The heavy refresh still runs at the same boundaries as before. This is PR 2 of 5, stacked on #31734, and intentionally does not store a step on the active task.

Validation

  • cargo check -p codex-core --tests --message-format short
  • just test -p codex-core --lib (2,007 passed, 3 skipped at the stack head)

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 98bb4cd692

ℹ️ 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".

@aibrahim-oai aibrahim-oai force-pushed the step-context/split-capture branch from 98bb4cd to 27064c1 Compare July 9, 2026 21:57
@aibrahim-oai aibrahim-oai force-pushed the step-context/collaboration-state branch from 4055519 to 1a92f60 Compare July 9, 2026 21:57
@aibrahim-oai

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 27064c1ac5

ℹ️ 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".

@aibrahim-oai aibrahim-oai force-pushed the step-context/collaboration-state branch from 1a92f60 to b6ca728 Compare July 9, 2026 23:35
@aibrahim-oai aibrahim-oai force-pushed the step-context/split-capture branch from 27064c1 to db2a273 Compare July 9, 2026 23:35
@aibrahim-oai

Copy link
Copy Markdown
Contributor Author

@codex review

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