Skip to content

Move apply-patch file changes into turn items#20540

Merged
pakrym-oai merged 1 commit intomainfrom
pakrym/apply-patch-turn-item
May 1, 2026
Merged

Move apply-patch file changes into turn items#20540
pakrym-oai merged 1 commit intomainfrom
pakrym/apply-patch-turn-item

Conversation

@pakrym-oai
Copy link
Copy Markdown
Collaborator

Why

Apply-patch file changes are now part of the core turn item stream, so v2 clients can consume the same first-class item lifecycle path used by other turn items instead of relying on app-server-specific remapping from legacy patch events.

What changed

  • Added a core TurnItem::FileChange carrying apply-patch changes and completion metadata.
  • Updated the apply-patch tool emitter to send ItemStarted / ItemCompleted with the new FileChange item while preserving legacy PatchApplyBegin / PatchApplyEnd fan-out.
  • Updated app-server v2 conversion to render the new core item directly and stopped event_mapping from remapping old patch begin/end events into item notifications.
  • Kept thread history reconstruction based on the existing old apply-patch events for rollout compatibility.

Verification

  • cargo test -p codex-protocol -p codex-app-server-protocol
  • cargo test -p codex-core --test all apply_patch_tool_executes_and_emits_patch_events
  • cargo test -p codex-app-server bespoke_event_handling

@pakrym-oai pakrym-oai requested a review from a team as a code owner May 1, 2026 00:57
@pakrym-oai pakrym-oai force-pushed the pakrym/apply-patch-turn-item branch 2 times, most recently from 3672fdb to 4df7086 Compare May 1, 2026 01:28
Copy link
Copy Markdown
Collaborator

@owenlin0 owenlin0 left a comment

Choose a reason for hiding this comment

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

nice, this makes the app-server layer simpler too!

at some point (maybe once we migrate everything to CoreTurnItems?) we should persist these in the rollout instead of the legacy EventMsg ones

@pakrym-oai pakrym-oai merged commit f476338 into main May 1, 2026
45 of 47 checks passed
@pakrym-oai pakrym-oai deleted the pakrym/apply-patch-turn-item branch May 1, 2026 15:47
@github-actions github-actions Bot locked and limited conversation to collaborators May 1, 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.

2 participants