Repository navigation
fix: declaration steps succeed with lingering subprocesses - #132070
Conversation
Fixes #132053. Verify POSIX process completion at each declaration owner before accepting success. Preserve Windows behavior without changing timeouts or shared defaults.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 4:09 PM ET / 20:09 UTC. ClawSweeper reviewWhat this changesThe PR makes declaration preparation and the TypeScript compiler wrapper reject POSIX commands whose managed process group remains alive after the leader exits successfully. Merge readinessNo introduced correctness or security defect was found. Keep this maintainer-authored, maintainer-labeled PR open for explicit acceptance of its intentional stricter POSIX completion contract and completion of exact-head CI. Priority: P2 Review scores
Verification
How this fits togetherDeclaration preparation launches subprocesses to build plugin boundary artifacts, including TypeScript compiler work. Its successful completion releases artifact stamps, downstream readers, and locks, so it must reflect whether owned work has finished. flowchart LR
A[Declaration preparation] --> B[Managed child launcher]
B --> C[POSIX process-group check]
C -->|group exited| D[Artifact stamps and readers]
C -->|children remain| E[Terminate managed group]
E --> F[Report completion failure]
Decision needed
Why: This is an upgrade-sensitive, fail-closed behavior change for existing developer tooling, even though the implementation is narrow and the linked issue documents the intended invariant. Before merge
Agent review detailsSecurityNone. PR surfaceTests +89, Docs +7, Other +4. Total +100 across 5 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the existing shared default and apply strict verification only at these two artifact-producing owners once maintainers accept the POSIX success-to-failure behavior and exact-head checks finish. Do we have a high-confidence way to reproduce the issue? Yes. The checked-in regressions encode a real Node leader-and-descendant scenario at both affected owners; the supplied PR evidence also records before/after process observations, though this read-only review did not execute them. Is this the best way to solve the issue? Yes. Reusing the existing strict verifier at the two process-group owners is narrower than changing the shared default, and the Windows guard preserves the existing unsupported-platform behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against bb51e903325f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Maintainer decision: accept the stricter POSIX artifact-completion contract. A declaration/typecheck leader exiting zero while its own managed group remains active must fail after cleanup, rather than release artifact stamps, dependent readers, or the writer lock. Applying the existing verifier at both the preparation and nested compiler owners is intentional; Windows behavior and the shared default remain unchanged. This addresses the acceptance/compatibility decision and sole rank-up move in the current ClawSweeper review, which found no introduced correctness or security defects. No code changed after that review, and no re-review is needed. Exact-head CI is green: run 33205915259 completed successfully on Local proof on the candidate:
Exact local test command: node scripts/run-vitest.mjs test/scripts/managed-child-process.test.ts test/scripts/run-tsgo.test.ts test/scripts/prepare-extension-package-boundary-artifacts.test.ts -t 'rejects and drains.*successful leader exit|runs the installed compiler version|allows bounded retry output|allows strict normal long-running|accepts a process group that vanishes|refuses strict Windows commands|leaves a completing tsgo alone|clamps oversized prep step timers|runs boundary prep steps serially|passes step-specific environment overrides|keeps the watchdog opt-in'Exact local changed gate: node scripts/check-changed.mjs -- docs/reference/test.md scripts/prepare-extension-package-boundary-artifacts.mts scripts/run-tsgo.mts test/scripts/managed-child-process.test.ts test/scripts/run-tsgo.test.tsKnown limits remain explicit: no native Windows or full local SDK declaration build claim; the independently investigated nested-timeout race was not altered or declared resolved. This verifier covers owned POSIX groups, not arbitrary descendants that deliberately escape them. Native review artifacts validate on the exact head; proceeding through the required |
|
Merged through the repo-native prepare/merge workflow.
Landing anomaly recorded for follow-up: the native workflow reported HTTP 502 on the first merge request, after the patch reached main. A subsequent read reported the PR open; native lock recovery and retry finalized the PR with the empty second commit. Direct Git inspection confirms the first commit contains the five-file change and the final commit has no tree delta. All five landed files are byte-identical to the reviewed head. Main history was left intact; no code rewrite, rebase, test rerun, or gate bypass was used. |
…132070) Fixes openclaw#132053. Verify POSIX process completion at each declaration owner before accepting success. Preserve Windows behavior without changing timeouts or shared defaults.
…132070) Fixes openclaw#132053. Verify POSIX process completion at each declaration owner before accepting success. Preserve Windows behavior without changing timeouts or shared defaults.
…132070) Fixes openclaw#132053. Verify POSIX process completion at each declaration owner before accepting success. Preserve Windows behavior without changing timeouts or shared defaults.
Closes #132053.
Related: the earlier SDK timeout cleanup repair.
What Problem This Solves
Resolves a problem where declaration preparation could report success after a zero-exit leader left owned subprocesses running with ignored stdio. Preparation uses success as an artifact barrier before freshness stamps, dependent readers, and writer-lock release, so accepting unfinished work is the wrong ownership contract.
This is a confirmed process fixture, not a recurrence of the original compiler timeout leak or evidence of real declaration corruption. The installed native-preview launcher execves or synchronously joins the compiler. Zero-exit acceptance without group verification predates the timeout repair and is present in the inspected
v2026.7.1preparation code.Why This Change Was Made
Both preparation and
run-tsgonow opt into the existing strict POSIX completion verifier. They own different process groups: a controlled prep-only patch passed the prep regression but still failed the real compiler-wrapper regression. Reusing the verifier at both owners is the narrow fix; changing the shared default would affect unrelated commands and unconditionally enabling it would reject Windows before spawn.The verifier drains leftover same-group processes and rejects with
EPROCESSGROUP_CLEANUP_FAILED, rather than converting forced cleanup into success. Windows keeps its existing joined-launcher behavior. This is group verification, not recursive containment of arbitrary detached descendants.The existing lingering-child test is reused for prep, its failure cleanup now recovers the recorded PID even when an assertion fails, and strict clean-completion coverage is correctly POSIX-only. A portable real compiler-version case protects normal wrapper execution. The completion contract and platform limits are documented in the testing reference.
Production/tooling: +4/-0 (net +4), consisting of two executable opt-ins and two ownership comments. Tests: +117/-28 (net +89). Docs: +7/-0. No new lifecycle implementation, removed runtime path, global default, configuration, dependency, timeout, grace, or resource-policy change. AI-assisted implementation and independent review.
User Impact
On POSIX, declaration/typecheck commands cannot report clean completion while their own managed group remains active. Normal compiler completion continues to work. There is no gateway runtime or channel behavior change, and no new operator setting.
The separate declaration resource-policy work, nested-timeout race investigation, and WhatsApp patch are not included or declared resolved here.
Evidence
Failing before the fix: new real-child caller regressions produced 2 failures / 2 passes with unchanged production on Node 26.7.0. Prep resolved with a descendant alive; the real
run-tsgo.mjswrapper returned zero with its compiler descendant alive. Exact fixture PIDs were recovered and cleaned after observation. With only the prep opt-in, the compiler regression still failed (1 failure / 3 passes). With both opt-ins, all four selected cases passed.Fixed candidate: 15 focused tests across 3 files passed independently on both Node 24.20.0 and Node 26.7.0/macOS 27, covering both callers, strict helper cleanup, clean completion, disappearing-group handling, Windows pre-spawn refusal, serial preparation, timer saturation, and unchanged watchdog opt-in:
node scripts/run-vitest.mjs test/scripts/managed-child-process.test.ts test/scripts/run-tsgo.test.ts test/scripts/prepare-extension-package-boundary-artifacts.test.ts -t 'rejects and drains.*successful leader exit|runs the installed compiler version|allows bounded retry output|allows strict normal long-running|accepts a process group that vanishes|refuses strict Windows commands|leaves a completing tsgo alone|clamps oversized prep step timers|runs boundary prep steps serially|passes step-specific environment overrides|keeps the watchdog opt-in'Standalone real-process proof on Node 24: the original fixture was copied unchanged into an isolated directory. Hardened prep rejected, reported the owned group terminated, and had zero survivors at return; its independent control stayed alive. The generic default runner still returned zero with two survivors, proving that the shared default was not changed. All exact fixture PIDs were removed afterward; that manual cleanup is not counted as baseline production cleanup.
Real compiler proof: a small declaration compile through
runNodeStep -> run-tsgo.mjs -> run-tsgo.mts -> installed native-previewcompleted with the expected declaration bytes and nonempty build-info file present at return. No profiler or policy override was used. The installed launcher and exact Node child-process exit/close implementation were inspected directly.Scoped gates passed, including both script and root-test typechecks through the now-strict real compiler owner, script lint, formatting, erasability, and repository guards:
Fresh isolated Codex autoreview returned scoped-clean with no accepted/actionable P0 findings.
git diff --checkpassed.Limits: native Windows execution and a full local SDK declaration build were not run. Windows's existing non-strict branch is preserved and its strict-refusal unit contract passed; the new real-version test is portable, not claimed as native Windows proof here. The seven nested-timeout matrix rows were deliberately excluded from the focused local run to avoid conflating the independently active race investigation with this completion-only repair. Hosted exact-head CI remains the required landing gate; no checks will be bypassed.