Skip to content

[codex] Fix stale deferred rewrite state#1655

Open
svarlamov wants to merge 1 commit into
mainfrom
codex/fix-deferred-rewrite-state-staleness
Open

[codex] Fix stale deferred rewrite state#1655
svarlamov wants to merge 1 commit into
mainfrom
codex/fix-deferred-rewrite-state-staleness

Conversation

@svarlamov

Copy link
Copy Markdown
Member

Summary

Fix stale deferred rewrite state for operations that apply changes now and consume attribution on a later git commit.

  • Add RED TestRepo regressions for abandoned cherry-pick --no-commit and abandoned merge --squash followed by an unrelated commit from the same base.
  • Guard pending squash/no-commit cherry-pick consumption by requiring source added content to overlap the final commit's added content.
  • Drop stale or base-mismatched pending state instead of reusing it for an unrelated commit.

Root Cause

merge --squash and cherry-pick --no-commit stored worktree-scoped pending state and later consumed it on git commit using only a weak base match. If the actual operation was abandoned without a traced daemon event, a later unrelated commit from that same base could inherit stale source session metadata.

Validation

RED checks before the fix:

  • task test TEST_FILTER=test_cherry_pick_no_commit_abandon_does_not_affect_later_unrelated_commit NO_CAPTURE=true failed on stale cherry-pick session metadata.
  • task test TEST_FILTER=test_abandoned_squash_merge_does_not_affect_later_unrelated_commit NO_CAPTURE=true failed on stale squash session metadata.

GREEN checks after the fix:

  • task fmt
  • task lint
  • task test TEST_FILTER=test_cherry_pick_no_commit_abandon_does_not_affect_later_unrelated_commit NO_CAPTURE=true
  • task test TEST_FILTER=test_abandoned_squash_merge_does_not_affect_later_unrelated_commit NO_CAPTURE=true
  • task test TEST_FILTER=test_cherry_pick_no_commit_defers_to_final_commit_tree NO_CAPTURE=true
  • task test TEST_FILTER=test_prepare_working_log_simple_squash NO_CAPTURE=true
  • task test TEST_FILTER=cherry_pick:: NO_CAPTURE=true
  • task test TEST_FILTER=squash_merge:: NO_CAPTURE=true
  • task test

@svarlamov svarlamov marked this pull request as ready for review June 25, 2026 04:11
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