Clear the previous cycle's findings when review is entered again

The worktree survives a changes-requested round trip, so .orchestra/review.json
from the first review is still there when the second one starts. A reviewer
that writes .orchestra/done without rewriting it would have the earlier
findings sealed against the new commit, and submit binds whatever it reads to
the commit being submitted, so a stale pass is indistinguishable from a fresh
one.

Observed on the 2026-08-28 baseline run: the file from 10:55:45 was still
present when the second review session launched at 10:57:48. That reviewer did
rewrite it, so the run is sound, but nothing enforced it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CVbaKucEYBjMqVeUgJUsc1
This commit is contained in:
2026-08-28 11:03:42 +04:00
parent 4af9880b86
commit 063a3ab9ad
+11
View File
@@ -1990,6 +1990,17 @@ func (w *worker) requestPhase(ctx context.Context, id string, s herdr.Session) b
if err := os.Remove(path); err != nil {
w.recordError(fmt.Errorf("phase request %s: %w", id, err))
}
if phase == domain.WorkPhaseReview {
// Each entry into review starts without the previous cycle's findings.
// The worktree survives a changes-requested round trip, so a reviewer
// that writes .orchestra/done without rewriting the file would have
// the earlier review sealed against the new commit — and submit binds
// whatever it reads to the commit it is submitting, so a stale pass
// would look exactly like a fresh one.
if err := os.Remove(filepath.Join(s.Worktree, ".orchestra", reviewFile)); err != nil && !os.IsNotExist(err) {
w.recordError(fmt.Errorf("clear stale review %s: %w", id, err))
}
}
t.WorkPhase = phase
w.tasks[id] = t
log.Printf("phase request %s accepted: %s to %s", id, req.From, phase)