Skip to content

fix: recover interrupted command dispatches - #407

Merged
steipete merged 8 commits into
mainfrom
fix/recover-interrupted-command-dispatches
Jul 4, 2026
Merged

fix: recover interrupted command dispatches#407
steipete merged 8 commits into
mainfrom
fix/recover-interrupted-command-dispatches

Conversation

@steipete

@steipete steipete commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

What changed

This keeps the useful pre-dispatch claim from #380, but makes the claim recoverable instead of terminal.

  • Review, assist, and repair dispatches carry deterministic receipt keys.
  • Retries recover the exact Actions run created after the durable claim. Active runs wait; successful executions recover; failed, cancelled, skipped, timed-out, or missing runs retry after the visibility window.
  • Exact-review dispatch keeps the existing workflow_dispatch fallback. The fallback carries the same receipt key and produces the same recoverable run title as repository_dispatch.
  • Assist and repair recovery verifies that the real worker job succeeded. A successful receipt-only duplicate cannot be mistaken for completed work.
  • Before a stale or terminal claim is retried, its durable timestamp is refreshed. A second crash therefore gets a fresh grace window instead of immediately dispatching another duplicate.
  • Receiving workflows give the oldest active or successfully executed same-key run ownership. Later duplicates and failed older runs cannot suppress every retry.
  • Active repair detection recognizes keyed run names, including issue-implementation titles.
  • Synthetic label-sweep commands recover prior claims by stable idempotency key, while each legitimate new attempt gets a fresh receipt key.
  • API-read failures fail closed: the router waits instead of risking duplicate execution.

The contributor branch could not be updated through the available workflow-scoped OAuth authorization, so this replacement preserves and extends @ag-linden's work with co-author credit.

Proof

Exact head: ca335bc305181cbfe61c60af91480f937e3e8eec

  • Live GitHub Actions fallback smoke: run 28708493789 completed successfully on the exact head. GitHub accepted the keyed workflow_dispatch, rendered Review event item openclaw/clawsweeper#407 [router-live-ca335bc3], planned exactly PR fix: recover interrupted command dispatches #407, completed the review shard, published artifacts, and completed recovery handling.
  • The live smoke proves the real fallback transport, keyed title, exact-item routing, worker execution, and artifact publication. Crash timing itself remains covered by the deterministic regression tests rather than an intentionally killed production worker.
  • Crash/retry contract: crash before dispatch waits; crash after dispatch recovers; stale claim without a receipt retries.
  • Receipt regression: failed owner → receipt-only duplicate success → later retry proceeds for both assist and repair; actual worker success remains authoritative; API failure fails closed.
  • Full repository: 604 unit tests, 617 repair tests, and 1,221 aggregate coverage tests passed.
  • Changed coverage: 100% lines, 89.17% branches, 100% functions.
  • Overall coverage: 76.69% lines, 70.65% branches, 84.00% functions.
  • Build, lint, formatting, active-surface, workflow-input, and automation-limit checks passed.
  • AutoReview: clean; patch correct at 0.78 confidence on the exact final tree.

Risk

Medium. This changes command-dispatch recovery and three receiving workflows. Recovery is deliberately conservative: claims wait five minutes before stale recovery, worker execution must be proven for assist/repair, failed receipts remain retryable, the fallback preserves the previous transport, and receiver-side ownership prevents duplicate execution without losing every copy.

Replaces #380.

steipete and others added 2 commits July 4, 2026 12:49
Co-authored-by: Alex <alexgild@gmail.com>
Co-authored-by: Alex <alexgild@gmail.com>
@steipete
steipete requested a review from a team as a code owner July 4, 2026 11:50
@clawsweeper

clawsweeper Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed July 4, 2026, 10:09 AM ET / 14:09 UTC.

Summary
The branch adds recoverable command-dispatch claims with deterministic receipt keys across review, assist, and repair workflows, plus receipt-gate logic and regression coverage.

Reproducibility: yes. source inspection gives a high-confidence reproduction path: append two executed repair_loop_label_sweep entries for the same idempotency key and appendLedger collapses them into one ledger record. autoRepairBlockReason then reads ledger.commands and can undercount previous repair dispatches.

Review metrics: 2 noteworthy metrics.

  • Workflow surface: 3 workflows modified. The patch changes live review, assist, and repair dispatch behavior, so maintainers should treat it as automation-sensitive.
  • Receipt gate: 1 shell script added. The new gh/jq receipt gate now decides whether assist and repair workers run or are skipped as duplicates.

Root-cause cluster
Relationship: canonical
Canonical: #407
Summary: This PR is the active replacement for the closed unmerged command-dispatch claim PR, but it still needs a ledger-history repair before merge.

Members:

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

Merge readiness
Overall: 🧂 unranked krab
Proof: 🦞 diamond lobster
Patch quality: 🧂 unranked krab
Result: blocked by patch quality or review findings.

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

Rank-up moves:

  • [P2] Fix synthetic repair-loop sweep ledger keying so later legitimate attempts preserve executed history.
  • [P2] Add a focused regression test showing autoRepairBlockReason counts multiple same-PR sweep dispatches across attempts.

Risk before merge

  • [P1] Merging the current head can undercount prior synthetic repair-loop dispatches for a PR, allowing automerge/autofix repair loops to exceed the intended maxAutoRepairsPerPr or maxAutoRepairsPerHead safety caps.
  • [P1] The patch changes live dispatch recovery across three workflows, so green CI alone does not prove the upgrade-safe command-ledger behavior after persisted state already contains repair-loop entries.

Maintainer options:

  1. Fix synthetic sweep ledger identity (recommended)
    Keep the recoverable claim behavior, but key executed repair-loop sweep entries by attempt so later sweeps do not overwrite prior dispatch history.
  2. Accept owner responsibility for cap undercounting
    Maintainers could intentionally land with the current ledger behavior only if they accept that repair-loop safety caps may be weaker until a follow-up patch ships.
  3. Pause in favor of a narrower recovery PR
    If the ledger-compatibility repair grows beyond this branch, close or pause this replacement and land the recoverable-dispatch work through a smaller follow-up.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Fix synthetic repair_loop_label_sweep ledger keying so a claimed entry and its executed result for the same attempt coalesce, while later legitimate attempts for the same repo/intent/PR remain separate executed ledger records; add focused regression coverage showing autoRepairBlockReason counts multiple synthetic sweep dispatches across attempts.

Next step before merge

  • [P2] A focused automated repair is appropriate because the remaining blocker is mechanical ledger keying and regression coverage, not product direction.

Security
Cleared: The workflow and shell-script changes are security-sensitive, but I found no concrete secret, permission, dependency, or supply-chain regression beyond the functional automation blocker.

Review findings

  • [P1] Preserve synthetic sweep repair history — src/repair/comment-router-utils.ts:400
Review details

Best possible solution:

Preserve claim-to-executed coalescing for a single synthetic sweep attempt while assigning later legitimate repair-loop sweeps distinct ledger keys, with regression coverage proving autoRepairBlockReason still counts multiple attempts.

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

Yes, source inspection gives a high-confidence reproduction path: append two executed repair_loop_label_sweep entries for the same idempotency key and appendLedger collapses them into one ledger record. autoRepairBlockReason then reads ledger.commands and can undercount previous repair dispatches.

Is this the best way to solve the issue?

No, not yet. Recoverable dispatch receipts are the right direction, but the implementation needs safer ledger identity for synthetic sweep attempts before it is the narrowest maintainable fix.

Full review comments:

  • [P1] Preserve synthetic sweep repair history — src/repair/comment-router-utils.ts:400
    Late catch from this follow-up review: this keys every synthetic repair-loop sweep for the same repo/intent/PR by the same idempotency value. After the next scheduled automerge/autofix sweep, appendLedger overwrites the prior executed dispatch entry, so the repair-loop cap logic undercounts earlier repairs and can exceed maxAutoRepairsPerPr or maxAutoRepairsPerHead. Coalesce only the claim and executed result for the same attempt, while keeping later attempts as separate executed ledger records.
    Confidence: 0.91
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.9

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦞 diamond lobster and patch quality is 🧂 unranked krab.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (live_output): The PR body and live run show exact-head workflow_dispatch proof through planning, the real review worker, artifact publication, and recovery handling.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🧂 unranked krab, so this older rating label is no longer current.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: ⏳ waiting on author.

Label justifications:

  • P2: This is a normal-priority automation reliability fix with a blocking but bounded repair-loop safety issue before merge.
  • merge-risk: 🚨 automation: The diff changes command dispatch, receipt recovery, and worker gating across live GitHub Actions workflows.
  • merge-risk: 🚨 compatibility: The diff changes durable command-ledger semantics, and the current synthetic sweep keying can overwrite existing repair-loop history.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦞 diamond lobster and patch quality is 🧂 unranked krab.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (live_output): The PR body and live run show exact-head workflow_dispatch proof through planning, the real review worker, artifact publication, and recovery handling.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body and live run show exact-head workflow_dispatch proof through planning, the real review worker, artifact publication, and recovery handling.
Evidence reviewed

Acceptance criteria:

  • [P1] pnpm run build:repair.
  • [P1] node --test test/repair/comment-router-utils.test.ts test/repair/comment-router-core.test.ts.
  • [P1] pnpm run check.

What I checked:

  • Repository policy read: AGENTS.md was read fully; its repair-lane, workflow, and release-owned changelog guidance applies to this automation PR. (AGENTS.md:1, a52b852c3fc2)
  • Blocking PR-head source: At the exact PR head, synthetic repair-loop label sweeps without a comment version are keyed only by idempotency, so later legitimate sweeps for the same repo/intent/PR overwrite earlier executed ledger entries. (src/repair/comment-router-utils.ts:395, ca335bc30518)
  • Safety-counter dependency: The existing auto-repair cap logic counts prior dispatches from ledger.commands, so losing executed ledger entries can undercount max repairs per PR or head. (src/repair/comment-router-core.ts:1510, f69d9debf487)
  • Router cap call site: The router passes ledger.commands into autoRepairBlockReason with maxAutoRepairsPerPr and maxAutoRepairsPerHead, making ledger history preservation part of the runtime safety boundary. (src/repair/comment-router.ts:1321, f69d9debf487)
  • Real behavior proof: The linked Actions run 28708493789 completed successfully at head ca335bc with the keyed workflow_dispatch title, exact item planning, review shard, artifact publication, and recovery handling. (ca335bc30518)
  • Related PR provenance: Claim command dispatches before execution #380 is closed unmerged and is superseded by this recoverable-dispatch replacement path. (8e0325d6ce93)

Likely related people:

  • Vincent Koc: Blame shows the command-ledger keying and autoRepairBlockReason safety-counter code originated in f69d9de. (role: introduced behavior; confidence: high; commits: f69d9debf487; files: src/repair/comment-router-utils.ts, src/repair/comment-router-core.ts, src/repair/comment-router.ts)
  • brokemac79: Recent git history shows several commits touching the same repair/workflow paths, including PR close routing and apply health work. (role: recent area contributor; confidence: medium; commits: 682da993aa88, d7d856dd6e3b, a397ae06d380; files: src/repair/comment-router.ts, .github/workflows/sweep.yml)
  • steipete: Current main history includes several recent commits by this author touching the same workflow/repair automation paths, separate from authorship of this PR. (role: recent adjacent contributor; confidence: medium; commits: a52b852c3fc2, f4bc90093196, 1343d8ec0cef; files: .github/workflows/sweep.yml, src/repair/comment-router.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 (12 earlier review cycles; latest 8 shown)
  • reviewed 2026-07-04T13:02:00.476Z sha 2e5d648 :: needs changes before merge. :: [P2] Scope repair-loop sweep receipt keys to each attempt | [P3] Remove the release-owned changelog entry
  • reviewed 2026-07-04T13:07:22.629Z sha 2e5d648 :: needs changes before merge. :: [P2] Scope synthetic sweep receipt keys to each attempt | [P2] Refresh the claim before retrying a stale dispatch | [P2] Ignore receipt-only successes when recovering dispatches | [P3] Remove the release-owned changelog entry
  • reviewed 2026-07-04T13:15:09.100Z sha deaf276 :: needs changes before merge. :: [P2] Ignore receipt-only duplicate successes | [P2] Refresh stale dispatch claims before retry
  • reviewed 2026-07-04T13:20:13.471Z sha deaf276 :: needs changes before merge. :: [P2] Ignore receipt-only duplicate successes | [P2] Refresh stale dispatch claims before retry
  • reviewed 2026-07-04T13:33:19.920Z sha 1c7e05b :: needs real behavior proof before merge. :: [P2] Verify assist receipts before suppressing retries | [P2] Verify repair receipts before suppressing retries
  • reviewed 2026-07-04T13:42:32.153Z sha eab3622 :: needs real behavior proof before merge. :: [P1] Preserve the exact-review dispatch fallback
  • reviewed 2026-07-04T14:02:21.201Z sha ca335bc :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-04T14:02:56.609Z sha ca335bc :: needs maintainer review before merge. :: none

@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: 4bb104c118

ℹ️ 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 on lines +2415 to +2419
const expectedTitle = repairRunNameForJob(
command.target.job_path,
automergeRunNamePrefix,
dispatchKey,
);

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 Use the workflow's issue-implementation title for dispatch claims

For implement_issue repair jobs, command.target.job_path is jobs/<owner>/inbox/issue-...md, but .github/workflows/repair-cluster-worker.yml names those runs issue implementation <job> [<dispatch_key>]. repairRunNameForJob() still falls back to repair cluster <job> [<dispatch_key>] for non-automerge jobs, so claimedDispatchState() never matches an existing issue-implementation receipt; after the grace period the router redispatches instead of recovering the prior dispatch claim.

Useful? React with 👍 / 👎.

Comment thread src/repair/comment-router.ts Outdated
Comment on lines +382 to +383
function priorDispatchClaim(command: LooseRecord) {
return priorDispatchClaims.get(commentVersionKey(command) ?? "") ?? null;

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 Fall back to idempotency keys for synthetic dispatch claims

This lookup only uses commentVersionKey, but synthetic commands from listRepairLoopSweepCommands() have comment_version_key: null and a comment_updated_at based on the current router start time. After an interrupted label-sweep dispatch, the next run generates a different version key and cannot find the prior claimed ledger entry, even though dispatchReceiptKey() is stable via idempotency_key, so the router can redispatch during the recovery window instead of waiting/recovering.

Useful? React with 👍 / 👎.

@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: 6203048cde

ℹ️ 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 on lines +386 to +389
function dispatchReceiptKey(command: LooseRecord) {
return `router-${createHash("sha256")
.update(String(command.idempotency_key ?? command.comment_version_key ?? "unknown"))
.digest("hex")

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 Make synthetic sweep dispatch keys per repair attempt

For repair-loop label sweeps, idempotency_key is stable for the same repo/intent/PR, so hashing only this value makes every future automerge/autofix worker for that PR reuse the same dispatch_key and therefore the same repair run title. The new receipt jobs skip when any older exact title exists, so a later legitimate sweep after a new head or resume can be dispatched and then skipped as a duplicate while the router records it as executed. Include an attempt-specific value for synthetic sweeps, or bound the receiver dedupe to the current claim window.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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

steipete commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@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.

Align issue-implementation receipts, recover synthetic commands by idempotency key, ignore failed workflow receipts, and stabilize instrumented coverage tests.
@steipete

steipete commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Please review exact head 2e5d648f02bb93d7d7f85226439d19ea8f0b077c. The prior three findings are fixed, and terminal failed/cancelled/skipped/timed-out receipt runs now remain retryable after the visibility grace period.

@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: 2e5d648f02

ℹ️ 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 on lines +153 to +156
const successfulRun = matchingRuns.find(
(run) => String(run.conclusion ?? "").toLowerCase() === "success",
);
if (successfulRun) return { action: "recover", run: successfulRun };

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 Ignore receipt-only successes when recovering dispatches

With the new receipt jobs in assist.yml and repair-cluster-worker.yml, a duplicate run that sees an older active run writes proceed=false and exits successfully, so that workflow run can have conclusion success even though the assist/cluster worker never ran. Because this branch recovers on any matching successful run, if the older run later fails, a subsequent router retry will recover the skipped duplicate and mark the dispatch executed instead of redispatching.

Useful? React with 👍 / 👎.

Comment thread src/repair/comment-router.ts Outdated
Comment on lines +352 to +355
const claims = commands
.filter(commandNeedsDurableDispatchClaim)
.filter((command) => !priorDispatchClaim(command))
.map((command) => ({

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 Refresh the claim before retrying a stale dispatch

When a prior claim is stale and no receipt is visible, this filter prevents writing a fresh claim for the retry attempt. If the router crashes again after redispatching but before the run becomes visible or the final ledger append happens, the next run still compares against the old processed_at that is already past the grace window and immediately dispatches again instead of waiting another visibility window, allowing repeated duplicate dispatches during the crash-recovery path this claim is meant to protect.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 4, 2026
@steipete

steipete commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Please review exact head deaf276f7929831412a584ef0966f3bc56d068bf. Synthetic repair-loop receipts now derive their attempt scope from the durable claim timestamp: crash retries reuse one receipt, later legitimate sweeps get a new receipt, and the executed ledger entry replaces the claim. The release-owned changelog edit is removed.

@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.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 4, 2026

steipete commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Exact head: 1c7e05b135e088b08a64bcadaf36e6203a1e09e5.

The two exact-review findings are repaired:

  • assist/repair recovery now checks the real worker job, so a receipt-only duplicate success cannot finalize the command;
  • stale or terminal retries refresh the durable claim timestamp and receipt key before redispatch, restoring a full crash-recovery grace window.

Local proof: 189 focused tests, 600 unit tests, 617 repair tests, full check and both coverage modes green, formatting green, AutoReview 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.

@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: 1c7e05b135

ℹ️ 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 .github/workflows/assist.yml Outdated
expected_title="Assist ${TARGET_REPO}#${ITEM_NUMBER} [${DISPATCH_KEY}]"
if gh api --method GET "repos/${GITHUB_REPOSITORY}/actions/workflows/assist.yml/runs?per_page=100" \
| jq -e --arg title "$expected_title" --arg current "$GITHUB_RUN_ID" \
'any(.workflow_runs[]; .display_title == $title and .id < ($current | tonumber) and (.status == "queued" or .status == "in_progress" or .status == "waiting" or .status == "pending" or .status == "requested" or .conclusion == "success"))' >/dev/null; then

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 Exclude receipt-only successes from duplicate gates

When a same-key duplicate is dispatched while the older assist/repair run is still queued or in progress, this receipt job exits 0 with proceed=false; GitHub records that receipt-only run as a successful workflow even though the real assist job (and the analogous Plan and review cluster job in .github/workflows/repair-cluster-worker.yml) was skipped. Because this predicate treats any older .conclusion == "success" as a duplicate, if the original run later fails, every router retry with the same dispatch key is skipped by the receipt-only success while the router's new job verification refuses to recover it, leaving the command in a claimed/retry loop.

Useful? React with 👍 / 👎.

@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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 4, 2026
@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. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 4, 2026
@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. and removed merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. 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. labels Jul 4, 2026

@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: ca335bc305

ℹ️ 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 on lines +396 to +400
!entry.comment_version_key &&
entry.automation_source === "repair_loop_label_sweep" &&
entry.idempotency_key
) {
return `idempotency:${entry.idempotency_key}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve synthetic sweep repair history

For repair-loop label sweeps, comment_version_key is always null and idempotency_key is stable for the same repo/intent/PR, so this key collapses every executed sweep for that PR into a single ledger entry. autoRepairBlockReason() relies on the ledger entries with executed dispatch_repair actions to enforce maxAutoRepairsPerPr/maxAutoRepairsPerHead; after the second scheduled repair the older dispatch history is overwritten, allowing the sweep lane to undercount prior repairs and exceed the intended safety caps. Collapse only the claimed→executed record for the same attempt, or include attempt-specific material for executed sweep entries.

Useful? React with 👍 / 👎.

steipete commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Exact head: ca335bc305181cbfe61c60af91480f937e3e8eec.

The compatibility finding is fixed, and current-head live proof is now attached: https://github.com/openclaw/clawsweeper/actions/runs/28708493789 completed successfully through keyed workflow_dispatch, exact #407 planning, the real review worker, artifact publication, and recovery handling.

The PR body also records the full 604 unit / 617 repair / 1,221 aggregate test proof and the clean final AutoReview.

@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.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 4, 2026
@steipete
steipete merged commit b81ec96 into main Jul 4, 2026
31 checks passed
@steipete
steipete deleted the fix/recover-interrupted-command-dispatches branch July 4, 2026 14:11
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. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant