Repository navigation
Conversation
|
Quick heads-up on the What's failing
Verified against your current body: You have Local self-check (no CI round-trip needed)Run this against your body before pushing: gh pr view 96083 --repo openclaw/openclaw --json body \
| jq -r .body > /tmp/pr-96083-body.md
node -e '
import("./scripts/github/real-behavior-proof-policy.mjs")
.then(({ evaluatePullRequestContext }) => {
const body = require("fs").readFileSync("/tmp/pr-96083-body.md", "utf8");
const ev = evaluatePullRequestContext({
pullRequest: {
user: { login: "Bartok9", type: "User" },
author_association: "CONTRIBUTOR",
body,
},
});
console.log(JSON.stringify(ev, null, 2));
process.exit(ev.passed ? 0 : 1);
});
'Exit 0 = body passes the gate. Exit 1 = missingSection(s) listed. Minimal patchAdd a ## Evidence
- `npx vitest run src/agents/main-session-restart-recovery.test.ts src/gateway/session-lifecycle-state.test.ts` — **137 passed** (5 added).
- For the specific quarantine path: the new `main-session-restart-recovery.test.ts` case "quarantines the entry after `restartRecoveryAttempts` exceeds `MAX_RECOVERY_RETRIES`" prints `WARN restart-recovery: quarantining entry=<key> attempts=4 reason=exceeded_restart_retry_budget` and asserts `abortedLastRun === false`, `restartRecoveryQuarantinedAt` set, `restartRecoveryQuarantineReason === "exceeded_restart_retry_budget"`.That should flip the gate to green on the next The fix itself is the cleanest possible — exactly the issue's proposed shape, backwards compatible, transcript preserved, scoped to main-session recovery with subagent-orphan-recovery as a documented follow-up. Strong work; just needs the body section so CI stops blocking. |
|
Codex review: needs real behavior proof before merge. Reviewed July 10, 2026, 8:29 PM ET / July 11, 2026, 00:29 UTC. Summary PR surface: Source +213, Tests +333, Other +376. Total +922 across 10 files. Reproducibility: yes. at source level. Current main has only process-local or rapid-window recovery limits while the aborted state persists across boots, and the final-head subagent off-by-one follows directly from its gate and post-accept counter update. Review metrics: 2 noteworthy metrics.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Use one durable recovery fuse per owner surface, block subagent dispatch once three accepted recoveries have been recorded, preserve store-lock revalidation and maintenance recovery, and prove final-head main and subagent state transitions through the real file-backed entrypoints. Do we have a high-confidence way to reproduce the issue? Yes, at source level. Current main has only process-local or rapid-window recovery limits while the aborted state persists across boots, and the final-head subagent off-by-one follows directly from its gate and post-accept counter update. Is this the best way to solve the issue? No, not yet. A persistent fuse is the correct layer, but the subagent accepted-attempt boundary remains wrong and the final head lacks real production-entrypoint proof. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 920b29bdd5d8. Label changesLabel justifications:
Evidence reviewedPR surface: Source +213, Tests +333, Other +376. Total +922 across 10 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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
Review history (6 earlier review cycles)
|
|
Great design — the "increment only on fresh interruption" choice avoids the same-boot double-charge trap, and the "clear on successful lifecycle completion" semantic is exactly right (a future unrelated interruption should get a fresh allowance, not be punished for the historical failure). The 137 tests + quarantine boundary coverage are well-targeted. Two thoughts, framed as observations rather than demands — feel free to weigh in: 1. The issue explicitly requires the subagent-orphan-recovery path to land the same fix shape. From #95750 "Proposed fix shape", final paragraph:
The "Out of scope" callout in the PR body flags subagent-orphan-recovery as a documented follow-up — which is fair for diff-hygiene reasons — but it does mean the PR closes #95750 partially, and the follow-up will itself need a separate review cycle + ClawSweeper re-review. The second cycle is what typically eats wall-clock time on a fix like this. If the goal is to land #95750 fully in one cycle, the subagent-orphan-recovery addition is genuinely small. I read
That's a focused ~30-40 LoC addition in 1-2 files, plus 1-2 regression tests mirroring the existing boundary tests. Would keep the diff at ~280 LoC source instead of 102, and #95750 closes in one cycle. The line 2. Real behavior proof — quick repro approach. ClawSweeper said "needs real behavior proof before merge" (🧂 → needs proof). The 137 vitest pass is solid, but a standalone repro driving the real // scripts/repro/issue-95750-restart-recovery-budget.mjs
// 1. Write a sessions.json with restartRecoveryAttempts=4 (over budget).
// 2. Call real recoverStore (the function your PR modifies).
// 3. Assert: 0 resumes, 1 quarantined, reason="exceeded_restart_retry_budget",
// transcript preserved.
// 4. Negative control: write attempts=3, assert 1 resume, 0 quarantine.
// 5. Clear path: write a successful run, assert attempts reset to 0.I don't want to scope-creep this comment into "here's a full repro implementation" — happy to send a follow-up commit with the script (or the subagent addition above) if useful, but figured the suggestion belongs in the conversation either way. Thanks for the careful design — the "fresh interruption" guard in particular is the kind of detail that often gets caught only in a production incident. |
5b3acc1 to
eb31dcb
Compare
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(gateway): bound cross-boot restart-recovery with a persistent retry budget This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
Thanks for the thorough read on both fronts. Real behavior proof / ClawSweeper: the Subagent-orphan-recovery scope: agreed the issue's proposed shape explicitly asks for the same ceiling on that surface, and landing it in one cycle avoids a second review+ClawSweeper round. I'll extend this PR with the symmetric change in Heads up: the one red check ( Pushing the two additions shortly. |
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(gateway): bound cross-boot restart-recovery with a persistent retry budget This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
78f5b4a to
b2a4200
Compare
|
Implemented happy path committed: subagent path + repro script (not just a promise). Files
VerifyHead: |
|
Thanks ClawSweeper — the two P1s are fair and I'll address both rather than argue them. [P1] Preserve recovery ownership before quarantining ( [P1] Use the existing subagent recovery fuse ( I'll keep the boundary tests (attempts=3 resumes, attempts>MAX quarantines, transcript preserved, no double-charge on re-mark/stale snapshot) and re-point the repro at the guarded path. CI: the two red checks ( Pushing the ownership-guard reordering + subagent consolidation shortly. |
54a699c to
c044340
Compare
…ry budget Main sessions keep restartRecoveryAttempts; quarantine only after routable/owner/dedupe guards and revalidation under the store lock. Subagent orphans reuse subagentRecovery's cumulative automaticAttempts ceiling (no parallel restartRecovery* fuse). Transcript preserved; attempts at MAX still resume; over-budget wedges/quarantines; no double-charge on stale snapshots. Repro: scripts/repro/issue-95750- restart-recovery-budget.mjs. Fixes openclaw#95750.
c044340 to
7c16388
Compare
- Close unbalanced brace / correct type annotations exposed after syntax fix - Guard failedRuns error match against string|undefined (r.error ?? "") - Extend inline subagentRecovery annotation with wedgedAt/wedgedReason Fixes check-test-types + check-lint red on the cross-boot budget PR.
Use String#includes instead of RegExp#test for the 'across boots' failedRuns assertion (oxlint typescript/prefer-includes).
subagent-orphan-recovery.ts now has 3 legacy sessionAccessorWrite call sites (was 4); ratchet the baseline down per the boundary guard.
Address ClawSweeper P1: a quarantined main-session row that accepts a new user turn retained its over-budget restartRecoveryAttempts, so the next unrelated interruption was quarantined immediately. Clear the budget + quarantine metadata on a fresh non-recovery 'start' (not only on 'done'); restart-recovery starts are already excluded via isRestartRecoveryLifecycleEvent, so a start reaching here is a genuine new turn. Adds regression test. Fixes openclaw#95750.
|
Addressed the remaining P1 — thanks for the precise pointer to [P1] Reset the recovery budget on a fresh turn ( const clearsRecoveryBudget =
snapshot.status === "done" || resolveLifecyclePhase(params.event) === "start";
if (clearsRecoveryBudget) {
if (normalizeRecoveryAttempts(params.entry?.restartRecoveryAttempts) > 0)
patch.restartRecoveryAttempts = undefined;
if (params.entry?.restartRecoveryQuarantinedAt != null) {
patch.restartRecoveryQuarantinedAt = undefined;
patch.restartRecoveryQuarantineReason = undefined;
}
}This closes the window you flagged: a quarantined row that accepts a new user turn no longer retains an over-budget Added a mirrored regression test ( The earlier subagent [P1] was already resolved by consolidating onto the existing CI: the one red shard ( Head: |
|
This pull request has been automatically marked as stale due to inactivity. |
|
Following up on the stale notice: it looks like #112562 (merged 2026-07-22) landed the cross-boot recovery budget for both the main-session and subagent-orphan paths — Happy to close this in favor of #112562 unless a maintainer sees a gap the merged work didn't cover. Thanks for the earlier reviews. |
|
Closing as superseded: #112562 (merged 2026-07-22) landed the persistent cross-boot recovery budget for both the main-session path (MAX_RECOVERY_RETRIES + mainRestartRecovery.chargedAttempts) and the subagent-orphan path (subagent-orphan-recovery.ts). That covers what #95750 asked for, so this PR's behavior now exists on main and rebasing would only re-conflict against the reworked recovery subsystem. Thanks all — closing in favor of the merged work. |
What Problem This Solves
Closes #95750.
When a channel main-session turn wedges and a restart marks the entry
abortedLastRun: true, the next boot's recovery pass calls back into the same resume path unconditionally. The in-process orchestrator (MAX_RECOVERY_RETRIES = 3) only bounds retries within a single process invocation — the counter is never persisted, so each fresh boot is a fresh retry budget. The result is a deterministic death loop untilsystemd'sStartLimitBurstis exhausted and an operator must intervene.This adds a persistent, cross-boot retry budget to main-session restart recovery and to the subagent-orphan recovery path so a genuinely wedged session can no longer death-loop the gateway across reboots. A session that can't be safely resumed is quarantined after a bounded number of attempts (transcript preserved) instead of re-triggering recovery on every boot.
Changes
SessionEntrygainsrestartRecoveryAttempts,restartRecoveryQuarantinedAt,restartRecoveryQuarantineReason(all optional, backwards compatible); reserved slot keys registered.restartRecoveryAttemptsonly on a fresh interruption (not alreadyabortedLastRun), so re-marking within one boot does not double-charge the budget.recoverStore): ifrestartRecoveryAttempts > MAX_RECOVERY_RETRIES, quarantine — clearabortedLastRun, recordrestartRecoveryQuarantinedAt+ reasonexceeded_restart_retry_budget, WARN log. Transcript pointer preserved.recoverOrphanedSubagentSessions): same cross-boot ceiling before resume; on accepted resume chargerestartRecoveryAttemptsonce with prior===snapshot guard (no double-charge).status: "done") clears budget + quarantine viaderivePersistedSessionLifecyclePatch.scripts/repro/issue-95750-restart-recovery-budget.mjs.Behavioral contract
attempts1→3)abortedLastRun=false,quarantinedAtset, WARN loggedEvidence
Exact commands after the full fix (main + subagent + repro):
Captured output AFTER full fix:
Regression tests: