Repository navigation
fix(test): wait for complete CLI output before returning - #136286
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: blocked before merge. Reviewed September 2, 2026, 5:36 PM ET / 21:36 UTC. ClawSweeper reviewWhat this changesThe PR makes the test-instance command helper own command completion and inherited output draining through cleanup, adds native Windows coverage, and routes the affected tests to Windows CI. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 2 items remain Keep open: the managed command lifecycle repair is not on current main and no introduced defect was found, but exact-head native Windows and built-CLI lifecycle validation remain required before merge. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s test-instance helper launches CLI and Gateway processes for lifecycle tests, then owns their output capture, deadlines, and cleanup. Its results feed built-CLI and platform CI proofs that verify process teardown without deleting state prematurely. flowchart LR
A[Lifecycle test] --> B[Test-instance helper]
B --> C[Managed CLI process]
C --> D[Output pipes]
C --> E[Cleanup coordinator]
D --> E
E --> F[Windows process cleanup]
E --> G[State removal or diagnostics]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +581, Config 0, Other +6. Total +587 across 7 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge after exact-head native Windows and built-CLI lifecycle runs confirm inherited output drains and verified cleanup retain or remove state as intended. Do we have a high-confidence way to reproduce the issue? Yes, from source: the prior helper path did not keep pending CLI work under cleanup ownership, and the added tests model leader exit while inherited output remains open; this read-only review did not execute the failing path. Is this the best way to solve the issue? Yes: reuse of the existing managed-process owner centralizes command completion, output draining, process cleanup, and deadline handling rather than adding a parallel helper lifecycle path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f16c9cc3a606. 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
HistoryReview history (14 earlier review cycles; latest 8 shown)
|
Keep finite command results separate from bounded Gateway diagnostics. The Linux artifact proof emitted valid plugin JSON above256KiB; reusing the log tail corrupted that successful result. Preserve bounded timeout diagnostics and report actual inventory-command failures. Real UTF-8 child regression fails before the change;56 helper and sibling tests, scoped checks, and independent P0 review pass. CLI exit/close lifetime work remains separately owned by #136286. CI follow-through for #136036.
c6b2db2 to
ae048cd
Compare
|
@clawsweeper re-review Head be3c729 preserves structured CLI stdout within a separate 1 MiB bound after the current built inventory exceeded the diagnostic tail. The PR body includes the reproduced failure, exact artifact before/after results, finite-overflow regression, and the prior native Windows managed-owner proof. Fresh final-head CI is still required before landing. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
be3c729 to
e8bc345
Compare
|
The reviewed stdout revision now passes native Windows: 34 owner cases passed with five platform-specific skips, including large structured output and the retained-writer/rescue scenario. The Linux built-CLI SQLite lifecycle also passed. Both job links and tested-source parity are in the PR body. CI exposed an additional corner-shape assertion mismatch. The final commit compares the standard computed value, normalizing only @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
6c89a1a to
bab0e0c
Compare
|
Rebased head Range-diff maps all commits one-for-one. Six are patch-identical; the only adapted hunk carries the existing bounded stdout/stderr failure diagnostics onto main's newer Post-rebase focused verification passed through the native review wrapper:
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Keep finite command results separate from bounded Gateway diagnostics. The Linux artifact proof emitted valid plugin JSON above256KiB; reusing the log tail corrupted that successful result. Preserve bounded timeout diagnostics and report actual inventory-command failures. Real UTF-8 child regression fails before the change;56 helper and sibling tests, scoped checks, and independent P0 review pass. CLI exit/close lifetime work remains separately owned by #136286. CI follow-through for #136036.
Reuse the reviewed Gateway process-fixture cleanup from 667ce2b (PR #136469) to remove repeated configuration setup without changing assertions, timeouts, child invocations, or values. Align the equivalent corner-shape normalization with 6c89a1a (PR #136286) so the shared CI repairs integrate without conflicting spellings. No production behavior changes.
fc52f8e to
2d9dec2
Compare
|
@clawsweeper re-review Integrated the new main CLI output/environment changes with the managed lifecycle owner after a verified merge conflict. The new main held-writer probe fails before the repair and passes after; the integrated 40-case local suite and typed lint pass. Please review head 2d9dec22415bd01ac3d94f35fc9754bfb241b812. Fresh native Windows and built-artifact CI remain required before landing. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
2d9dec2 to
8c06d38
Compare
|
@clawsweeper re-review Please review head 3794eb1. Main conflict integration preserves forced Windows terminal cleanup and removes the duplicate SQLite diagnostic edit. Native Windows then proved the inherited drain fixture lost child output. Its repair now shares the existing gated writer and PID cleanup, releasing output after observed leader exit, with all 42 cases and their output/deadline assertions retained. Full local helper tests, typed lint, independent source review and scoped Codex P0 review pass. Fresh CI 33685294460, native Windows after-proof and the complete built-CLI lifecycle remain required before landing. The separately reproduced asset-cache pruning defect is documented as a named follow-up in the body. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Keep finite command results separate from bounded Gateway diagnostics. The Linux artifact proof emitted valid plugin JSON above256KiB; reusing the log tail corrupted that successful result. Preserve bounded timeout diagnostics and report actual inventory-command failures. Real UTF-8 child regression fails before the change;56 helper and sibling tests, scoped checks, and independent P0 review pass. CLI exit/close lifetime work remains separately owned by #136286. CI follow-through for #136036.
|
Merged via squash.
|
Keep finite command results separate from bounded Gateway diagnostics. The Linux artifact proof emitted valid plugin JSON above256KiB; reusing the log tail corrupted that successful result. Preserve bounded timeout diagnostics and report actual inventory-command failures. Real UTF-8 child regression fails before the change;56 helper and sibling tests, scoped checks, and independent P0 review pass. CLI exit/close lifetime work remains separately owned by #136286. CI follow-through for #136036.
Keep finite command results separate from bounded Gateway diagnostics. The Linux artifact proof emitted valid plugin JSON above256KiB; reusing the log tail corrupted that successful result. Preserve bounded timeout diagnostics and report actual inventory-command failures. Real UTF-8 child regression fails before the change;56 helper and sibling tests, scoped checks, and independent P0 review pass. CLI exit/close lifetime work remains separately owned by #136286. CI follow-through for #136036.
* fix(gateway): honor Full Access for delegated OpenClaw changes Use the requesting run’s effective permission policy to authorize exact delegated proposals without an extra operator card. Preserve restricted approvals and late run/worker guards, and discard canceled proposals before a later turn can execute them. Fixes #136032. Covers default and explicit Full Access with actual isolated Gateway config persistence, proposal-route regressions, and cancellation ordering. * test(qa): include delegation proof in E2E ownership inventory * fix(setup): retain scoped runtime artifacts during verification Preserve the requesting registry’s built/source selection when loading fresh inference-owner metadata. Otherwise a healthy built Gateway probe is revalidated against source TypeScript and rejected as plugin artifact drift. Discovered and reproduced with live Codex while validating #136036. Keep exact artifact/auth guards and standalone source defaults unchanged; cover both contextual selection modes. * docs(gateway): align delegated change approval guidance * fix(gateway): bind delegated proposals to their requesting run Reconcile foreign and terminal proposals before routing new input, preserve exact live approval ownership, and clear executable state even if approval cancellation fails. A concurrent Full Access read must never apply another run's pending write. Keep model-facing summaries policy-neutral. Covers live and closed run boundaries, storage failure, worker claim reuse, and rendered prompts for #136032. * test(gateway): admit delegated session ownership fixture Use a real live run claim for the cross-connection delegation assertion, release it in finally, and verify the retained caller cannot invoke the engine after closure. Keep the production authority guard intact. * fix(gateway): join metadata work before shutdown Give every Gateway lifetime a metadata stop owner, including lazy minimal-Gateway preparation. Close new work through the existing generation fences and join pending readers, refreshes, commands and projections before model/config teardown. The minimal and ordinary lifecycle regressions fail before this repair; 68 focused tests, full changed checks and fresh P0 autoreview pass. Found during real-Gateway validation for #136036. The broader pre-entry RPC shutdown gap remains separate; no timeout, logger, schema or dependency policy is weakened. * test(ui): isolate pairing help navigation from live docs Own the popup document through an exact BrowserContext route before clicking. Preserve the real popup, secure target/rel, focus and credential-lifecycle assertions; check the full anchored destination and controlled response. CI33632492208 stalled waiting for the external page load after opening pairing help. The live canonical URL is valid. Four focused browser tests, scoped checks and fresh P0 review pass; production behavior and timeouts are unchanged. * fix(gateway): retire failed delegated proposals before reuse Retire exact session approval ownership, its record and the engine proposal through one cleanup owner. Cover failures before resolver entry and registration as well as application, retaining delayed cleanup inside the serialized task so it cannot cancel a later same-hash proposal. Real handler/run regressions fail before the repair: a closed run's unregistered proposal was executed by the next Full Access read, and a real database-open failure retained a partial approval owner. The fix passes 174 focused/sibling tests, scoped checks and fresh P0 review. Follow-through for #136036; no configuration, schema or protocol change. * test: preserve complete CLI output before parsing Keep finite command results separate from bounded Gateway diagnostics. The Linux artifact proof emitted valid plugin JSON above256KiB; reusing the log tail corrupted that successful result. Preserve bounded timeout diagnostics and report actual inventory-command failures. Real UTF-8 child regression fails before the change;56 helper and sibling tests, scoped checks, and independent P0 review pass. CLI exit/close lifetime work remains separately owned by #136286. CI follow-through for #136036. * test: separate refusal ordering from deadline policy Keep native startup, inherited stderr, retry state, and cleanup real while controlling policy time in the positive refusal table. A 1250ms fixture delay reproduced SIGTERM instead of status 1 under the unchanged 1000ms budget; the repaired table passes with the same delay. Dedicated readiness and drain expiry cases still enforce their deadlines.
…6286) * fix(test): retain managed CLI ownership through output closure * test: gate inherited CLI output until its leader exits
…law#136036) * fix(gateway): honor Full Access for delegated OpenClaw changes Use the requesting run’s effective permission policy to authorize exact delegated proposals without an extra operator card. Preserve restricted approvals and late run/worker guards, and discard canceled proposals before a later turn can execute them. Fixes openclaw#136032. Covers default and explicit Full Access with actual isolated Gateway config persistence, proposal-route regressions, and cancellation ordering. * test(qa): include delegation proof in E2E ownership inventory * fix(setup): retain scoped runtime artifacts during verification Preserve the requesting registry’s built/source selection when loading fresh inference-owner metadata. Otherwise a healthy built Gateway probe is revalidated against source TypeScript and rejected as plugin artifact drift. Discovered and reproduced with live Codex while validating openclaw#136036. Keep exact artifact/auth guards and standalone source defaults unchanged; cover both contextual selection modes. * docs(gateway): align delegated change approval guidance * fix(gateway): bind delegated proposals to their requesting run Reconcile foreign and terminal proposals before routing new input, preserve exact live approval ownership, and clear executable state even if approval cancellation fails. A concurrent Full Access read must never apply another run's pending write. Keep model-facing summaries policy-neutral. Covers live and closed run boundaries, storage failure, worker claim reuse, and rendered prompts for openclaw#136032. * test(gateway): admit delegated session ownership fixture Use a real live run claim for the cross-connection delegation assertion, release it in finally, and verify the retained caller cannot invoke the engine after closure. Keep the production authority guard intact. * fix(gateway): join metadata work before shutdown Give every Gateway lifetime a metadata stop owner, including lazy minimal-Gateway preparation. Close new work through the existing generation fences and join pending readers, refreshes, commands and projections before model/config teardown. The minimal and ordinary lifecycle regressions fail before this repair; 68 focused tests, full changed checks and fresh P0 autoreview pass. Found during real-Gateway validation for openclaw#136036. The broader pre-entry RPC shutdown gap remains separate; no timeout, logger, schema or dependency policy is weakened. * test(ui): isolate pairing help navigation from live docs Own the popup document through an exact BrowserContext route before clicking. Preserve the real popup, secure target/rel, focus and credential-lifecycle assertions; check the full anchored destination and controlled response. CI33632492208 stalled waiting for the external page load after opening pairing help. The live canonical URL is valid. Four focused browser tests, scoped checks and fresh P0 review pass; production behavior and timeouts are unchanged. * fix(gateway): retire failed delegated proposals before reuse Retire exact session approval ownership, its record and the engine proposal through one cleanup owner. Cover failures before resolver entry and registration as well as application, retaining delayed cleanup inside the serialized task so it cannot cancel a later same-hash proposal. Real handler/run regressions fail before the repair: a closed run's unregistered proposal was executed by the next Full Access read, and a real database-open failure retained a partial approval owner. The fix passes 174 focused/sibling tests, scoped checks and fresh P0 review. Follow-through for openclaw#136036; no configuration, schema or protocol change. * test: preserve complete CLI output before parsing Keep finite command results separate from bounded Gateway diagnostics. The Linux artifact proof emitted valid plugin JSON above256KiB; reusing the log tail corrupted that successful result. Preserve bounded timeout diagnostics and report actual inventory-command failures. Real UTF-8 child regression fails before the change;56 helper and sibling tests, scoped checks, and independent P0 review pass. CLI exit/close lifetime work remains separately owned by openclaw#136286. CI follow-through for openclaw#136036. * test: separate refusal ordering from deadline policy Keep native startup, inherited stderr, retry state, and cleanup real while controlling policy time in the positive refusal table. A 1250ms fixture delay reproduced SIGTERM instead of status 1 under the unchanged 1000ms budget; the repaired table passes with the same delay. Dedicated readiness and drain expiry cases still enforce their deadlines.
The CLI test fixture could report completion while a descendant still held inherited output. Its executor intentionally releases pipes after a bounded post-exit drain, but fixture cleanup must retain uncertain resources. Reuse the existing managed-process owner for completion, timeout and cancellation. Admit each complete CLI operation before entrypoint preparation yields, drain admitted commands before Gateway shutdown, retain unjoined-work errors and failed cleanup, and reject new work after ownership becomes uncertain.
Preserve main's structured-output and environment contracts: shared capture utilities retain stdout from the beginning up to the existing 16 MiB limit and reject overflow; stderr and Gateway diagnostics remain bounded to 256 KiB. Pass the complete isolated environment directly. Preserve the managed error cause and timeout diagnostic precedence. Log capacity belongs to its constructor, including truthful truncation markers and exact-cap writes. Terminal cleanup retains main's forced Windows Gateway-tree termination. Main independently landed the SQLite proof diagnostics in #136478, so the duplicate edit is removed from this PR.
Native Windows exposed a separate defect in the newly inherited delayed-output test. In CI 33683282504, Windows job 100424910751, its non-detached child was terminated when the leader exited: the drain case returned only the leader's output. The other 36 owner cases passed and five platform-specific cases skipped. The repair shares one inherited-writer producer between stdout and stderr cases, uses Windows-only detached spawning, retains the writer PID, and releases the existing HTTP gate only after observing leader death. Cleanup releases gates, joins commands, then joins writers before deleting state. The fixed 50 ms sleep is removed; all 42 case identities, complete-output checks and the zero-retained-timer oracle remain.
The original ownership defect also has failing native and real-process evidence. The native retained-writer baseline established an exited leader, live detached writer and open inherited stderr before the missing retained claim failed; external rescue joined the writer and verified closure/state removal. On exact main fc895e4, all 37 ordinary helper cases passed, but a private held-writer probe showed premature command completion. The managed owner passed that same observation and captured the complete output after release. Those resources were joined and temporary roots removed.
Current head is 3794eb1, based on main 3f3ab5c. The final local helper suite passes 41 cases with one native-Windows skip out of 42; its source guards remain unchanged and temporary root is empty and removed. Typed lint passes. Independent source review found no actionable findings; a fresh committed-head Codex P0 review is scoped-clean, explicitly limited to P0. Final scope: seven test/support/tooling/metadata files, +672/-85; production +0/-0. No speedup is claimed for this lifecycle repair.
The current revision has passed both platform checks requested by the latest ClawSweeper review and its Rank-up moves. Native Windows job 100431504957 passes 37 cases with five unchanged platform skips out of 42 on Node 22.23.2/pnpm 12.1.0. All case names and order match the failed before-run; the only status change is the drain case from failed to passed. Complete/overflow JSON, delayed stderr and the native retained-writer/verified-rescue case also pass. Linux built-artifact job 100431504703 passes the complete built-CLI SQLite lifecycle on Node 24.19.0/pnpm 12.1.0. Both actual logs identify tested merge d9c81551b5b16a600bb8f0be0ddb4b2d52b5ab38; all 42 inspected source/runner guards are byte-identical to the published head. CI 33685294460 attempt 1 completed successfully on this exact head at 21:49:03 UTC. Earlier green runs are historical evidence.
Ordinary stream closure does not certify detached descendants that have closed their pipes. Direct entrypoint preparation retains its existing shared API outside CLI admission. Canonical timeout cleanup can outlast the formerly ignored 1.5-second close wait.
Follow-up: concurrent Control UI asset pruning can remove both older generations. Linux job 100424918574 observed two retained generations where three were expected. A single controlled real-filesystem probe on unchanged code reproduced that result: recursive deletion removed a victim's manifest, changing directory mtime while preserving its inode; another inventory reused stale verification by inode, promoted the partially removed directory and evicted the intact old survivor. Both new assets remained readable. This establishes a matching real defect; the CI job did not retain the operation trace needed to certify its exact interleaving. The follow-up belongs to the verified-record reuse and refresh metadata in src/gateway/control-ui-asset-retention.ts. Its repair must preserve the existing bounded-read contract; a bare mtime guard would rehash assets because publication currently returns metadata from before its own timestamp refresh. Full proof and cleanup receipts are retained for that follow-up; the retention oracle is unchanged.
Two earlier intermittent failures also remain named follow-ups: browser control-server startup lacked its actual startup/listener evidence, and a plugin-security RSS check lacked its process-snapshot result. Their causes remain unresolved. An unchanged 42-case macOS browser run passed in the original order, which does not explain the earlier Linux refusal. No retry, timeout or assertion was weakened.