Skip to content

fix(qa): retain bootstrap diagnostics after timeouts - #136111

Merged
steipete merged 1 commit into
mainfrom
steipete/dreamy-easley-734eab
Sep 2, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/dreamy-easley-734eab

Conversation

@steipete

@steipete steipete commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Closes #136102 — QA bootstrap drops captured diagnostics on timeout and earlier failures.

What Problem This Solves

Fixes an issue where QA operators would lose useful child stdout/stderr when bootstrap or a post-start CLI command timed out, was cancelled, or failed through a process/stream error. Installed-package plugin setup also reported the same failure prefix for update repair --help and the actual repair, hiding which phase failed.

Why This Change Was Made

Finalize the diagnostic in the existing CLI command owner after process-tree settlement and bounded pipe draining, preserving the first failure reason and appending captured stderr then stdout through the canonical redactor. Let the existing private bootstrap wrapper return its operation result so help and repair can have separate fixed phase labels; no raw argv/environment logging or parallel logging path is added.

Lifecycle ownership, admission/cancellation, cleanup aggregation, successful stdout, capability-consent negotiation, the 120000ms execution deadline, and the 1000ms drain deadline are unchanged. The existing 2048-character redacted error bound, stdout 1MiB cap, and stderr 64KiB tail are unchanged. No configuration, dependency, schema, protocol, or test-only production seam is added.

This repairs diagnostic loss only. The original isolated UI setup's timed-out invocation is unknown; nonempty output in that attempt was not established. Neither the underlying bootstrap timeout nor the pending-notice UI bug is claimed fixed. Separate scenario-command diagnostic gaps use different result/settlement owners and were recorded as follow-up work rather than bundled here.

User Impact

QA failures retain meaningful sanitized diagnostics, including output emitted during shutdown, while preserving the earliest failure reason and normal cleanup. Packaged setup errors identify the repair-help probe or actual repair. QA overview documentation describes the diagnostic behavior.

Production LOC: +27/-23 (net +4). Tests: +74/-15 (net +59). Docs: +4/-1. The small production increase buys final output retention and phase-specific attribution by reusing the existing owners; no alternative runtime flow was introduced.

Evidence

Failing before, passing after

The extended existing real-child fixture writes meaningful synthetic diagnostics to both pipes and hangs. The parent observes both streams before injecting failures. Timeout uses the existing fake-timer control; child spawning, output, descendant liveness, termination, and cleanup remain real.

node scripts/run-vitest.mjs extensions/qa-lab/src/gateway-child-bootstrap.test.ts

Pre-fix: 6 expected diagnostic failures, 8 passes. Post-fix: 14 passes. Coverage includes timeout, cancellation, stdout, stderr, stdin, process errors, first-failure precedence, shutdown-emitted output, redaction, workflow-command neutralization, the 2048-character bound, and removal of raw argv/env/stdin/cause/error-graph data.

Before:
Expected: plugin registry still pending apiKey=<redacted>
Received: qa gateway CLI exceeded 120000ms

After:
qa gateway CLI exceeded 120000ms: plugin registry still pending apiKey=<redacted>
[bounded synthetic output]
plugin scan still pending Authorization: Bearer <redacted>
shutdown stdout diagnostic apiKey=<redacted>
node scripts/run-vitest.mjs extensions/qa-lab/src/gateway-child.test.ts --testNamePattern 'blocks packaged gateway spawn with bounded redacted diagnostics'

Pre-fix: 2 expected phase-label failures, 2 passes. Post-fix: 4 passes. Help and repair are now independently attributed; auth phase labeling and canonical-config behavior are unchanged.

Owner and sibling coverage

node scripts/run-vitest.mjs extensions/qa-lab/src/gateway-child-bootstrap.test.ts extensions/qa-lab/src/gateway-child.test.ts extensions/qa-lab/src/gateway-child-lifecycle.test.ts extensions/qa-lab/src/gateway-log-redaction.test.ts extensions/qa-lab/src/child-output.test.ts

138 passed, 1 skipped on macOS/Node 24.20.0. The skipped case is Linux-only. Existing coverage includes overlapping post-start commands, successful leader exits with descendants, cleanup failures/retries, artifacts, legacy capability-help behavior, output byte bounds, and redaction.

Real-clock timeout proof

A separate source-owner probe launched an isolated synthetic Node child, emitted stdout/stderr, and waited for the unchanged real deadline without fake timers or a timeout override. It completed at 120052ms with a 2048-character error containing both sanitized diagnostic markers, no raw secrets/argv/environment data, and confirmed-stopped cleanup. Its isolated temporary directory was removed.

qa gateway CLI exceeded 120000ms: synthetic registry diagnostic apiKey=<redacted>
[bounded synthetic padding; output omitted marker]
synthetic scan diagnostic Authorization: Bearer <redacted>

This is real child-process boundary proof, not proof of successful packaged installation, a live-provider run, or the original UI bootstrap. No UI rendering changed, so there is no before/after UI capture.

Static checks and review

node scripts/check-changed.mjs --base HEAD -- extensions/qa-lab/src/gateway-child-command.ts extensions/qa-lab/src/gateway-child-setup.ts extensions/qa-lab/src/gateway-child-bootstrap.test.ts extensions/qa-lab/src/gateway-child.test.ts docs/concepts/qa-e2e-automation.md

Passed: production/test type checks, targeted lint/format, doctor contract tests (5 passed), plugin boundaries, dead exports, import cycles, and selected guards. The first check attempt found missing browser parser types already declared by refreshed main; pnpm install refreshed the stale install, and unchanged checks then passed. No manifest/lockfile edits.

Independent Codex autoreview: scoped-clean at the default P0 threshold. The lead separately inspected the full command/setup/lifecycle/capture/redaction owners, callers, tests, docs, current main, raw historical patches, and Node's exit/close contract. git diff --check passed. Full-suite, package, provider, and cross-platform campaigns were not run for this diagnostic-only owner change; hosted exact-head CI is the remaining landing gate.

Maintainer review follow-through

The current ClawSweeper review found no correctness or security findings and judged this the owner-level fix. Its remaining items are addressed as follows:

  • Production net +4: accepted. The four lines provide final diagnostic retention and distinguish help/repair while replacing the old nonzero-only branch. Reducing the count by inlining the reason or duplicating the formatter would make the boundary less clear; no new abstraction, runtime path, or configurable policy was added.
  • Stored-data classification: not applicable. The gateway-child-setup.ts change returns a private helper's existing operation result and splits fixed error labels. Auth configuration, capability detection, repair arguments, persistence operations, representations, and migrations are unchanged. No schema/store change or new upgrade step exists to migrate. Existing auth/config, legacy-help, retry, and lifecycle tests passed.

The refreshed 08:05 UTC review adds a Rank-up move: refresh onto current main and obtain green exact-head CI. The mechanical refresh below incorporates the canonical fixture fix; the new exact-head CI result remains mandatory before merge. No additional diagnostic source change is requested by the review.

CI correction

Initial exact-head CI 33603899100 failed in checks-node-compact-small-49: the unrelated write-plugin-sdk-entry-dts.test.ts cache-relocation fixture expected a historical root chunk that it had not seeded. The actual tested merge used main parent 331d8a2265ff07d5db51e459c32d38c10fc7dc24.

Main subsequently fixed that premise in 5e6117d17d92 — scoped external channels and CI fixture repair. The fixture now pre-seeds only unowned historical chunks from the current snapshot, while cache-owned outputs must still be restored and the complete tree must remain byte-identical. The diagnostic patch was mechanically rebased onto 4fc24e6e0f81121cef0fb4395db29fb87700e7f6, which contains that fix. Range-diff and patch hashing confirm the same five-file patch, byte-for-byte. No duplicate fixture patch, assertion weakening, timeout increase, or CI bypass was added. Prepare/merge were not invoked on the failed head.

Rebased head: 020d3683c1828ff2d56a3b1d658817008f550aa7. The focused bootstrap suite passed 14/14 again on Node 24.20.0, and fresh branch autoreview was scoped-clean at P0. The previous complete changed checks and 138-test owner/sibling proof apply to the identical repair; fresh hosted exact-head CI remains required before merge.

A supplemental local SDK sweep on Node 26.8.1 reported three passing cases but was explicitly interrupted by the maintainer after approximately 19 minutes; it has no cache-relocation verdict and is not passing proof. A concurrently started QA retry was also stopped, then replaced by the completed 14-test Node 24.20.0 run above. The canonical upstream fixture was verified by the new exact-head Linux CI run, not by treating the interrupted sweep as success.

Final exact-head validation

CI run 33609123436 completed success for 020d3683c1828ff2d56a3b1d658817008f550aa7; the required openclaw/ci-gate is SUCCESS. The previously failing checks-node-compact-small-49 shard passed with the inherited canonical fixture correction. The native CI watcher completed GREEN, and native review artifacts validate for this exact head.

The latest ClawSweeper review at 08:40 UTC covers this head, reports no correctness/security findings and no before-merge items. The prior refresh-and-green-CI Rank-up move is completed. The stored-data classification remains inapplicable for the unchanged persistence contract, as explained above. All remaining proof limitations are unchanged; this is ready for repository-native prepare/merge, not a claim that the original bootstrap timeout or UI bug is repaired.

@clawsweeper

clawsweeper Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review September 2, 2026 07:30
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: qa-lab size: S maintainer Maintainer-authored PR labels Sep 2, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 Sep 2, 2026
@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 2, 2026, 4:40 AM ET / 08:40 UTC.

ClawSweeper review

What this changes

The PR preserves bounded, redacted QA child-process diagnostics after timeout, cancellation, and stream/process failures, and distinguishes repair-help failures from repair failures.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Keep this PR open. Current main still drops captured diagnostics after early CLI failures; the branch repairs that owner boundary without a blocking correctness or security issue, while exact-head CI is still in progress.

Priority: P2
Reviewed head: 020d3683c1828ff2d56a3b1d658817008f550aa7

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with strong regression coverage; exact-head CI is still running.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored internal QA repair is exempt from the external-contributor proof gate; its body additionally records a real child-process timeout trace, and the changed fixture exercises spawn, pipes, shutdown, and process-tree settlement.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored internal QA repair is exempt from the external-contributor proof gate; its body additionally records a real child-process timeout trace, and the changed fixture exercises spawn, pipes, shutdown, and process-tree settlement.
Evidence reviewed 8 items Current-main defect: Current main captures output and waits for settlement, but only appends that output for a nonzero exit when no earlier failure was latched.
Introduced repair: The PR changes the terminal formatting condition to cover an earlier failure as well as a nonzero exit, preserving the first reason and reusing the existing bounded redactor.
Lifecycle boundary: CLI processes are registered before asynchronous events; the lifecycle owns process settlement and completion, so the patch adds no alternate cleanup or capture path.
Findings None None.
Security None None.

How this fits together

QA Lab starts isolated OpenClaw CLI child processes during bootstrap and packaged setup checks. It captures their output, settles the child lifecycle, and returns bounded redacted diagnostics to QA operators.

flowchart LR
  A[QA bootstrap or setup] --> B[CLI child process]
  B --> C[Captured stdout and stderr]
  C --> D[Lifecycle shutdown and pipe drain]
  D --> E[Redacted bounded error]
  E --> F[QA operator diagnostics]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +4, Tests +59, Docs +3. Total +66 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 2 27 23 +4
Tests 2 74 15 +59
Docs 1 4 1 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 105 39 +66

Review metrics

Metric Value Why it matters
Production and regression delta production +4, tests +59, docs +3 The small production increase extends the existing terminal formatter; most changed lines are focused boundary regression coverage.

Stored data model

Persistent data-model change detected: migration/backfill/repair: extensions/qa-lab/src/gateway-child-setup.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #136102
Summary: This PR is the explicit candidate fix for the linked QA diagnostic-loss issue and remains open until it merges.

Members:

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

Technical review

Best possible solution:

Land this owner-level repair after its exact-head CI is green, retaining the existing redaction, output bounds, lifecycle settlement, and successful-output behavior.

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

Yes, source-reproducible: current main’s early-failure condition bypasses captured-output formatting, and the new real-child fixture targets all affected failure origins. The checkout was read-only, so I did not execute it.

Is this the best way to solve the issue?

Yes. The fix belongs in the existing command owner after its existing settlement and pipe drain, and it reuses the canonical bounded redactor rather than adding a parallel capture path.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: The PR restores QA troubleshooting diagnostics after failures without changing the underlying bootstrap outcome.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored internal QA repair is exempt from the external-contributor proof gate; its body additionally records a real child-process timeout trace, and the changed fixture exercises spawn, pipes, shutdown, and process-tree settlement.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

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

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-02T07:37:47.757Z sha 0e59812 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-02T08:05:08.948Z sha 0e59812 :: needs maintainer review before merge. :: none

Retain bounded, redacted stdout and stderr after QA CLI timeout, cancellation, and process or stream failure settlement. Preserve the first failure reason and distinguish packaged repair-help from repair failures.

Diagnostic-only repair for #136102. Execution deadlines, cleanup, successful output, and capability negotiation remain unchanged; this does not fix the underlying bootstrap timeout or pending-notice UI behavior.
@steipete

steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready maintainer verification for 020d3683c1828ff2d56a3b1d658817008f550aa7.

Exact-head CI 33609123436 completed successfully; the required openclaw/ci-gate is SUCCESS and the repository watcher finished GREEN. The previously failing SDK fixture shard passed after the mechanical refresh onto main's canonical fix 5e6117d17d92. No duplicate fixture repair or weakened assertion was added. The five-file diagnostic patch is byte-identical across the rebase.

The latest ClawSweeper review, reviewed at 08:40 UTC on this head, has no correctness/security findings and no before-merge items. Its earlier refresh/green-CI Rank-up move is complete. Production net +4 is accepted for reusing the final command formatter and distinguishing setup phases. The stored-data classification is inapplicable: no auth/store/schema/migration/argument behavior changed.

Observed proof:

  • Six diagnostic regressions and two phase-label assertions failed before production repair, then passed afterward.
  • Five-file owner/sibling suite: 138 passed, one Linux-only skip on macOS. Rebased bootstrap sanity: 14/14 passed again on Node 24.20.0.
  • Real-clock synthetic child: timeout at 120052ms, both diagnostic markers retained and sanitized in a 2048-character message, confirmed-stopped cleanup, no fake timers or timeout override.
  • Complete selected changed checks passed before the byte-identical rebase. Fresh rebased Codex autoreview is scoped-clean at P0. Native review artifacts validate for this exact head.

Local commands:

node scripts/run-vitest.mjs extensions/qa-lab/src/gateway-child-bootstrap.test.ts
node scripts/run-vitest.mjs extensions/qa-lab/src/gateway-child.test.ts --testNamePattern 'blocks packaged gateway spawn with bounded redacted diagnostics'
node scripts/run-vitest.mjs extensions/qa-lab/src/gateway-child-bootstrap.test.ts extensions/qa-lab/src/gateway-child.test.ts extensions/qa-lab/src/gateway-child-lifecycle.test.ts extensions/qa-lab/src/gateway-log-redaction.test.ts extensions/qa-lab/src/child-output.test.ts
node scripts/check-changed.mjs --base HEAD -- extensions/qa-lab/src/gateway-child-command.ts extensions/qa-lab/src/gateway-child-setup.ts extensions/qa-lab/src/gateway-child-bootstrap.test.ts extensions/qa-lab/src/gateway-child.test.ts docs/concepts/qa-e2e-automation.md

The supplemental local Node 26 SDK sweep was intentionally stopped after approximately 19 minutes and is incomplete, not passing proof; hosted Linux CI supplies that fixture validation. No successful packaged install, live provider, original UI bootstrap, or cross-platform campaign is claimed. The original timed-out invocation and existence of nonempty output in that attempt remain unknown.

This is the owner-level diagnostic fix: first reason plus available stderr/stdout after existing settlement/drain through the canonical redactor. The 120-second deadline, capture bounds, cancellation, cleanup, success output, and setup capability negotiation remain unchanged. It does not claim to fix the underlying bootstrap timeout or pending-notice UI bug. Proceeding through repository-native prepare/merge only.

@steipete
steipete merged commit a359864 into main Sep 2, 2026
219 of 220 checks passed
@steipete
steipete deleted the steipete/dreamy-easley-734eab branch September 2, 2026 08:59
@steipete

steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 3, 2026
Retain bounded, redacted stdout and stderr after QA CLI timeout, cancellation, and process or stream failure settlement. Preserve the first failure reason and distinguish packaged repair-help from repair failures.

Diagnostic-only repair for openclaw#136102. Execution deadlines, cleanup, successful output, and capability negotiation remain unchanged; this does not fix the underlying bootstrap timeout or pending-notice UI behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: qa-lab maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: QA bootstrap drops child diagnostics on timeout and stream failures

1 participant