Skip to content

Fix compact stash recovery edge cases#1721

Closed
Siddhant-K-code wants to merge 6 commits into
mainfrom
codex/fix-compact-stash-followups
Closed

Fix compact stash recovery edge cases#1721
Siddhant-K-code wants to merge 6 commits into
mainfrom
codex/fix-compact-stash-followups

Conversation

@Siddhant-K-code

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #1719 for the compact stash storage path.

  • parse stash targets as positional non-flag args so stash pop -q / stash apply -q restore attribution correctly
  • route stash compaction through a temporary streamed working log for both full and pathspec stashes
  • dedupe checkpoint records before VirtualAttributions reads them, so duplicated checkpoint logs do not get reintroduced through compact stash restore
  • add regression coverage for quiet stash commands and duplicated checkpoint-log recovery

Root Cause

#1719 moved stash attribution into compact INITIAL snapshots, which is the right storage shape, but two edge cases remained:

  1. RefCursor::enrich_stash treated the first arg after pop / apply as the stash target, so boolean flags like -q could break stash SHA resolution and skip attribution restore.
  2. save_stash_attributions compacted directly from the live working log, so an already-duplicated checkpoints.jsonl could still be read in full before the cleanup path had a chance to truncate or replace it.

Validation

Passed:

  • task fmt
  • git diff --check
  • task build
  • task test TEST_FILTER=test_stash_pop_quiet_flag_restores_attribution
  • task test TEST_FILTER=test_stash_apply_quiet_flag_restores_attribution
  • task test TEST_FILTER=test_stash_compaction_recovers_from_duplicated_checkpoint_log
  • task test TEST_FILTER=test_repeated_stash_pop_does_not_duplicate_checkpoints
  • task test TEST_FILTER=test_stash_push_pathspec_excludes_unstashed_file_from_stash_log
  • task test TEST_FILTER=test_partial_stash_trims_unstashed_initial_metadata

Local caveat:

  • task lint was run, but local Rust/Clippy is 1.96.0 and failed on an untouched existing src/daemon.rs clippy::collapsible-match warning. The repo instructions call out Rust 1.93.0; this branch does not modify that file.

@Siddhant-K-code

Copy link
Copy Markdown
Collaborator Author

It seems #1515 broke some windows test 🤔

@Siddhant-K-code
Siddhant-K-code marked this pull request as ready for review July 2, 2026 09:08
@Siddhant-K-code
Siddhant-K-code requested a review from svarlamov July 2, 2026 09:08
@Siddhant-K-code Siddhant-K-code changed the title [codex] Fix compact stash recovery edge cases Fix compact stash recovery edge cases Jul 2, 2026
devin-ai-integration[bot]

This comment was marked as resolved.

…codex/fix-compact-stash-followups

# Conflicts:
#	src/authorship/rewrite_stash.rs
#	tests/integration/stash_attribution.rs
@Siddhant-K-code
Siddhant-K-code deleted the codex/fix-compact-stash-followups branch July 14, 2026 13:45
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