Repository navigation
fix(process): arm supervisor timeouts before adapter construction - #136507
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
71a162d to
67e8573
Compare
|
Codex review: needs real behavior proof before merge. Reviewed September 3, 2026, 5:15 AM ET / 09:15 UTC. ClawSweeper reviewWhat this changesThe PR starts supervisor deadlines before child, PTY, and service-relay construction, aborts stalled setup, and adds cancellation and cleanup regression coverage. Regression provenancePossible regression — probable (reviewed change; known regression link). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 8 items remain Keep open: arming deadlines before construction fixes the correct supervisor boundary, but the newly introduced PTY abort path bypasses OpenClaw’s session-tree cleanup invariant and can leave PTY descendants alive. The external PR also still needs inspectable exact-head real-process proof. Priority: P1 Review scores
Verification
How this fits togetherThe process supervisor creates managed child, PTY, and service-relay runs for agent and gateway work. Adapter construction must either become a supervised run or be cancelled and cleaned up before the caller receives a terminal result. flowchart LR
A[Agent or gateway request] --> B[Process supervisor]
B --> C[Construction deadline]
C --> D[Child PTY or service relay adapter]
D --> E[Managed process]
C --> F[Cancellation and cleanup]
F --> E
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +121, Tests +385. Total +506 across 15 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Route PTY construction-abort cleanup through the existing session-tree SIGKILL mechanism, add a real descendant regression case, then attach a redacted exact-head trace showing timeout settlement and no surviving process tree. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main awaits adapter construction before arming deadlines, so a blocked constructor cannot be timed out. The contributor's claimed live run was not supplied as inspectable exact-head output. Is this the best way to solve the issue? No, not yet: the supervisor-level deadline race is the right owner boundary, but PTY construction abort must use the same session-tree cleanup invariant as normal adapter termination. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 74ade6f54c87. LabelsLabel justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (10 earlier review cycles; latest 8 shown)
|
Supervisor overall and no-output deadlines started only after createChildAdapter returned. Secret-fd delivery and the service-relay ready handshake have no inner deadline, so a hung constructor blocked the lane forever and cancelAdapter never ran. Arm the existing deadlines before construction and abort the wait when they fire. A late adapter is SIGKILL'd. Signed-off-by: Sebastien Tardif <[email protected]>
a8146e7 to
aa26e04
Compare
Pass construction AbortSignal into the service-relay owner so a startup timeout or manual cancel SIGKILLs the already-spawned relay before ready. Keep the first forced reason when a later deadline fires. Signed-off-by: Sebastien Tardif <[email protected]>
|
@clawsweeper re-review
Construction now passes an AbortSignal into the service-relay owner. Abort SIGKILLs the already-spawned child before ready. The first forced reason (including manual-cancel) is kept when a later deadline fires. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Construction abort now SIGKILLs the late adapter and returns a settled cancelled run instead of throwing spawn-error. Update the CLI pending-cancel and gateway-close consumer tests. Signed-off-by: Sebastien Tardif <[email protected]>
|
@clawsweeper re-review Follow-up |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
checks-node-compact-small-39 failed test/scripts/repo-e2e-artifacts.test.ts (config_newer vs clean). Not in this PR's diff. Fork cannot rerun jobs. Signed-off-by: Sebastien Tardif <[email protected]>
Construction abort now cancels the shared secret-fd write and SIGKILLs the already-spawned direct child. Relay abort stays armed through ready until secret delivery finishes, so a timeout cannot return while the relay is still blocked on a secret pipe. Signed-off-by: Sebastien Tardif <[email protected]>
|
@clawsweeper re-review
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…e compare TypeScript cannot see AuthorityState writes from the ready handler, so comparing state to identity-lost after a successful allSettled was TS2367. Use waitError and the abort flag instead. Signed-off-by: Sebastien Tardif <[email protected]>
|
@clawsweeper re-review Follow-up |
|
Thanks @SebTardif! Proof: A real service-managed child blocked on 8 MiB secret delivery now settles at the supervisor deadline and its recorded command PID is dead. The owner-boundary regression also covers abort racing deferred relay start delivery.
CI: LandPR used the registered-workload
That job's only failing test was the pre-existing shipped Merged as |
Main's node shard is red on the "bounds blocked service-relay construction" case added in #136507: the shipped command times out before the fake CLI writes its pid on loaded runners, and its early pid wait races the version probe. The open CI PR #137220 removes the same case with the full rationale; carry the identical deletion here so this PR can land on a green exact-head run. Supervisor construction deadlines keep their owner-level regressions in src/process.
…enclaw#136507) ## What Problem This Solves Supervisor overall and no-output deadlines started only after `createChildAdapter` returned. Secret delivery and the service-relay ready handshake have no inner deadline. A stalled constructor could hold the process lane forever. ## Fix - Arm both existing deadlines before adapter construction. - Race construction against one cancellation signal so timeout and shutdown settle the run. - Keep real adapter construction errors visible when they win the race. - Abort blocked secret delivery and kill the service relay that already spawned its command. - Keep late adapter cleanup on the supervisor path without adding a second lifecycle. - Preserve the current-main referenced-child lifecycle and admission checks. ## Evidence - Current main `243d2beeb07ae717af48f0e6d10b20773af98d40` failed the real construction probe: a service-managed `/bin/sh` child that never reads an 8 MiB secret remained alive at 800 ms and `spawn()` was still pending after 851 ms with `timeoutMs: 200`. - Repaired head `fcc014bf2b18faaf367b93268244ff2b04902844` adds exact owner-boundary regressions with a real service relay, real child PID, and real secret descriptor. They assert timeout status and child cleanup. - Follow-up head `adf2ab24282fca4e33a6d73b1901ca863c75a4c4` also races initial relay start delivery with construction abort and observes late delivery errors. - Final head `a5b76e21ac4288c83ee5f6380d8dd71a03de927c` preserves the shipped `agent exec` regression and the real service-managed adapter regression. - Trusted current-main lifecycle validation passed 23 tests before the contributor-head push. - The latest exact-head CI run `33732569201` also exposed an unrelated current-main failure in an untouched auto-reply test shard; the job log shows the existing `update.run` context-shape mismatch and no changed path overlaps this PR. - Final exact-head CI run `33736987360` has one inherited current-main failure: `checks-node-compact-small-6` job `100591095538` timed out in the shipped `agent exec` test; the same test reproduced against the parent source with the follow-up relay fix removed. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Supervisor overall and no-output deadlines started only after
createChildAdapterreturned. Secret delivery and the service-relay ready handshake have no inner deadline. A stalled constructor could hold the process lane forever.Fix
Evidence
6190b505d59156ba234784300492b3bb4cefbe68failed the real construction probe: a service-managed/bin/shchild that never reads an 8 MiB secret remained alive at 800 ms andspawn()was still pending after 851 ms withtimeoutMs: 200.fcc014bf2b18faaf367b93268244ff2b04902844adds exact owner-boundary regressions with a real service relay, real child PID, and real secret descriptor. They assert timeout status and child cleanup.adf2ab24282fca4e33a6d73b1901ca863c75a4c4also races initial relay start delivery with construction abort and observes late delivery errors.a5b76e21ac4288c83ee5f6380d8dd71a03de927cpreserves the shippedagent execregression and the real service-managed adapter regression.33732569201also exposed an unrelated current-main failure in an untouched auto-reply test shard; the job log shows the existingupdate.runcontext-shape mismatch and no changed path overlaps this PR.33736987360has one inherited current-main failure:checks-node-compact-small-6job100591095538timed out in the shippedagent exectest; the same test reproduced against the parent source with the follow-up relay fix removed.