Skip to content

Preserve client attribution when spawning subagents - #62072

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/8c378c49239ccfac03deb2b793fc69aba1d41644
Nov 17, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/8c378c49239ccfac03deb2b793fc69aba1d41644

Conversation

@copyberry

@copyberry copyberry Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Preserve client attribution when spawning subagents

Why

Delegated work should retain client attribution such as cost_center from the turn that requested it, even when a yielded code-mode cell spawns its child after a newer parent turn starts.

What changed

Capture client metadata from the originating turn and apply it to the child's initial turn in both legacy and v2 agent spawning. Children and grandchildren retain the captured values when the parent is later steered with updated metadata.

Exclude misalignment_override, parent_response_id, and mcp_request_meta from inheritance, while preserving each child's own thread and turn identifiers.

Testing

Add coverage for metadata filtering and snapshot isolation, legacy and v2 spawning with fresh or forked history, grandchild inheritance, and spawning from a yielded code-mode cell after the parent advances to another turn.

## Why

Delegated work should retain client attribution such as `cost_center` from the turn that requested it, even when a yielded code-mode cell spawns its child after a newer parent turn starts.

## What changed

Capture client metadata from the originating turn and apply it to the child's initial turn in both legacy and v2 agent spawning. Children and grandchildren retain the captured values when the parent is later steered with updated metadata.

Exclude `misalignment_override`, `parent_response_id`, and `mcp_request_meta` from inheritance, while preserving each child's own thread and turn identifiers.

## Testing

Add coverage for metadata filtering and snapshot isolation, legacy and v2 spawning with fresh or forked history, grandchild inheritance, and spawning from a yielded code-mode cell after the parent advances to another turn.

GitOrigin-RevId: 8c378c49239ccfac03deb2b793fc69aba1d41644
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/8c378c49239ccfac03deb2b793fc69aba1d41644 branch from 01837e9 to 02d60fb Compare November 17, 2026 16:16
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor
Codex Review Summary: 🔄 Running

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-11-17T16:16:26.761071Z 01837e9 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@copyberry
copyberry Bot merged commit 02d60fb into main Nov 17, 2026
10 of 23 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/8c378c49239ccfac03deb2b793fc69aba1d41644 branch November 17, 2026 16:16
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 17, 2026

This branch was previously deployed

1 inactive deployment
issue-triage — 02d60fb5 Deployed Nov 17, 2026 by avandine1 via Generate label suggestions #64000
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.

2 participants