Repository navigation
fix(workers): re-arm admission-deadline launches, terminalize dead-worker turns, defer debris cleanup - #130446
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 26, 2026, 7:36 PM ET / 23:36 UTC. ClawSweeper reviewWhat this changesThe PR retries worker launches that expire before admission, terminalizes proven-dead worker turns after a grace period, and defers orphan workspace cleanup until after Gateway readiness. Merge readiness⛔ Blocked by patch quality or review findings - 4 items remain The prior P1 credential-expiry blocker remains: re-arms reuse the descriptor minted before the first admission attempt, so the final advertised retry can be rejected as credential-expired instead of recovering the outage. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherGateway workers run session turns on paired node hosts. A credential-bound launch descriptor goes through the node supervisor journal, then placement recovery records the final session outcome. flowchart LR
A[Session turn] --> B[Worker turn owner]
B --> C[Credential-bound descriptor]
C --> D[Node supervisor journal]
D --> E{Admission result}
E -->|Deadline before start| F[Re-arm launch]
E -->|Started or terminal| G[Placement recovery]
G --> H[Visible session outcome]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +232, Tests +541, Docs +4. Total +777 across 21 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Mint and atomically bind a fresh claim-bound credential and launch descriptor for every eligible re-arm, then prove the fifth attempt remains admissible after the earlier deadline windows. Do we have a high-confidence way to reproduce the issue? Yes, from source: advance a credential-bound launch through four 120-second admission deadlines and backoffs, then observe the fifth attempt use the original credential past its ten-minute expiry. Is this the best way to solve the issue? No: bounded re-arms are the right shape, but they must obtain a current authoritative credential at the retry owner or be capped within the credential lifetime. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 02a60e0d8714. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
88b22c9 to
d8bd5a5
Compare
…rker turns, defer debris cleanup Three lifecycle repairs from the 50-worker campaign (#129979): the gateway launch adapter re-arms a launch up to five times (exponential backoff with jitter, caller-deadline capped, deterministic derived launch/turn ids so adapter replays find the same journal rows) when the node journal proves the child died on the admission deadline — credential/build rejections and post-start failures stay terminal; stuck-turn recovery records a terminal failure once a journal-terminal worker has no claim past a 30s cleanup grace instead of skipping keep_lane forever; and startup recovery defers orphan git cleanup for terminal placements into the first tracked background sweep (50-placement fixture: 50 startup git scans to zero, ~556ms to ~5ms) while pending-result recovery and ownership fences stay ahead of readiness.
d8bd5a5 to
7157deb
Compare
…time Re-arms reused the credential minted before the first admission attempt, so with five 120s windows plus backoff the final advertised retry could start after the credential expiry and fail closed as credential-expired. The launcher now threads credential.expiresAtMs through the tunnel launch request, and the adapter re-arms only while the retried child still gets a full admission window (WORKER_ADMISSION_DEADLINE_MS, now shared from the connection contract) on the original credential; otherwise it returns the terminal admission result. Expiry-boundary tests walk both sides.
|
@clawsweeper re-review — the P1 (re-arms reusing the pre-expiry credential) is addressed at head 940780d: the launcher threads credential.expiresAtMs through the tunnel launch request and the adapter re-arms only while the retried child still gets a full admission window on the original credential, with expiry-boundary tests walking both sides of the envelope. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
…rker turns, defer debris cleanup (openclaw#130446) * fix(workers): re-arm admission-deadline launches, terminalize dead-worker turns, defer debris cleanup Three lifecycle repairs from the 50-worker campaign (openclaw#129979): the gateway launch adapter re-arms a launch up to five times (exponential backoff with jitter, caller-deadline capped, deterministic derived launch/turn ids so adapter replays find the same journal rows) when the node journal proves the child died on the admission deadline — credential/build rejections and post-start failures stay terminal; stuck-turn recovery records a terminal failure once a journal-terminal worker has no claim past a 30s cleanup grace instead of skipping keep_lane forever; and startup recovery defers orphan git cleanup for terminal placements into the first tracked background sweep (50-placement fixture: 50 startup git scans to zero, ~556ms to ~5ms) while pending-result recovery and ownership fences stay ahead of readiness. * fix(workers): use the diagnosed admission-deadline message after openclaw#130435 rebase WorkerConnection now formats the redacted last-failure diagnosis into the deadline error itself, so the runtime's re-format (and its lastConnectionFailure tracking) is redundant; errorText uses error.message. * fix(workers): cap admission re-arms within the minted credential lifetime Re-arms reused the credential minted before the first admission attempt, so with five 120s windows plus backoff the final advertised retry could start after the credential expiry and fail closed as credential-expired. The launcher now threads credential.expiresAtMs through the tunnel launch request, and the adapter re-arms only while the retried child still gets a full admission window (WORKER_ADMISSION_DEADLINE_MS, now shared from the connection contract) on the original credential; otherwise it returns the terminal admission result. Expiry-boundary tests walk both sides.
What Problem This Solves
Three lifecycle defects proven live in the 50-worker farm campaign (#129979):
stuck session recovery: status=skipped action=keep_laneevery cycle for 25+ minutes over provably dead workers; turns only ended via caller timeouts.Why This Change Was Made
keep_laneforever. Genuinely live slow turns are untouched — the predicate requires journal-terminal + claim-free + grace elapsed, revalidated against the exact drain generation.User Impact
A farm node surviving a network blip finishes its turns instead of burying them; dead-worker turns fail visibly within seconds, not after 25-minute waits; gateways restart promptly even after a bad night of failed placements.
Evidence
All regressions verified failing pre-fix (re-arm on admission-deadline with journaled attempts and terminal-rejection immediacy; grace-gated terminalization vs. live-turn preservation; deferred-cleanup ordering with fences ahead of readiness). Focused suites green: launcher (67), supervisor child processes, journal replay, runtime admission, diagnostics;
pnpm check:changedgreen; Codex autoreview clean (0.94). Two failing tests in unchanged files (config.test.tssubprocess startup,workspace-sync-scripts.test.tsquiescence fixtures) reproduce on cleanorigin/main— pre-existing, not introduced here. Production +229, tests/support +544; no schema/config changes. A combined live rig run with the reconciliation lane follows before the campaign closes.Context: #129979