From 063a3ab9ad8c8c6389327c66b248bc32789970d9 Mon Sep 17 00:00:00 2001 From: kami Date: Fri, 28 Aug 2026 11:03:42 +0400 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_01CVbaKucEYBjMqVeUgJUsc1 --- cmd/orchestra-worker/main.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/orchestra-worker/main.go b/cmd/orchestra-worker/main.go index 8579e9a..954a508 100644 --- a/cmd/orchestra-worker/main.go +++ b/cmd/orchestra-worker/main.go @@ -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)