Skip to content

fix(history): keep review artifacts from crossing checkouts - #402

Merged
umputun merged 2 commits into
masterfrom
history-artifact-keys
Oct 21, 2026
Merged

umputun merged 2 commits into
masterfrom
history-artifact-keys

Conversation

@umputun

@umputun umputun commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Implements the three fixes agreed in #331.

  • History reader matches the checkout. Both read-latest-history.sh copies pick the newest entry whose path: header (read from the metadata block only) names the current checkout, comparing symlink-resolved paths. A single-file --only header without git matches the directory holding the file; an existing nested same-basename checkout never matches through its parent. The pi skill describes the same rule.
  • Unique history filenames. Concurrent saves could choose the same millisecond filename and overwrite one another. Filenames now carry a random suffix (2006-01-02T15-04-05.000-<8 hex>.md), still written through AtomicWriteFile.
  • Narrower timeout fallback. The three skill copies look only at the user's own revdiff-output-* files from the last two hours (find -H, so a symlinked TMPDIR such as macOS /tmp works). This is a mitigation: a recent leftover or a second live review by the same user can still be the newest match, and the skills say so.

Tests: the reader runs against real repos for foreign, nested, symlinked, file-style and body-only headers plus newest-of-several; the fallback command is extracted from all three skills and executed; a concurrent-save test loses entries on the old naming.

Fixed #331

The history reader picked the newest file in the basename directory, so a
checkout sharing its root name with another one read that checkout's review.
Both read-latest-history.sh copies now match each entry on its path: header,
resolving symlinks on both sides; a single-file --only header matches the
directory holding the file, and an existing nested same-basename checkout
never matches through its parent. The pi skill describes the same rule.

Concurrent saves could choose the same millisecond filename and overwrite one
another. History filenames now include a random suffix to keep those entries
separate.

The timeout fallback in the three skill copies looks only at the user's own
revdiff-output-* files from the last two hours, following a symlinked TMPDIR.
Two live reviews by the same user can still both match, and the skills say so.

Fixed #331
…n skill

The reader tests had at most one matching entry per case, so a loop keeping the first or the last match passed. The revdiff-plan skill now carries the same caveat as the revdiff skills about what the narrowed output lookup can still match.
Copilot AI balanced review requested due to automatic review settings October 21, 2026 07:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@umputun
umputun merged commit 70e6210 into master Oct 21, 2026
7 checks passed
@umputun
umputun deleted the history-artifact-keys branch October 21, 2026 16:55
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.

Review artifacts are keyed by repository basename and wall-clock time, so reviews can read or overwrite each other

2 participants