Skip to content

fix(review): let scheduled deliveries use the structural review cache - #1067

Merged
steipete merged 1 commit into
mainfrom
steipete/adopt-1053-cache-reachability
Aug 8, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/adopt-1053-cache-reachability

Conversation

@steipete

@steipete steipete commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Supersedes #1053 by @masatohoshino — same bug, smaller seam. Closes #1052.

Scheduled review deliveries run with --skip-start-comment because the exact-review queue reserves their lease before the runtime starts. That flag also disabled structural-cache coordination wholesale, so unchanged items were fully re-reviewed (Codex spend + API quota) every scheduled pass and could flip verdicts.

The Fix

Instead of restructuring review preparation (+837 in #1053), the cache path learns to use the supplied scheduled-delivery lease: coordination is enabled when a supplied lease exists, the lease is validated and claimed inside the existing structural-cache flow, and the cache decision is re-evaluated against the reservation's own timestamp so owned-lease activity no longer reads as activity_changed. No preparation logic moves; the target-head cache policy is untouched. +463/−64 across 5 files, 285 of which are the workflow-level regression fixture.

Proof

  • Regression fixture drives the real review workflow with scheduled flags and fail-fast hydration/Codex sentinels: cache-hit structural-unchanged skip-hydration-model #1052, structural_cache_hits=1 ... hydrations=0 (46/46 in the fixture file).
  • Full pnpm test:unit: 1,961/1,963 pass (2 skipped), 0 fail.
  • Coordinator autoreview clean (0.98).
  • What only a live lane can additionally prove: Worker→Actions dispatch and real lease/comment persistence; the local fixture covers everything below that boundary.

Credit: commit carries Co-authored-by: Masato Hoshino — the diagnosis and test approach originate from #1053.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 Urgent regression or broken agent/channel workflow affecting real users now. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. labels Aug 8, 2026
@clawsweeper

clawsweeper Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 8, 2026, 1:26 AM ET / 05:26 UTC.

ClawSweeper review

What this changes

The PR validates and reuses a workflow-reserved review lease so scheduled deliveries can enter the structural-cache path without posting a second start comment.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 7 items remain

Keep open: the PR fixes lease coordination and reservation activity, but it leaves the target-head comparison that still prevents scheduled structural-cache hits whenever the reviewed repository’s default branch advances.

Priority: P1
Reviewed head: abe8220c274e3b4ad7b6a38e7709b64baabd4ede

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch has a concrete partial repair, but it leaves the issue’s moving-target blocker and lacks production-boundary proof.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The added dependency-injected fixture is useful regression coverage, but it is not after-fix proof of a real scheduled workflow, lease, and persistence path; attach redacted runtime evidence and request a fresh review after updating the PR body. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The added dependency-injected fixture is useful regression coverage, but it is not after-fix proof of a real scheduled workflow, lease, and persistence path; attach redacted runtime evidence and request a fresh review after updating the PR body. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 5 items Remaining cache blocker: Current main still rejects a structural-cache hit when the target repository head differs from the prior record; the PR does not modify that condition, so a moving default branch still forces hydration.
PR scope: The branch enables lease-aware coordination and supplied-lease claiming before the structural-cache decision, but does not alter the target-head eligibility check.
Regression fixture boundary: The added fixture holds the target head constant and replaces hydration, Codex, and lease posting with sentinels, so it proves the local control flow but not the remaining moving-target case or a real workflow delivery.
Findings 1 actionable finding [P1] Remove the target-head gate before closing the scheduled-cache bug
Security None None.

How this fits together

The scheduled review workflow reserves a durable lease before invoking ClawSweeper’s review command. The command validates that lease, probes the structural cache, then either reuses a prior verdict or hydrates the item for a fresh Codex review.

flowchart LR
A[Scheduled delivery] --> B[Reserved review lease]
B --> C[Review command]
C --> D[Lease validation]
D --> E[Structural cache decision]
E -->|Cache hit| F[Reuse recorded verdict]
E -->|Cache miss| G[Hydrate and run review]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The added dependency-injected fixture is useful regression coverage, but it is not after-fix proof of a real scheduled workflow, lease, and persistence path; attach redacted runtime evidence and request a fresh review after updating the PR body. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Remove the target-head gate before closing the scheduled-cache bug (P1) - This enables scheduled coordination, but reviewStructuralCacheDecision still rejects any record whose target head changed. That is the central busy-repository case in Scheduled review deliveries cannot reach the structural review cache, so unchanged items are re-reviewed and re-rated every pass #1052, so scheduled deliveries will still hydrate and rerun Codex whenever the default branch advances.
  • Resolve merge risk (P1) - On repositories whose default branch advances between scheduled passes, the unchanged target-head gate will still force full hydration and verdict recomputation.
  • Resolve merge risk (P1) - The submitted proof is a dependency-injected fixture, not a controlled workflow/lease run through the production boundary.
  • Complete next step (P2) - A narrow repair can remove the remaining target-head cache gate and add focused coverage; real workflow proof remains required before merge.
  • Improve patch quality - Remove the retained cross-review target-head invalidation and add the corresponding regression coverage.
  • Improve patch quality - Attach a redacted controlled workflow trace showing a scheduled reserved-lease cache hit with zero hydration.

Findings

  • [P1] Remove the target-head gate before closing the scheduled-cache bug — src/clawsweeper-review-command-workflow.ts:456
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch surface 5 files: production +141/-58, tests +315 Most growth is focused regression coverage, while the production change remains limited to review-cache coordination.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #1052
Summary: This PR is a partial candidate fix for the scheduled structural-cache defect; the target-head invalidation remains unresolved.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Complete the moving-target fix and prove it (recommended)
    Remove the cross-review target-head invalidation for scheduled structural reuse, retain same-run drift checks, and attach a redacted real workflow trace showing a reserved-lease cache hit with zero hydration.
  2. Narrow the PR to its partial fix
    Keep the lease and reservation-activity repair but remove the closing claim for Scheduled review deliveries cannot reach the structural review cache, so unchanged items are re-reviewed and re-rated every pass #1052 until the target-head behavior is addressed separately.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Remove the cross-review target-head invalidation for scheduled structural reuse while retaining same-run revalidation; add focused moving-target coverage and attach a redacted real reserved-lease workflow trace with zero hydration.

Technical review

Best possible solution:

Allow scheduled structural reuse to ignore cross-review target-head movement while retaining the existing same-run revalidation and cache-age ceiling, then demonstrate an after-fix scheduled delivery with a real reserved lease and zero hydration.

Do we have a high-confidence way to reproduce the issue?

Yes—source reproducible: a scheduled delivery with a valid reservation can pass the new coordination path, but a changed target head still returns target_changed and forces hydration.

Is this the best way to solve the issue?

No—the lease-aware change is a useful partial repair, but it does not resolve the moving-default-branch condition central to #1052.

Full review comments:

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 985651bf6642.

Labels

Label changes:

  • add P1: The remaining gate keeps scheduled reviews on active repositories from reusing stable verdicts, preserving recurring Codex cost and verdict churn.
  • add merge-risk: 🚨 automation: This PR changes scheduled review and lease coordination, but the retained cache gate and lack of production-boundary proof leave automation behavior unresolved.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The added dependency-injected fixture is useful regression coverage, but it is not after-fix proof of a real scheduled workflow, lease, and persistence path; attach redacted runtime evidence and request a fresh review after updating the PR body. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P1: The remaining gate keeps scheduled reviews on active repositories from reusing stable verdicts, preserving recurring Codex cost and verdict churn.
  • merge-risk: 🚨 automation: This PR changes scheduled review and lease coordination, but the retained cache gate and lack of production-boundary proof leave automation behavior unresolved.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The added dependency-injected fixture is useful regression coverage, but it is not after-fix proof of a real scheduled workflow, lease, and persistence path; attach redacted runtime evidence and request a fresh review after updating the PR body. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Acceptance criteria:

  • [P1] pnpm run check.
  • [P1] Run the focused scheduled review-cache tests including moving-target issue and PR cases.
  • [P1] Run a Docker-backed Crabbox controlled scheduled-delivery proof and record provider, image, lease, head, trace artifact, zero-hydration result, and limits.

What I checked:

  • Remaining cache blocker: Current main still rejects a structural-cache hit when the target repository head differs from the prior record; the PR does not modify that condition, so a moving default branch still forces hydration. (src/review-structural-cache.ts:1278, 985651bf6642)
  • PR scope: The branch enables lease-aware coordination and supplied-lease claiming before the structural-cache decision, but does not alter the target-head eligibility check. (src/clawsweeper-review-command-workflow.ts:456, abe8220c274e)
  • Regression fixture boundary: The added fixture holds the target head constant and replaces hydration, Codex, and lease posting with sentinels, so it proves the local control flow but not the remaining moving-target case or a real workflow delivery. (test/review-command-workflow.test.ts:52, abe8220c274e)
  • Feature history: The structural-cache area includes the owned-activity suppression work in this commit, making its author a relevant routing candidate for the retained cache-boundary behavior. (src/review-structural-cache.ts:1203, b83f2983da6b)
  • Release status: The PR head is not contained by a local branch or tag, including the supplied latest release v0.3.0; it is unmerged work rather than an implementation already on main. (abe8220c274e)

Likely related people:

  • PollyBot13: Authored the current-main owned-activity cache work that is adjacent to the reservation timestamp behavior this PR extends. (role: recent structural-cache contributor; confidence: high; commits: b83f2983da6b; files: src/review-structural-cache.ts)
  • steipete: Recent current-main history includes review-command workflow work, in addition to the proposed lease-aware change. (role: recent review-workflow contributor; confidence: medium; commits: 14bd27bc8fa1; files: src/clawsweeper-review-command-workflow.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. P1 Urgent regression or broken agent/channel workflow affecting real users now. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scheduled review deliveries cannot reach the structural review cache, so unchanged items are re-reviewed and re-rated every pass

1 participant