Skip to content

core: pin yielded code cells to their request runtime - #29606

Closed
sayan-oai wants to merge 1 commit into
codex/tools-use-step-context-environmentsfrom
codex/code-mode-pin-yielded-runtime
Closed

core: pin yielded code cells to their request runtime#29606
sayan-oai wants to merge 1 commit into
codex/tools-use-step-context-environmentsfrom
codex/code-mode-pin-yielded-runtime

Conversation

@sayan-oai

Copy link
Copy Markdown
Contributor

Why

A yielded code-mode cell can keep running after the sampling request that created it ends. Its later tool calls currently use whichever request worker happens to be active.

With dynamic environments, a cell started in workspace A can resume during a later request for workspace B and silently run its tool in B.

What

  • Bind each cell to the request runtime that created it.
  • Keep that request's router and StepContext for later nested tool calls.
  • Let later request workers pump the shared queue without changing which environment the cell uses.
  • Release the retained runtime when the cell closes.

Test

Updated the yielded-cell integration test to start in workspace A, continue during a later turn in workspace B, and verify that a relative command still writes to A.

Stacked on #29547.

};
tokio::spawn(async move {
let response = tokio::select! {
response = host.invoke_tool(

@sayan-oai sayan-oai Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

pinned cells from different requests now keep different ToolCallRuntime locks, so two yielded cells can now run a non-parallel tool at the same time. maybe niche, but behavior change + maybe unacceptable

@sayan-oai

Copy link
Copy Markdown
Contributor Author

dropping this: long-lived code-mode cells should use the active step worker and respond to environment/tool changes rather than pinning their original StepContext.

@sayan-oai sayan-oai closed this Jun 23, 2026
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