Skip to content

fix(apply): tolerate deleted review targets - #409

Merged
steipete merged 3 commits into
mainfrom
fix/apply-missing-item
Jul 4, 2026
Merged

steipete merged 3 commits into
mainfrom
fix/apply-missing-item

Conversation

@steipete

@steipete steipete commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

Why

Live monitoring found run 28709649723 failing after a successful review because target item openclaw/openclaw#99991 was deleted before apply-decisions fetched its live state. GitHub correctly returned 404, but apply treated that terminal race as a workflow failure.

What changed

  • Treat a confirmed item-level 404 as the same terminal state as an already-closed item.
  • Verify repository access before archiving, so a missing/inaccessible repo still fails safely.
  • Preserve comment-only semantics: record the missing item without moving its report out of the active queue.
  • Keep every non-404 fetch failure fatal.
  • Add focused regressions for item deletion, comment-only mode, and repository-level 404.

Proof

Exact head: a297b52e8e619b2ba165e066b02450650ca93050

  • Focused test/apply-live-state.test.ts: 3/3 passed.
  • Full pnpm run check: 617 unit and 617 repair tests passed.
  • Overall coverage: 76.87% lines, 70.80% branches, 84.13% functions.
  • Formatting clean.
  • AutoReview first found two edge cases; both repaired. Final AutoReview: no actionable findings, confidence 0.82.
  • Live smoke against deleted openclaw/openclaw#99991: exit 0, source report removed, durable record archived, apply report emitted skipped_already_closed with reason item not found on GitHub.
  • The smoke made no GitHub write; the only follow-up call confirmed repository access.

No changelog entry: this is internal apply-run reliability with no user-facing contract change.

@clawsweeper

clawsweeper Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 4, 2026, 11:30 AM ET / 15:30 UTC.

Summary
The branch changes apply-decisions to treat confirmed item-level GitHub 404s as deleted/already-closed targets, preserve comment-only behavior, keep repository-level 404s fatal, and add focused live-state regression tests.

Reproducibility: yes. Source inspection plus the failed workflow log show current main fetches the live item before closed-state handling, and a deleted GitHub target 404 fails the apply run; I did not run a mutating apply repro in this read-only review.

Review metrics: 2 noteworthy metrics.

  • Changed surface: 2 files changed, +185/-1. The diff is small, but it touches apply automation that moves durable review records.
  • Regression coverage: 3 apply live-state cases added. The tests cover deleted-item archival, comment-only retention, and repository-level 404 safety.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Risk before merge

  • [P1] This intentionally changes apply-lane durable-state handling for item-level 404s; a regression here could misarchive records or mask repository-access failures, so maintainers should treat it as automation-sensitive even though the new tests cover the main edge cases.

Maintainer options:

  1. Merge after normal checks finish (recommended)
    Because the previous blockers are repaired and the remaining risk is bounded to apply-lane behavior, maintainers can accept the automation change once required checks are green.
  2. Ask for fuller smoke transcript
    If maintainers want stronger operational proof, ask for the exact redacted live command/output before merging even though the PR body now reports a successful deleted-target smoke.

Next step before merge

  • [P2] Human merge judgment remains because the PR intentionally changes apply-lane automation behavior; there is no narrow automated repair to request.

Security
Cleared: The diff changes TypeScript apply control flow and tests only; I found no dependency, secret, permission, or third-party code execution concern.

Review details

Best possible solution:

Land the narrow 404 handling once maintainers accept the bounded apply-lane behavior and required checks pass, keeping comment-only records queued and repository-level 404s fatal.

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

Yes. Source inspection plus the failed workflow log show current main fetches the live item before closed-state handling, and a deleted GitHub target 404 fails the apply run; I did not run a mutating apply repro in this read-only review.

Is this the best way to solve the issue?

Yes. Catching only GitHub not-found, confirming repository access, preserving comment-only semantics, and covering the edge cases is the narrow maintainable fix.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 55652622c484.

Label changes

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body and follow-up comment provide the exact head plus a real deleted-target smoke result showing exit 0, archived durable state, and skipped_already_closed output.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit. Replaced prior rating: 🧂 unranked krab.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: This fixes a real apply-lane reliability failure with limited blast radius and focused tests.
  • merge-risk: 🚨 automation: The diff changes how apply automation handles live GitHub 404s and durable report archival.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit. Replaced prior rating: 🧂 unranked krab.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Sufficient (live_output): The PR body and follow-up comment provide the exact head plus a real deleted-target smoke result showing exit 0, archived durable state, and skipped_already_closed output.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body and follow-up comment provide the exact head plus a real deleted-target smoke result showing exit 0, archived durable state, and skipped_already_closed output.
Evidence reviewed

What I checked:

  • Repository policy read: The target AGENTS.md was read fully; its apply-lane safety guidance and instruction to put narrow coverage in focused test files affected this review. (AGENTS.md:11, 55652622c484)
  • Current main failure path: Current main calls fetchItem(number) before any already-closed handling, so a GitHub 404 from the initial live item fetch escapes the apply run. (src/clawsweeper.ts:17557, 55652622c484)
  • Observed production failure: The linked workflow failed in apply-decisions for deleted target Docs feedback: /start/getting-started openclaw#99991 after gh api repos/openclaw/openclaw/issues/99991 returned Not Found (HTTP 404). (b81ec9657604)
  • Proposed 404 handling: The PR head catches isGitHubNotFoundError, verifies repository access, skips in-place for --sync-comments-only, and archives only non-comment-only deleted targets as skipped_already_closed. (src/clawsweeper.ts:17554, a297b52e8e61)
  • Regression coverage: The PR adds focused tests for deleted-target archival, comment-only queue retention, and repository-level 404 failure in test/apply-live-state.test.ts. (test/apply-live-state.test.ts:13, a297b52e8e61)
  • Review continuity: The latest PR body and follow-up comment say the prior comment-only and test-placement findings were repaired, and the current diff reflects those repairs. (a297b52e8e61)

Likely related people:

  • Vincent Koc: Blame attributes the current applyDecisionsCommand structure and direct initial fetchItem path to this commit. (role: introduced behavior; confidence: medium; commits: df861c9f65e8; files: src/clawsweeper.ts)
  • brokemac79: Recent commits changed apply queue batching, report scan caching, and adjacent apply-health behavior near this code path. (role: recent area contributor; confidence: medium; commits: 5bdf6f31c904, 44f0d7ac1222, ead7d6461a6c; files: src/clawsweeper.ts, test/clawsweeper.test.ts)
  • steipete: Recent current-main commits changed review/apply automation surfaces, including scan-window and local-range review work, and this PR is in the same area. (role: recent area contributor; confidence: high; commits: 55652622c484, a52b852c3fc2, f4bc90093196; files: src/clawsweeper.ts, test/clawsweeper.test.ts)
  • Dallin Romney: Recent commits split the apply decision and apply policy tests, which is relevant to the focused test placement used by this PR. (role: adjacent test owner; confidence: medium; commits: 323f7bdf7236, e73fecd30a70; files: test/clawsweeper.test.ts, test/apply-live-state.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (2 earlier review cycles)
  • reviewed 2026-07-04T15:09:28.611Z sha a392369 :: needs real behavior proof before merge. :: [P3] Move this regression into a focused apply suite
  • reviewed 2026-07-04T15:14:43.802Z sha a392369 :: needs real behavior proof before merge. :: [P2] Preserve comment-only behavior for deleted items | [P3] Move this regression into a focused apply suite

steipete commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Please review exact head a392369917db149cf39686542b138cd30e6245ce against the observed 404 apply failure linked in the PR body.

@clawsweeper

clawsweeper Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a392369917

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/clawsweeper.ts
Comment on lines +17564 to +17566
markdown = replaceFrontMatterValue(markdown, "action_taken", "skipped_already_closed");
markdown = replaceFrontMatterValue(markdown, "apply_checked_at", new Date().toISOString());
archiveClosed(markdown);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Skip archiving during comment-only sync

When --sync-comments-only is set, this catch still runs before the existing syncCommentsOnly && state !== "open" branch that only marks closed live items as checked and leaves them in items/. A scheduled comment-sync run that hits a deleted item will now rewrite action_taken and move the record into closed/, so comment-only automation performs archival apply work while the same mode intentionally avoids archiving normally closed items; gate this path on !syncCommentsOnly or mirror the closed-item skip behavior.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in a297b52e8e: the 404 path now mirrors comment-only semantics at src/clawsweeper.ts:17565, marking the check without changing action_taken or archiving. test/apply-live-state.test.ts covers the queued-record behavior.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. labels Jul 4, 2026

steipete commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review exact head a297b52e8e619b2ba165e066b02450650ca93050. The prior review's two asks are now addressed: the regression is isolated in test/apply-live-state.test.ts, and a real deleted-target smoke exits 0 and archives as skipped_already_closed. AutoReview also found and drove fixes for comment-only semantics and repository-level 404 safety; the final AutoReview is clean.

@clawsweeper

clawsweeper Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@steipete
steipete merged commit cdcb851 into main Jul 4, 2026
9 checks passed
@steipete
steipete deleted the fix/apply-missing-item branch July 4, 2026 15:35
azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
Treat confirmed item-level 404s as terminal without masking repository access failures or changing comment-only archival semantics. Add focused live-state regression coverage.
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. P2 Normal priority bug or improvement with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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.

1 participant