Skip to content

Preserve turn attribution across recovery and compaction - #51402

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/85b5763e8fbd48a1ea2c07cfda8196e63c2cd33a
Oct 6, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/85b5763e8fbd48a1ea2c07cfda8196e63c2cd33a

Conversation

@copyberry

@copyberry copyberry Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Preserve turn attribution across recovery and compaction

Why

Recovering an interrupted turn replaced its original trigger with retry and restored only its root lineage from model context. Turns suspended before that context was written could lose their attribution entirely.

What changed

  • Persist regular-turn attribution in TurnStartedEvent and compaction resume metadata, including the trigger, parent and root turn IDs, and initiating agent path.
  • Restore matching attribution during recovery, keep unknown triggers absent, and retain the model-context root fallback for older records.
  • Reconstruct attribution from surviving turns across rollback and late completion or abort events, and clear inherited attribution when spawning a forked agent.

Testing

Add coverage for repeated cold recovery, suspension before context persistence, legacy rollouts, fresh attribution on subsequent turns, compaction checkpoints, rollback, and late terminal events.

## Why

Recovering an interrupted turn replaced its original trigger with `retry` and restored only its root lineage from model context. Turns suspended before that context was written could lose their attribution entirely.

## What changed

- Persist regular-turn attribution in `TurnStartedEvent` and compaction resume metadata, including the trigger, parent and root turn IDs, and initiating agent path.
- Restore matching attribution during recovery, keep unknown triggers absent, and retain the model-context root fallback for older records.
- Reconstruct attribution from surviving turns across rollback and late completion or abort events, and clear inherited attribution when spawning a forked agent.

## Testing

Add coverage for repeated cold recovery, suspension before context persistence, legacy rollouts, fresh attribution on subsequent turns, compaction checkpoints, rollback, and late terminal events.

GitOrigin-RevId: 85b5763e8fbd48a1ea2c07cfda8196e63c2cd33a
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/85b5763e8fbd48a1ea2c07cfda8196e63c2cd33a branch from cfe0433 to 551bd40 Compare October 6, 2026 15:50
@copyberry
copyberry Bot merged commit 551bd40 into main Oct 6, 2026
1 check passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/85b5763e8fbd48a1ea2c07cfda8196e63c2cd33a branch October 6, 2026 15:50
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-06T15:50:42.681224Z cfe0433 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.

This branch was previously deployed

1 inactive deployment
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.

4 participants