Repository navigation
fix(test): drain sharing fixtures before removing state - #158205
Conversation
|
Codex review: needs changes before merge. Reviewed September 25, 2026, 12:31 PM ET / 16:31 UTC. ClawSweeper reviewWhat this changesThe branch moves session-sharing tests to a fixture that drains database work before deleting state and adds a real-worker cleanup regression. Merge readiness⛔ Needs changes before merge - 2 items remain Current main still removes sharing-test directories before closing their databases. This PR addresses that fixture lifetime problem, and the source review found no blocking correctness defect. The required test-runtime measurement is missing from the PR body. Priority: P2 Review scores
Verification
How this fits togetherSession-sharing tests write membership data to temporary SQLite databases. Session writes can start maintenance workers, so fixture cleanup must settle those workers and close the databases before removing their state directory. flowchart LR
A[Sharing test writes] --> B[Session database]
B --> C[Maintenance worker]
A --> D[Fixture cleanup]
C --> D
D --> E[Close databases]
E --> F[Remove temporary state]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceTests +65. Total +65 across 1 file. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep the storage-aware fixture as the sharing suite's cleanup owner so maintenance leases and databases settle before temporary state is removed. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main's directory-only fixture removes state before its afterEach database close. The PR reports a real-worker old-fixture failure, but this read-only review did not run it. Is this the best way to solve the issue? Yes. Reusing the existing storage-aware fixture repairs the test's resource lifetime at its owner without changing production database behavior. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f4151933b8ff. 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
|
|
Merged via squash.
|
* fix(build): refuse dist rebuild under a live managed Gateway Stop pnpm build and run-node auto-build from deleting hashed dist modules while a managed Gateway ExecStart still points at this checkout. * chore(build): drop unused fence message field * fix(build): also fence direct tsdown and run-node rebuilds Cover the cleanTsdownOutputRoots path and refuse early in run-node so live managed Gateway dist cannot be wiped outside build-all. * fix(build): keep live Gateway stop off the rebuild path Dispatch gateway stop/restart from existing dist, apply --profile before service inspection, and fence only physically overlapping checkouts. * fix(build): keep live dist fence off tsdown declaration graph Load daemon inspection lazily so tsdown fixtures and plugin-sdk dts generation do not import service-layout. Move run-node recovery tests to a sibling file so the line-cap ratchet does not grow. * fix(build): use import type for SpawnOptions in live-dist tests * fix(build): dispatch source-only QA reports before the live dist fence qa parity-report and qa coverage already run from source without rebuilding private QA dist. Check that path before refusing a live managed Gateway rebuild. * fix(daemon): discover managed Gateway bindings across profiles The live-dist fence needs every installed managed selector, not only the current OPENCLAW_PROFILE. Reuse includeManagedOpenClaw scans and leave findExtraGatewayServices semantics unchanged. * fix(build): refuse live dist rebuild for every overlapping Gateway profile A default-env build could still replace dist under a sibling profile Gateway. Inspect all managed bindings, name offenders, and point operators at stop or openclaw update. * fix(daemon): keep managed Gateway binding discovery under lint limits Move profile binding mapping out of inspect.ts, list managed services via listManagedOpenClawGatewayServices, and use toSorted for profile naming. * fix(build): keep live-dist refusal out of updater restore and system census Propagate admissionRefused so update-gateway-build does not rm live output roots after a pre-mutation fence refuse. Enumerate system-scope managed units with explicit systemdReadTarget so user and system siblings both reach the fence. * test(build): pass a compare function to toSorted in the fence fixture * fix(build): satisfy live-dist fence CI type, knip, and assertion gates Treat toSorted comparators as possibly undefined, stop re-exporting the unused binding type, and read launchd profile env through the record owner instead of a type assertion. * fix(daemon): inspect systemd template instances in the live-dist census Discovered `[email protected]` files were forwarded as unit names, so the fence queried a non-runnable template and fail-opened past a live instance when a separate user Gateway was installed. Reuse the existing instance resolution owner and cover user+system template inspection through the service reader. * fix(tooling): pin foreign-cwd tsconfig and clear CI gates - pin TSX_TSCONFIG_PATH in the CLI shim only when the cwd lacks one, so fixture-spawned run-node.mts resolves workspace profile imports - pass --import scripts/tsx.mjs to live-updater spawns and pin the tsconfig in run-node-lifecycle fixture envs (production loader parity) - drop the unused systemd re-export for knip and move the template- instance test to service.systemd-scope.test.ts for the line cap * fix(daemon): inspect registered Gateway services accurately Read strict Windows service commands from registered actions and preserve supported launcher encodings without treating dynamic CMD expansion as a verified command. Retain exact task identity and bound systemd selection. Use one platform inventory collector for the existing full and diagnostic projections. Report incomplete inspection through Doctor while preserving status JSON and the existing managed-service filters. Keep load-state inspection behind a leaf capability instead of reverse facade imports. Refs #151608, #151463. * fix(daemon): classify service commands by position Share runtime and root-option parsing so Node display names and profile values cannot classify a Node service as a Gateway. Preserve literal shell, env and generated launchd wrappers, and honor the executable selected by launchd. Read systemd's single-quoted arguments through the existing parser and preserve literal apostrophes when rendering. Keep strict Windows command rejection separate from lenient diagnostics, and align the native-boundary fixtures with that contract without weakening ownership or source-preservation assertions. * fix(daemon): inspect direct registered task actions Read literal executable actions from their registered Scheduled Task and revalidate the action before returning command facts. Strict runtime inspection uses the same registered command instead of a default launcher. Keep executable paths out of managed launcher provenance. Direct actions remain outside automatic update service management when no restorable CMD/VBS launcher exists, preserving the prior stop and definition ownership boundary. * test(windows): prove installed service upgrade paths Extend the existing native Scheduled Task proof with verified immutable package handoff and fixed fresh, published 2026.9.3, and published 2026.9.4 CLI cells. Require live version/build identity, selected PID replacement, peer continuity, strict registered-action inspection, and settled cleanup before evidence publication and disposable installation retirement. Keep source-only and repair modes, permissions, deadlines, and native lifecycle owners intact. Direct executable fixtures remain disabled and preserve the updater's unsupported-mutation boundary. Native execution remains pending. * test(doctor): retain managed Windows launcher provenance Keep the generated CMD path on the existing managed-service fixture before and after reinstall so Doctor admission sees the installation it models. Preserve all stop, install, restart, rollback, and direct-action refusal expectations without changing production behavior. * test(windows): exercise native autostart ownership boundaries Extend the existing published-updater cell with its stopped, task-owned Scheduled Task. Capture real admission, exercise native enable/disable, and preserve the definition and files after foreign-owner refusal. Test retained admission separately from restoration so legitimate same-root refresh remains supported. Restore the original XML through the existing fixture lifetime; do not broaden product control or workflow permissions. Modeled owner tests, selected source checks, and independent review pass. Actual Windows execution remains required before a native proof claim. * test(windows): retain sanitized installed command failures Keep unexpected command stdout and stderr in bounded failure diagnostics so JSON-mode CLI errors survive native proof failures. Reuse the existing terminal and support redaction owners before clipping; withhold incomplete captures while preserving the existing truncation failure. Move the existing command runner into its own test-support module and update both consumers without changing timeout, exit, signal, or cleanup semantics. Real-child regressions reproduce both privacy defects and pass with the correction. The original installed Gateway failure remains undiagnosed. * fix(daemon): preserve Windows probe budgets and Doctor cleanup eligibility Use the existing cold PowerShell startup budget for Task Scheduler queries without an explicit deadline. Keep periodic activation checks bounded and preserve unknown results rather than treating timeouts as task absence. The native probe test now exercises the production default. Share Doctor's existing legacy cleanup classification with its registered preview. Keep unsupported platforms, scopes and unrecognized Linux unit names as findings without advertising removal or invoking unrelated cleanup. Extract the classifier and complete cleanup test group without dropping assertions or changing native mutation ownership. Retain the failed installed Windows runs and their source identities; new package and native upgrade qualification remain separate requirements. * chore(daemon): retire stale Doctor size baseline The split Doctor service module no longer needs a max-lines suppression. Remove only its stale baseline entry so the shrink-only ratchet matches actual source. Product, dependency, workflow and fixture bytes are unchanged. * fix(build): keep native fixture import closures complete Keep the legacy source-update transaction at its existing direct CLI call site so native declaration-library consumers do not load its CLI-only source resolver closure. Copy the exact PID helper inputs into the runtime fixture. Use the real legacy-loader file URL in its existing subprocess invocation, so execution and unused-file analysis share the same dependency reference. Preserve all assertions, lifecycle guards and package runtime behavior. Co-authored-by: Donnie Fiander <[email protected]> * test(windows): retain sanitized service proof observations Record bounded install and status facts before semantic assertions so a successful CLI exit cannot hide the native inspection reason. Exclude free-form stderr and private response fields, and preserve existing execution, deadline, and cleanup assertions. * fix(windows): discover exact Startup Gateway launchers Carry the focused Startup discovery changes from #151674 onto the current service inventory owner. Preserve exact file identities, selected fallback classification, Scheduler inspection failures, and published updater fingerprints. Extend the existing installed Windows cells with read-only Startup diagnostics and owned-file cleanup. Focused local regressions pass, including Doctor failure on the original collector and success with Startup discovery. Native Windows qualification and the managed binding/fence integration remain pending. * test(windows): retain safe installed-service observations Retain allowlisted install/status JSON before strict semantic assertions, without copying private response fields or opaque successful stderr. Compose service observation and exact sibling-refusal checks through one internal options record and migrate every test/support caller together. Preserve native process cleanup, readiness assertions and command budgets. Co-authored-by: Donnie Fiander <[email protected]> * test(update): isolate source updater fixture inputs Give the synthetic compiler declared memory capacity through the existing memory owner instead of inheriting competing CI workers. Keep real build heap admission and all lifecycle assertions unchanged. Use the established TypeScript loader for the Linux-only live-updater CLI case so it reaches the platform refusal rather than failing during import. Refs #152875. Retains the exact failing Linux CI evidence and contributor work. Co-authored-by: Donnie Fiander <[email protected]> * fix(windows): preserve native status inspection defaults Keep the CLI RPC default distinct from an explicit timeout so Windows service inspection can use its existing cold-start budget. Forward explicit load-query deadlines through the Task Scheduler owner while preserving lifecycle defaults and timeout diagnostics. * fix(windows): preserve native status inspection defaults Keep the CLI RPC default distinct from an explicit timeout so Windows service inspection can use its existing cold-start budget. Forward explicit load-query deadlines through the Task Scheduler owner while preserving lifecycle defaults and timeout diagnostics. (cherry picked from commit 9c3bb9c) * fix(daemon): remove inventory file-helper type cycle * fix(models): retain discovered models after refresh failures Record successful legacy catalog results at the producer boundary so unavailable refreshes retain the accepted inventory. Preserve explicit outcomes, advisory SDK fallback behavior, and first-discovery starter policy. * fix(models): preserve skipped catalog outcome semantics Mark bundled static, configured, and advisory catalog projections with explicit empty outcomes so legacy success inference cannot promote them to observed account inventory. Preserve live outcomes and helper types. Keep exact auth provenance histories and move existing fixture/policy code into focused owners where required by the line-cap ratchet. Validation: 447 producer and sibling cases, 56 shared self-hosted cases, 95 auth/policy cases, causal missing-outcome failures, maintained checks, and independent review. * test(plugin-sdk): keep discovery loader types acyclic Move the shared loader type into a leaf consumed by both discovery contract helpers. Preserve its public provider-test-contracts export without a child-to-parent type import cycle. Validation: maintained Madge check reports zero cycles; core, all core test graphs, extension test types, lint, formatting and independent review pass. Runtime behavior and previous catalog proof are unchanged. * fix(plugin-sdk): mark generated static catalogs explicitly Keep the generated non-live, non-strict catalog adapter from claiming successful acquisition for manifest or configured rows. Preserve null, errors, strict and custom callbacks, static catalogs, and public types. Validation: three existing controls fail before the correction; all49 owner and sibling cases pass afterward, with types, lint, line caps and fresh independent review clean. * fix(models): remove unlanded catalog outcome inference * test(windows): handle omitted scheduled task settings * test(windows): handle exported task defaults and reuse pinned packages Preserve disabled-task and cleanup assertions when Task Scheduler omits default settings. Bind the package to its source commit and permit only the reviewed fixture paths to differ in tooling. Includes the canonical sharing-fixture retirement correction from cd2f12e (#158205). * test(windows): retain installed proof before native cleanup Persist settled commands and the original inspection failure before awaited cleanup. Prepare the existing compiled worker cache before each installed campaign and give installed Actions steps room for the unchanged native test and teardown bounds. * test(windows): diagnose native probe context after cleanup Compare read-only PowerShell probes under native and isolated OS contexts only after failed cold acceptance and verified cleanup. Preserve probe deadlines, process ownership, original results and package identity. Carry the canonical failure-only Gateway hook phase observer for the separate CI recurrence without claiming a causal repair. * test(windows): record native module cache context Retain only projected environment key names and module-cache path kind/hash so the diagnostic can distinguish an actual caller-selected cache from an absent one without recording values or changing launch behavior. * test(windows): preserve native context in installed fixtures Replace the duplicate OS environment filter with the existing native service projection and case-aware merge. Preserve caller-selected PowerShell module cache routing while retaining private application, temporary and npm paths and excluding application credentials and Node options. Two old-code regression failures and 23 fixed owner/parity cases pass; native timing remains to be verified without changing deadlines. * test(windows): preserve native context and failure evidence * test(windows): await installed readiness and guarded cleanup Installation acknowledges service activation without certifying runtime readiness. Await the existing HTTP readiness owner after install and update before the unchanged Task/PID/RPC/build assertions. Stop installed supervisors through the guarded service owner before generic task deletion; the probe PID-file cleanup does not own those processes. Preserve original failures, cleanup authority and all existing native deadlines. * test(windows): distinguish absent tasks during fixture cleanup Use authoritative Scheduler inspection before guarded stop. Confirmed absence after uninstall or failed registration skips only stop; unknown inspection still fails, and full process/port cleanup remains required. Preserve task authority on a genuine stop failure. * test(daemon): wait for installed gateway readiness before inspection * test(daemon): stop installed fixtures through their profiled CLI * fix(daemon): give actionable Startup refusal guidance * fix(update): retain native custody during partial-stop recovery Compensate a failed native stop through the existing guarded service restart, revalidating the original binding inside its operation lock. Require completed recovery and preserve the original failure without starting a build or custom shell command. Successful and failed-build custom restart contracts stay intact. Four published-shell regressions fail on the former path and pass after this repair; 21 unchanged controls, selected checks, and independent review pass. Co-authored-by: Donnie Fiander <[email protected]> * fix(daemon): inspect extra Windows services before removal Keep verified Node and legacy diagnostics visible while offering read-only Scheduled Task inspection in Doctor and deep status. Preserve the existing service cleanup owners and diagnostic JSON shape. Carry the canonical SQLite fixture host-context and dependency-selection repairs from #158209 and #158409 for the inherited CI collection failure. * test(windows): expect informational Startup fallback findings * fix: restore asynchronous harness task completion Complete the shared task-content projection cutover for asynchronous finalization and delivery. Preserve the captured Incognito policy and exact task-assignment fences. The unchanged worker suite reproduced six ReferenceError failures before the fix and passes all seven cases afterward; the sibling SDK runtime suite passes all 30 cases. Independent review is clean through P2. * fix(daemon): compose read-only Windows inspection hints Preserve exact Startup file inspection while adopting read-only Scheduled Task advice and Inspection headings. Keep Node diagnostics visible without suggesting deletion. Combine both owner behaviors and reuse the qualified lower correction without unrelated fixture changes. * test(windows): accept omitted PID for stopped Startup runtime * test(windows): budget installed lifecycle phases separately Give the fixed installed cells room for their serial setup, unchanged updater command window, native assertions and cleanup. Keep source-native and command deadlines, the quiet-run detector and the hard job limit unchanged. Record real completed phases after durable evidence writes, and verify workflow envelopes against the actual body and teardown configuration. * fix(qa): retain the current Telegram renderer reference Carry the canonical one-line metadata correction from #158313. The retired formatter was moved into format.ts, already listed by this scenario; execution and all assertions are unchanged. The owning catalog suite passes all 56 cases and fresh review is clean. * test(windows): budget installed service phases and retain progress * test(daemon): retain installed update failure progress * test(windows): retain failed installed update progress Read failed published-updater progress through the existing asynchronous SQLite owner before native cleanup. Retain only safe phase, status and step timings; preserve all command, body and teardown deadlines. Validation: five installed-fixture tests, services types, targeted changed checks and independent review through P2 passed. Shared diagnostic implementation qualified in the Windows fixture owner. * test(daemon): budget the full published Windows update * chore(ci): carry canonical line-cap repairs Carry the necessary kernel environment and publication alias hunks from #158625 (8f22acd), and the interrupted replay fixture extraction from #158538 (25f4dfa). Preserve their assertions, state contracts, and Peter Steinberger attribution. Update installed workflow comments to match the already-qualified body budgets. * test(windows): retain final updater verification diagnostics * test(windows): verify stale admission refuses foreign task resume * fix(daemon): bound aggregate Windows service inventory Carry one monotonic deadline through Scheduler discovery, launcher reads, registration revalidation, and missing-launcher metadata. Preserve completed findings and report incomplete inventory when the shared budget is exhausted. * fix(windows): share inspection deadlines with Startup launchers Compose the shared Windows inventory deadline through Startup directory inspection, launcher reads, and definition revalidation. Preserve completed discoveries and report every exhausted scan, including arbitrary filenames and the final completed Task. Use the same caller deadline for exact Startup state capture and reread. Stalled file operations remain unknown diagnostics without extending the native inspection allowance. Retain immediate Task-query failure fallback, profile bindings, and process cleanup propagation. * test(openrouter): split Fusion prompt coverage below line limit * test(daemon): complete system template runtime fixture Provide the loaded-runtime reader's required ControlGroup metadata. The missing native response correctly made inspection unavailable and broke the template regression after main integration; production behavior is unchanged. Validation: the original fixture fails locally for the CI assertion, then all 76 service-scope and loaded-runtime cases pass after correction. Independent P2 review is clean. No assertion, timeout, or package source changed. * test(openrouter): align the canonical Fusion suite label * fix(daemon): classify registered helpers without profile admission Let read-only registered inventory classify faithfully revalidated commands without requiring an OpenClaw profile. Keep selected-service profile admission strict and preserve launcher, Task, script and deadline checks. Native disabled-discovery exposed a false warning for a static node --version helper. The actual collector regression fails before this fix and passes with all 206 owner and sibling cases afterward. * fix(daemon): separate task discovery from profile admission Registered inventory must classify fully inspected unrelated commands without requiring an OpenClaw profile. Preserve resolved matching profiles for selected-service reads and all native definition revalidation. Reproduced through the real inventory collector after the installed Windows discovery fixture failed; retain the selected-service refusal control. * fix(build): retain Startup identity in external recovery guidance Carry the shared stop, successful rebuild, and start guidance while keeping Startup-only siblings tied to their exact entry paths. An already-current update does not repair stale output. Fence tests pass 44 cases with one existing skip; script types, lint, formatting and independent P2 review pass. This copy-only successor is separate from the frozen f919 Windows package source. * fix(daemon): recognize released waiting task launchers Recognize the exact waiting VBS wrapper shipped by 2026.9.3 during owned service reconciliation. Keep custom launcher behavior unknown and preserve all command, root, Task and authority checks. The real audit entry point rejected this released form as TaskLauncher unknown-edit before repair. The causal regression and edited-launcher control pass with 55 audit and 140 backup/rewrite sibling cases. * test(windows): preserve primary installed update failure facts Retain bounded sanitized fields from the original published-update JSON before unchanged failure assertions. This preserves primary reasons and failed checks that the output tail can omit, without changing capture ceilings, command deadlines, process ownership, or cleanup. * fix(test): read Windows proof archive members portably * test(windows): normalize native task export line endings * fix(windows): enable verified disabled tasks on explicit start Preserve captured autostart policy during update recovery; an explicit Gateway or Node start revalidates the selected task and its launcher/package or recorded wrapper before enabling and running it. Keep stronger local start fingerprints out of published update drivers serialized command shape. * fix(windows): retain starts with unavailable enable metadata Only an explicit disabled policy admits enabling. Preserve native Run for readable Tasks whose optional Enabled field is absent, while retaining typed failures for failed inspections. Keep the finalization fixture original gateway-entrypoint exports when replacing its install resolver. * docs(windows): explain partial effects of an explicit start A successful enable can remain after a later launch failure. Preserve the existing independently audited enable contract and require current authority for any further control; do not imply automatic rollback of a failed start. * fix(build): bound exact Startup service inspections Pass the existing Windows inspection allowance when the build fence reads an exact Startup entry. A stalled launcher read now aborts within that budget so the fence can still inspect and refuse a later live sibling. Preserve ordinary reader defaults and the cold native-Node import boundary. The real fence/state/file-reader regression fails before the fix and passes afterward. All 122 fence and Startup/deadline cases, selected type/lint/export checks, native Node import, and independent scoped review pass. * docs(update): clarify existing-build recovery commands Source-runner gateway stop and restart use the existing CLI by default. Explain that applying source changes requires the documented stop, build, and start sequence. --------- Co-authored-by: Donnie Fiander <[email protected]>
) * fix(build): refuse dist rebuild under a live managed Gateway Stop pnpm build and run-node auto-build from deleting hashed dist modules while a managed Gateway ExecStart still points at this checkout. * chore(build): drop unused fence message field * fix(build): also fence direct tsdown and run-node rebuilds Cover the cleanTsdownOutputRoots path and refuse early in run-node so live managed Gateway dist cannot be wiped outside build-all. * fix(build): keep live Gateway stop off the rebuild path Dispatch gateway stop/restart from existing dist, apply --profile before service inspection, and fence only physically overlapping checkouts. * fix(build): keep live dist fence off tsdown declaration graph Load daemon inspection lazily so tsdown fixtures and plugin-sdk dts generation do not import service-layout. Move run-node recovery tests to a sibling file so the line-cap ratchet does not grow. * fix(build): use import type for SpawnOptions in live-dist tests * fix(build): dispatch source-only QA reports before the live dist fence qa parity-report and qa coverage already run from source without rebuilding private QA dist. Check that path before refusing a live managed Gateway rebuild. * fix(daemon): discover managed Gateway bindings across profiles The live-dist fence needs every installed managed selector, not only the current OPENCLAW_PROFILE. Reuse includeManagedOpenClaw scans and leave findExtraGatewayServices semantics unchanged. * fix(build): refuse live dist rebuild for every overlapping Gateway profile A default-env build could still replace dist under a sibling profile Gateway. Inspect all managed bindings, name offenders, and point operators at stop or openclaw update. * fix(daemon): keep managed Gateway binding discovery under lint limits Move profile binding mapping out of inspect.ts, list managed services via listManagedOpenClawGatewayServices, and use toSorted for profile naming. * fix(build): keep live-dist refusal out of updater restore and system census Propagate admissionRefused so update-gateway-build does not rm live output roots after a pre-mutation fence refuse. Enumerate system-scope managed units with explicit systemdReadTarget so user and system siblings both reach the fence. * test(build): pass a compare function to toSorted in the fence fixture * fix(build): satisfy live-dist fence CI type, knip, and assertion gates Treat toSorted comparators as possibly undefined, stop re-exporting the unused binding type, and read launchd profile env through the record owner instead of a type assertion. * fix(daemon): inspect systemd template instances in the live-dist census Discovered `[email protected]` files were forwarded as unit names, so the fence queried a non-runnable template and fail-opened past a live instance when a separate user Gateway was installed. Reuse the existing instance resolution owner and cover user+system template inspection through the service reader. * fix(tooling): pin foreign-cwd tsconfig and clear CI gates - pin TSX_TSCONFIG_PATH in the CLI shim only when the cwd lacks one, so fixture-spawned run-node.mts resolves workspace profile imports - pass --import scripts/tsx.mjs to live-updater spawns and pin the tsconfig in run-node-lifecycle fixture envs (production loader parity) - drop the unused systemd re-export for knip and move the template- instance test to service.systemd-scope.test.ts for the line cap * fix(daemon): inspect registered Gateway services accurately Read strict Windows service commands from registered actions and preserve supported launcher encodings without treating dynamic CMD expansion as a verified command. Retain exact task identity and bound systemd selection. Use one platform inventory collector for the existing full and diagnostic projections. Report incomplete inspection through Doctor while preserving status JSON and the existing managed-service filters. Keep load-state inspection behind a leaf capability instead of reverse facade imports. Refs openclaw#151608, openclaw#151463. * fix(daemon): classify service commands by position Share runtime and root-option parsing so Node display names and profile values cannot classify a Node service as a Gateway. Preserve literal shell, env and generated launchd wrappers, and honor the executable selected by launchd. Read systemd's single-quoted arguments through the existing parser and preserve literal apostrophes when rendering. Keep strict Windows command rejection separate from lenient diagnostics, and align the native-boundary fixtures with that contract without weakening ownership or source-preservation assertions. * fix(daemon): inspect direct registered task actions Read literal executable actions from their registered Scheduled Task and revalidate the action before returning command facts. Strict runtime inspection uses the same registered command instead of a default launcher. Keep executable paths out of managed launcher provenance. Direct actions remain outside automatic update service management when no restorable CMD/VBS launcher exists, preserving the prior stop and definition ownership boundary. * test(windows): prove installed service upgrade paths Extend the existing native Scheduled Task proof with verified immutable package handoff and fixed fresh, published 2026.9.3, and published 2026.9.4 CLI cells. Require live version/build identity, selected PID replacement, peer continuity, strict registered-action inspection, and settled cleanup before evidence publication and disposable installation retirement. Keep source-only and repair modes, permissions, deadlines, and native lifecycle owners intact. Direct executable fixtures remain disabled and preserve the updater's unsupported-mutation boundary. Native execution remains pending. * test(doctor): retain managed Windows launcher provenance Keep the generated CMD path on the existing managed-service fixture before and after reinstall so Doctor admission sees the installation it models. Preserve all stop, install, restart, rollback, and direct-action refusal expectations without changing production behavior. * test(windows): exercise native autostart ownership boundaries Extend the existing published-updater cell with its stopped, task-owned Scheduled Task. Capture real admission, exercise native enable/disable, and preserve the definition and files after foreign-owner refusal. Test retained admission separately from restoration so legitimate same-root refresh remains supported. Restore the original XML through the existing fixture lifetime; do not broaden product control or workflow permissions. Modeled owner tests, selected source checks, and independent review pass. Actual Windows execution remains required before a native proof claim. * test(windows): retain sanitized installed command failures Keep unexpected command stdout and stderr in bounded failure diagnostics so JSON-mode CLI errors survive native proof failures. Reuse the existing terminal and support redaction owners before clipping; withhold incomplete captures while preserving the existing truncation failure. Move the existing command runner into its own test-support module and update both consumers without changing timeout, exit, signal, or cleanup semantics. Real-child regressions reproduce both privacy defects and pass with the correction. The original installed Gateway failure remains undiagnosed. * fix(daemon): preserve Windows probe budgets and Doctor cleanup eligibility Use the existing cold PowerShell startup budget for Task Scheduler queries without an explicit deadline. Keep periodic activation checks bounded and preserve unknown results rather than treating timeouts as task absence. The native probe test now exercises the production default. Share Doctor's existing legacy cleanup classification with its registered preview. Keep unsupported platforms, scopes and unrecognized Linux unit names as findings without advertising removal or invoking unrelated cleanup. Extract the classifier and complete cleanup test group without dropping assertions or changing native mutation ownership. Retain the failed installed Windows runs and their source identities; new package and native upgrade qualification remain separate requirements. * chore(daemon): retire stale Doctor size baseline The split Doctor service module no longer needs a max-lines suppression. Remove only its stale baseline entry so the shrink-only ratchet matches actual source. Product, dependency, workflow and fixture bytes are unchanged. * fix(build): keep native fixture import closures complete Keep the legacy source-update transaction at its existing direct CLI call site so native declaration-library consumers do not load its CLI-only source resolver closure. Copy the exact PID helper inputs into the runtime fixture. Use the real legacy-loader file URL in its existing subprocess invocation, so execution and unused-file analysis share the same dependency reference. Preserve all assertions, lifecycle guards and package runtime behavior. Co-authored-by: Donnie Fiander <[email protected]> * test(windows): retain sanitized service proof observations Record bounded install and status facts before semantic assertions so a successful CLI exit cannot hide the native inspection reason. Exclude free-form stderr and private response fields, and preserve existing execution, deadline, and cleanup assertions. * fix(windows): discover exact Startup Gateway launchers Carry the focused Startup discovery changes from openclaw#151674 onto the current service inventory owner. Preserve exact file identities, selected fallback classification, Scheduler inspection failures, and published updater fingerprints. Extend the existing installed Windows cells with read-only Startup diagnostics and owned-file cleanup. Focused local regressions pass, including Doctor failure on the original collector and success with Startup discovery. Native Windows qualification and the managed binding/fence integration remain pending. * test(windows): retain safe installed-service observations Retain allowlisted install/status JSON before strict semantic assertions, without copying private response fields or opaque successful stderr. Compose service observation and exact sibling-refusal checks through one internal options record and migrate every test/support caller together. Preserve native process cleanup, readiness assertions and command budgets. Co-authored-by: Donnie Fiander <[email protected]> * test(update): isolate source updater fixture inputs Give the synthetic compiler declared memory capacity through the existing memory owner instead of inheriting competing CI workers. Keep real build heap admission and all lifecycle assertions unchanged. Use the established TypeScript loader for the Linux-only live-updater CLI case so it reaches the platform refusal rather than failing during import. Refs openclaw#152875. Retains the exact failing Linux CI evidence and contributor work. Co-authored-by: Donnie Fiander <[email protected]> * fix(windows): preserve native status inspection defaults Keep the CLI RPC default distinct from an explicit timeout so Windows service inspection can use its existing cold-start budget. Forward explicit load-query deadlines through the Task Scheduler owner while preserving lifecycle defaults and timeout diagnostics. * fix(windows): preserve native status inspection defaults Keep the CLI RPC default distinct from an explicit timeout so Windows service inspection can use its existing cold-start budget. Forward explicit load-query deadlines through the Task Scheduler owner while preserving lifecycle defaults and timeout diagnostics. (cherry picked from commit 9c3bb9c) * fix(daemon): remove inventory file-helper type cycle * fix(models): retain discovered models after refresh failures Record successful legacy catalog results at the producer boundary so unavailable refreshes retain the accepted inventory. Preserve explicit outcomes, advisory SDK fallback behavior, and first-discovery starter policy. * fix(models): preserve skipped catalog outcome semantics Mark bundled static, configured, and advisory catalog projections with explicit empty outcomes so legacy success inference cannot promote them to observed account inventory. Preserve live outcomes and helper types. Keep exact auth provenance histories and move existing fixture/policy code into focused owners where required by the line-cap ratchet. Validation: 447 producer and sibling cases, 56 shared self-hosted cases, 95 auth/policy cases, causal missing-outcome failures, maintained checks, and independent review. * test(plugin-sdk): keep discovery loader types acyclic Move the shared loader type into a leaf consumed by both discovery contract helpers. Preserve its public provider-test-contracts export without a child-to-parent type import cycle. Validation: maintained Madge check reports zero cycles; core, all core test graphs, extension test types, lint, formatting and independent review pass. Runtime behavior and previous catalog proof are unchanged. * fix(plugin-sdk): mark generated static catalogs explicitly Keep the generated non-live, non-strict catalog adapter from claiming successful acquisition for manifest or configured rows. Preserve null, errors, strict and custom callbacks, static catalogs, and public types. Validation: three existing controls fail before the correction; all49 owner and sibling cases pass afterward, with types, lint, line caps and fresh independent review clean. * fix(models): remove unlanded catalog outcome inference * test(windows): handle omitted scheduled task settings * test(windows): handle exported task defaults and reuse pinned packages Preserve disabled-task and cleanup assertions when Task Scheduler omits default settings. Bind the package to its source commit and permit only the reviewed fixture paths to differ in tooling. Includes the canonical sharing-fixture retirement correction from 8699132 (openclaw#158205). * test(windows): retain installed proof before native cleanup Persist settled commands and the original inspection failure before awaited cleanup. Prepare the existing compiled worker cache before each installed campaign and give installed Actions steps room for the unchanged native test and teardown bounds. * test(windows): diagnose native probe context after cleanup Compare read-only PowerShell probes under native and isolated OS contexts only after failed cold acceptance and verified cleanup. Preserve probe deadlines, process ownership, original results and package identity. Carry the canonical failure-only Gateway hook phase observer for the separate CI recurrence without claiming a causal repair. * test(windows): record native module cache context Retain only projected environment key names and module-cache path kind/hash so the diagnostic can distinguish an actual caller-selected cache from an absent one without recording values or changing launch behavior. * test(windows): preserve native context in installed fixtures Replace the duplicate OS environment filter with the existing native service projection and case-aware merge. Preserve caller-selected PowerShell module cache routing while retaining private application, temporary and npm paths and excluding application credentials and Node options. Two old-code regression failures and 23 fixed owner/parity cases pass; native timing remains to be verified without changing deadlines. * test(windows): preserve native context and failure evidence * test(windows): await installed readiness and guarded cleanup Installation acknowledges service activation without certifying runtime readiness. Await the existing HTTP readiness owner after install and update before the unchanged Task/PID/RPC/build assertions. Stop installed supervisors through the guarded service owner before generic task deletion; the probe PID-file cleanup does not own those processes. Preserve original failures, cleanup authority and all existing native deadlines. * test(windows): distinguish absent tasks during fixture cleanup Use authoritative Scheduler inspection before guarded stop. Confirmed absence after uninstall or failed registration skips only stop; unknown inspection still fails, and full process/port cleanup remains required. Preserve task authority on a genuine stop failure. * test(daemon): wait for installed gateway readiness before inspection * test(daemon): stop installed fixtures through their profiled CLI * fix(daemon): give actionable Startup refusal guidance * fix(update): retain native custody during partial-stop recovery Compensate a failed native stop through the existing guarded service restart, revalidating the original binding inside its operation lock. Require completed recovery and preserve the original failure without starting a build or custom shell command. Successful and failed-build custom restart contracts stay intact. Four published-shell regressions fail on the former path and pass after this repair; 21 unchanged controls, selected checks, and independent review pass. Co-authored-by: Donnie Fiander <[email protected]> * fix(daemon): inspect extra Windows services before removal Keep verified Node and legacy diagnostics visible while offering read-only Scheduled Task inspection in Doctor and deep status. Preserve the existing service cleanup owners and diagnostic JSON shape. Carry the canonical SQLite fixture host-context and dependency-selection repairs from openclaw#158209 and openclaw#158409 for the inherited CI collection failure. * test(windows): expect informational Startup fallback findings * fix: restore asynchronous harness task completion Complete the shared task-content projection cutover for asynchronous finalization and delivery. Preserve the captured Incognito policy and exact task-assignment fences. The unchanged worker suite reproduced six ReferenceError failures before the fix and passes all seven cases afterward; the sibling SDK runtime suite passes all 30 cases. Independent review is clean through P2. * fix(daemon): compose read-only Windows inspection hints Preserve exact Startup file inspection while adopting read-only Scheduled Task advice and Inspection headings. Keep Node diagnostics visible without suggesting deletion. Combine both owner behaviors and reuse the qualified lower correction without unrelated fixture changes. * test(windows): accept omitted PID for stopped Startup runtime * test(windows): budget installed lifecycle phases separately Give the fixed installed cells room for their serial setup, unchanged updater command window, native assertions and cleanup. Keep source-native and command deadlines, the quiet-run detector and the hard job limit unchanged. Record real completed phases after durable evidence writes, and verify workflow envelopes against the actual body and teardown configuration. * fix(qa): retain the current Telegram renderer reference Carry the canonical one-line metadata correction from openclaw#158313. The retired formatter was moved into format.ts, already listed by this scenario; execution and all assertions are unchanged. The owning catalog suite passes all 56 cases and fresh review is clean. * test(windows): budget installed service phases and retain progress * test(daemon): retain installed update failure progress * test(windows): retain failed installed update progress Read failed published-updater progress through the existing asynchronous SQLite owner before native cleanup. Retain only safe phase, status and step timings; preserve all command, body and teardown deadlines. Validation: five installed-fixture tests, services types, targeted changed checks and independent review through P2 passed. Shared diagnostic implementation qualified in the Windows fixture owner. * test(daemon): budget the full published Windows update * chore(ci): carry canonical line-cap repairs Carry the necessary kernel environment and publication alias hunks from openclaw#158625 (85aa765), and the interrupted replay fixture extraction from openclaw#158538 (3fd1eb9). Preserve their assertions, state contracts, and Peter Steinberger attribution. Update installed workflow comments to match the already-qualified body budgets. * test(windows): retain final updater verification diagnostics * test(windows): verify stale admission refuses foreign task resume * fix(daemon): bound aggregate Windows service inventory Carry one monotonic deadline through Scheduler discovery, launcher reads, registration revalidation, and missing-launcher metadata. Preserve completed findings and report incomplete inventory when the shared budget is exhausted. * fix(windows): share inspection deadlines with Startup launchers Compose the shared Windows inventory deadline through Startup directory inspection, launcher reads, and definition revalidation. Preserve completed discoveries and report every exhausted scan, including arbitrary filenames and the final completed Task. Use the same caller deadline for exact Startup state capture and reread. Stalled file operations remain unknown diagnostics without extending the native inspection allowance. Retain immediate Task-query failure fallback, profile bindings, and process cleanup propagation. * test(openrouter): split Fusion prompt coverage below line limit * test(daemon): complete system template runtime fixture Provide the loaded-runtime reader's required ControlGroup metadata. The missing native response correctly made inspection unavailable and broke the template regression after main integration; production behavior is unchanged. Validation: the original fixture fails locally for the CI assertion, then all 76 service-scope and loaded-runtime cases pass after correction. Independent P2 review is clean. No assertion, timeout, or package source changed. * test(openrouter): align the canonical Fusion suite label * fix(daemon): classify registered helpers without profile admission Let read-only registered inventory classify faithfully revalidated commands without requiring an OpenClaw profile. Keep selected-service profile admission strict and preserve launcher, Task, script and deadline checks. Native disabled-discovery exposed a false warning for a static node --version helper. The actual collector regression fails before this fix and passes with all 206 owner and sibling cases afterward. * fix(daemon): separate task discovery from profile admission Registered inventory must classify fully inspected unrelated commands without requiring an OpenClaw profile. Preserve resolved matching profiles for selected-service reads and all native definition revalidation. Reproduced through the real inventory collector after the installed Windows discovery fixture failed; retain the selected-service refusal control. * fix(build): retain Startup identity in external recovery guidance Carry the shared stop, successful rebuild, and start guidance while keeping Startup-only siblings tied to their exact entry paths. An already-current update does not repair stale output. Fence tests pass 44 cases with one existing skip; script types, lint, formatting and independent P2 review pass. This copy-only successor is separate from the frozen f919 Windows package source. * fix(daemon): recognize released waiting task launchers Recognize the exact waiting VBS wrapper shipped by 2026.9.3 during owned service reconciliation. Keep custom launcher behavior unknown and preserve all command, root, Task and authority checks. The real audit entry point rejected this released form as TaskLauncher unknown-edit before repair. The causal regression and edited-launcher control pass with 55 audit and 140 backup/rewrite sibling cases. * test(windows): preserve primary installed update failure facts Retain bounded sanitized fields from the original published-update JSON before unchanged failure assertions. This preserves primary reasons and failed checks that the output tail can omit, without changing capture ceilings, command deadlines, process ownership, or cleanup. * fix(test): read Windows proof archive members portably * test(windows): normalize native task export line endings * fix(windows): enable verified disabled tasks on explicit start Preserve captured autostart policy during update recovery; an explicit Gateway or Node start revalidates the selected task and its launcher/package or recorded wrapper before enabling and running it. Keep stronger local start fingerprints out of published update drivers serialized command shape. * fix(windows): retain starts with unavailable enable metadata Only an explicit disabled policy admits enabling. Preserve native Run for readable Tasks whose optional Enabled field is absent, while retaining typed failures for failed inspections. Keep the finalization fixture original gateway-entrypoint exports when replacing its install resolver. * docs(windows): explain partial effects of an explicit start A successful enable can remain after a later launch failure. Preserve the existing independently audited enable contract and require current authority for any further control; do not imply automatic rollback of a failed start. * fix(build): bound exact Startup service inspections Pass the existing Windows inspection allowance when the build fence reads an exact Startup entry. A stalled launcher read now aborts within that budget so the fence can still inspect and refuse a later live sibling. Preserve ordinary reader defaults and the cold native-Node import boundary. The real fence/state/file-reader regression fails before the fix and passes afterward. All 122 fence and Startup/deadline cases, selected type/lint/export checks, native Node import, and independent scoped review pass. * docs(update): clarify existing-build recovery commands Source-runner gateway stop and restart use the existing CLI by default. Explain that applying source changes requires the documented stop, build, and start sequence. --------- Co-authored-by: Donnie Fiander <[email protected]>
Related: #151674, #151025
What Problem This Solves
Storage CI can fail during sharing-suite teardown and cascade into later tests when a maintenance worker exits after its fixture database has already been removed.
User Impact
No user-visible change. This fixes test fixture ownership; production database identity checks and cleanup error handling remain intact.
Why This Change Was Made
The sharing tests used a directory-only helper that removed state before their synchronous file-level cleanup. Ordinary session writes can retain an asynchronous maintenance worker and its shared-database lease. Parent-side recovery then needs the original database after native exit.
Use the existing storage-aware fixture for every sharing case so resource drainage precedes directory removal. Preserve the transaction commit/rollback and intentional synchronous read-only checks. A real-worker regression completes automatic maintenance, terminates that worker, and verifies fixture removal leaves no lease cleanup behind.
Both failing CI summaries explicitly identify sharing-suite teardown (151674 run, 151025 run). The original worker-exit trigger remains unknown; this change repairs the independently reproduced fixture lifetime violation.
Evidence
Changed-file cost (
node scripts/run-vitest.mjs src/config/sessions/session-sharing-store.test.ts --maxWorkers=1): 17/17 pass, 25.94 s Vitest wall time and 30.09 s including the maintained compiler wrapper; the 17 reported case durations total 6.775 s. The real native-exit/lease-recovery regression requires the actual Worker and SQLite lifecycle. The matching CI checks-node-changed job passed in 77 s (16:28:35–16:29:52 UTC).