Skip to content

fix(daemon): inspect registered Gateway services accurately - #151608

Merged
steipete merged 45 commits into
mainfrom
codex/recovery-split-service-inventory
Sep 27, 2026
Merged

steipete merged 45 commits into
mainfrom
codex/recovery-split-service-inventory

Conversation

@steipete

@steipete steipete commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Related: #150153. Continues the strict-reader portion of #151463. Startup discovery remains #151674; managed inventory and the build-fence consumer remain #152875.

What Problem This Solves

Doctor, status, and update admission could inspect a default Windows launcher instead of the registered action, mistake failed inspection for absence, or use a different profile from the command actually launched.

User Impact

Selected-service inspection follows the registered command and its effective profile, preserves uncertain results, and shares one deadline across native and file inspection. Discovery retains incomplete-inspection warnings and separately inventories services for other profiles. Extra Windows services, including Node hosts, receive read-only inspection hints. Direct executable inspection does not grant permission to rewrite an unmanaged action.

Why This Change Was Made

One platform collector serves Doctor and status. The existing Task Scheduler owner validates registered actions, literal CMD/VBS launchers and direct executables, then revalidates the captured definition before using it. Root CLI profile parsing handles runtime prefixes and explicit argv selection; derived environments apply that selection while retaining the caller's native service identity. Captured command and environment bytes remain unchanged for fingerprints and recovery. If authority is lost during native preparation, the already-created private recovery handle is settled without enabling the Task, and the original failure remains visible.

Read-only registration now uses the same typed native probe as command inspection. Only a confirmed missing task permits Startup fallback; denied, interrupted, or late observations remain unknown. The canonical service-state owner carries the single inspection deadline. The cold native default remains 60 seconds, explicit deadlines bound the whole inspection, and ordinary lifecycle commands retain their existing limits.

Cleanup previews remain limited to existing supported cleanup operations. Global LaunchAgent inventory preserves first-class user-service detection without claiming effective runtime inspection of a global-only plist. Node and legacy services remain diagnostic findings.

Evidence and qualification

Candidate: 8a184400b4cfc177f8365af4f4bbc46e7cf25072. Exact-head CI passed 156 jobs with 18 intentional skips, including openclaw/ci-gate. The completed exact-head ClawSweeper review reports no actionable code/security finding. Maintainer applicability review now separates this PR's changed contracts from the previously combined sibling upgrade campaign; required CI and review gates remain intact.

  • Registered-command/profile, typed native inspection and environment behavior have real Windows reader proof, with source parity to this candidate. Aggregate deadline and non-Gateway discovery defects have causal owner regressions and passing owner/sibling suites. The authenticated 82ba7ab package's fresh native cell passed installation, shared-reader discovery, cleanup and retirement.
  • Source-exact native authority proof passed selected enable/disable, foreign and retained-owned-to-foreign refusal, legitimate same-root refresh, and refusal after retained-definition drift. Refusal snapshots stayed unchanged, four CLI commands joined, and cleanup plus proof-bound retirement passed. Tooling 7e071aa uses this PR's control/admission owners; the installed baseline is separately identified as 82ba7ab. Its original three-cell reducer intentionally remains failed because those upgrade cells were not run.
  • Lost-authority cleanup is causally proved through the actual Windows recovery owner with real signal listeners, plus 156 maintenance cases. The exact published 1391f7c waiting VBS literal passes the actual audit entry point after reproducing the old warning; custom edits remain unknown and preserved. All 55 audit cases and 140 backup/rewrite siblings pass. Full source review, affected types/lint/guards and fixed-main receiving proof are retained.

Artifact limitation: the final released-VBS literal audit change was not in the compiled 82ba7ab archive. Its changed contract is covered by the source-bound actual-audit regression; this PR does not claim a completed final whole-package upgrade matrix.

The original published 9.3/9.4 receipts remain failed or unexecuted. In 9.3, candidate activation/verification completed while the original driver failed final command settlement. Native observations bind the old parent PID, loaded addon and residual backup bytes; released source and the isolated loaded-addon comparison support the retirement mechanism, but no in-flow pending stack or errno was captured. The cleanup owners have no delta in this PR and already include the forward repair #154219. The older 9.4 retained-ledger callback is forward-fixed by inherited #157262; subsequent explicit-start recovery work is separately owned by #151674. Source-build recovery work belongs to #152875 and is absent from this PR. These failures remain visible rather than being converted into a three-cell pass or a publication dependency for this PR.

The historical record below preserves prior failures, source identities and measured test costs. Earlier broad readiness statements in that record are superseded by this contract-specific qualification.

Earlier source-boundary, CI, native, and test-cost evidence (historical)

The material below records earlier heads and their original outcomes. References to a current head or pending repair within this historical record refer to that earlier checkpoint, not the candidate identified above. Unique local receipts, RED/GREEN logs, native artifacts, and review reports are preserved.

Current head: 1f8e9a2f3a76039ad2a1671aea4fdd8e421759b8. This candidate carries fixed main c60c051c6c9f after an actual GitHub conflict. The resolutions retain both strict Windows inspection guidance and main's XML-default documentation, and use main's exact worker-thread fixture metadata while overriding only the forbidden Worker constructor. The service/query/runtime/maintenance owners and the Node inspection-hint correction are unchanged by this carry. Incoming manifest changes are test commands and GitHub plugin metadata; dependency declarations, lockfile, patches, toolchain and install hooks are unchanged. The complete installed application lock matches all 185 source importers, so no install was needed. It also includes the qualified afac701d SDK repair (now landed canonically as #158520) and its canonical precursor after current-main CI exposed two async callers of a removed task-content projector. The merge was conflict-free; service and dependency inputs are unchanged.

The imported catalog-inference workaround was withdrawn: omitted outcomes can represent shipped advisory/fallback behavior, and inferring public success incorrectly filtered supplemental native models. The 43 detour paths were restored to canonical main, and subsequent main changes are preserved, including alias filtering and #158115's genuine HTTP-fixture success outcomes. The separate legacy-retention investigation in #158113 is not a dependency of this PR.

Local proof includes 187 affected Windows reader/load-state/fallback/install cases, 228 service/update/status and alias-integration cases, and 11 unchanged discovery/freshness/native-augmentation/alias cases. The suites overlap and are not an aggregate unique-test count. The 187-case run took 78.27 seconds; the 228-case run took 64.89 seconds; the 11-case run took 146.24 seconds. These are local owner/integration tests, not native Windows execution. The fixed-main composition additionally passed all 217 status and Doctor cases in 39.38 seconds, with core/services/Doctor types and focused lint, format, size/assertion guards. Independent source review verified both test registrations, unchanged timeout assertions, and the shared diagnostic wrapper; this mechanical carry retains the existing qualified reviews.

Core and affected test types, targeted lint, formatting, size/assertion guards, and the full static import graph pass; static cycles are zero. The fresh complete narrowed review is clean. The model run initially stopped before any tests at the runtime-publication guard; after checking the isolated task profile and physical build paths, the normal runtime build completed and the unchanged tests passed in their ordinary environment. No operator Gateway was changed and no guard was bypassed.

Earlier full-core lint recorded three files byte-identical to the then-pinned main: server-chat-metadata-lifecycle.integration.test.ts (1,002/1,000), session-companion-ask.ts (761/700), and app-sidebar-session-list-render.ts (704/700). Those failures remain documented; no baseline exception or unrelated source edit was added here. Current exact-head enforced CI must still pass.

The current review's Node-removal finding was reproduced through the existing Windows discovery cases and the real Doctor/status renderers. The fix keeps every diagnostic row and the existing shell-safe label filter, changes the shared hint to schtasks /Query /TN ... /V /FO LIST, and updates both headings and docs. The four affected test files passed 143 cases with 10 existing platform skips, in separate one-worker invocations. Full changed checks, all 25 core test type graphs, targeted final checks, size guards, and final independent review passed.

CI on be3e7dc stopped at an inherited generated SQLite fixture mock that lacked the new compile-cache thread metadata. The six reached files matched CI's main parent. This branch preserves the canonical fixture corrections from #158209 and #158409, including the later #158286 change that imports actual worker metadata and overrides only the forbidden Worker. It preserves the native-denial edge, seven ordered bodies and retained-custody assertions. After the required fixed-main carry, the ordered fixture, all 96 routing cases, and seven incoming Task XML-default cases passed locally. Core/services/root types, focused lint, formatting and size guards passed. Node-hint tests and their clean review remain applicable to their unchanged postimages.

Current-main CI on c400f45 found two dangling SDK projection calls introduced by #157543; the lower branch had not changed that owner. The canonical repair migrates both async callers to the existing shared projection. Its owner proved six causal failures becoming seven passing worker cases plus 30 SDK siblings and clean review/gates. This composition preserves those exact SDK postimages and additionally passed core and SDK type checks; no service implementation or privacy policy was reauthored here.

Native and Published-Upgrade Qualification

The maintained WindowsTestboxProbe has three fixed installed-service cells: fresh candidate, unchanged published 2026.9.3 updater, and unchanged published 2026.9.4 updater. It verifies immutable package handoff, live build/PID replacement, peer continuity, update/Doctor diagnostics, and owned Task/descendant cleanup. Prefixes are prepared and retired one cell at a time with actual capacity observations. The bounded synthetic stopped-Task group exercises genuine admission, initial foreign-owner refusal, and retained-admission rejection after a definition change; it does not claim every native mutation boundary or arbitrary later races.

Historical native failures are preserved. 36104286261 identified the old 5-second PowerShell limit. 36123699024 attempt 2 installed successfully and showed a healthy exact-build RPC response, but captured the separate 10-second status-caller override. Its first attempt had stopped in package preparation; the one normal failed-jobs recovery used unchanged inputs and limits on a fresh runner. Neither attempt is relabeled as a native pass.

The downstream 36141734174 exercised the preceding registration reader: installation succeeded in 115.36 seconds, and status succeeded in 35.09 seconds with a running PID and healthy RPC/build identity, but the registration query hit 15 seconds. Native cleanup succeeded and the published-updater cells were skipped. Two causal local regressions then distinguished that short default from an explicit 90-second budget silently shortened by the old 30-second silence limit. The current correction addresses both clocks without a retry or weaker assertion.

The negative transport run 36081672156 rejected a changed authenticated artifact digest before download/native execution; its secondary missing-result upload failure is retained. Historical successful Package Acceptance runs for c53d0d6e and 6297438f remain bound to those older products. The superseded 7b producer and b89 CI were cancelled normally; they do not qualify this source.

The exact-source Package Acceptance run 36157085985 passed package integrity, npm 12 installation, and the selected Doctor-switch Docker lane. Its authenticated artifact digest, tarball hash, and build information all match b98c780d. CI 36155576375 stopped after a Windows tooling timeout in the relocated worker-facade case; its cohort recorded 168 passes and 12 skips. The test and reached archive/build/facade/process-helper owners are unchanged across the feature head, pinned main, and CI main tip. The log does not identify the stalled operation. Bounded native replays of the exact failed merge and its main parent each passed all 18 worker-package cases with the same toolchain; they omitted the original parallel multi-file load and retained descendant-settlement uncertainty. The historical timeout remains unattributed rather than fixed or waived. The normal CI run 36165238116 for f7b3d4fa subsequently passed all 153 selected jobs, with 17 intentional skips. The fixed-main product composition 1848a469 also passed CI 36185534752, with 153 successful jobs and 17 intentional skips.

The sibling Windows run 36159376039 reached a loaded, running Gateway and healthy RPC, then exposed a shared test-fixture assumption: Task Scheduler export may omit default Enabled and AllowStartOnDemand XML elements. The assertion failed before creating the diagnostic Tasks; cleanup passed and the published-updater cells were skipped. The five-file fixture correction now reuses the existing Enabled setter, explicitly disables on-demand launch when omitted, and normalizes only task-level Enabled for the authority comparison. It covers diagnostics, authority, and the malformed registered-action canary. Two causal failures preceded 15 passing XML/autostart cases; affected types, lint, format, size guards, import-cycle checks, and fresh independent review passed. This is tooling qualification, not a completed native three-cell result.

The subsequent shared run 36169211750 lost completion evidence when the five-minute Actions step cut off native cleanup. The tooling now prepares workers before the cell and reserves eight host minutes for the unchanged four-minute test, three-minute teardown hook, and runner margin; the job ceiling stays 75 minutes. Settled commands, status, and original errors are saved before cleanup. The next run 36172773115 failed its first install at the existing 60-second PowerShell query limit, below both test and host deadlines. Neither run completed a native cell.

Read-only controls in 36178482198 found missing Tasks in all four contexts: native OS context took 0.436/1.581 seconds, while fresh fixture context took 23.139/22.866 seconds. Multiple environment keys differed, so this does not isolate one cause. The fixture now reuses the existing safe native environment projection, preserves mixed-case Windows keys and the caller-selected module cache, retains private app/state/temp/npm paths, and excludes credentials and Node injection options. Two causal contract tests and 18 lower integration cases passed, along with types, lint, workflow security/structure checks, formatting, size guards, import-cycle checks, and fresh review. The subsequent corrected-context run 36182791591 completed install in 18.506 seconds and status in 9.579 seconds, with all four context probes near 0.4 seconds. It still failed the initial RPC-readiness assertion: the Task and process were running, but the port was not yet accepting connections. In-test cleanup retained related processes; later workflow cleanup succeeded. No full cell or published-updater result is claimed, and no completed native cell is claimed. The shared fixture now waits through the existing HTTP readiness owner after installation and actual update, using the existing startup timing and test cancellation signal. Strict Task/PID/RPC/build assertions remain one-shot afterward; continuity checks stay immediate. Cleanup invokes the existing guarded stop before deleting a registered Task, skips that stop only after confirmed absence, and preserves typed errors for unknown inspection. Generic cleanup and full residual-process assertions still run; no inner test or command deadline was increased. The fresh lower review raised one cleanup concern; the full function still performs independent residual-process checks after the catch and forces a failed result when stop fails, so no further policy change was needed. The raw finding and source disposition are retained. The existing readiness/stop owner cohort passed 71 cases; the lower composition passed services types, focused lint/format and size guards, with fresh independent review.

The shared native run 36189933355 reached HTTP readiness, registered Task/PID identity and the exact candidate RPC build. It also completed disabled Task discovery with an incomplete-launcher warning and extra-service finding, plus direct-action strict preview. The full cell then failed a Startup-specific Doctor exit expectation. Its cleanup invoked the service facade inside the test worker, whose ambient synthetic state was correctly rejected before native stop. The shared fixture now invokes the existing packaged CLI in the admitted task profile and environment under its existing managed cleanup lifetime. It retains unknown/missing handling, failed-stop definition retention, and residual assertions; product guards, command limits, and body deadlines are unchanged. The lower call correction passed all six command-owner tests, services types, lint/format, and fresh independent review. This reached evidence is partial: authority and both published-updater cells remain unexecuted.

The downstream Windows run 36202832017 reached exact candidate readiness/PID/RPC, complete disabled Task discovery, direct-action preview, and its Task-present Startup checks. All ten CLI commands joined, and in-test plus workflow cleanup succeeded with zero recorded remaining fixture processes. Its fresh cell still failed a later Startup-specific expected-exit assertion, so this is partial shared-contract evidence; neither published-updater cell nor the authority group is credited.

The shared Windows run 36209565247 completed its fresh cell using tooling c1bfe482 and the authenticated dde440b9 package: readiness and exact-build RPC/PID, disabled Task discovery, direct and malformed-command previews, uninstall, all 12 command joins, native cleanup, and proof-bound storage retirement passed. The registered Task classifiers, collection path, command inspection, and fixture assertions were compared with this PR before reusing those common-contract results. Startup-specific assertions remain downstream proof, and this does not certify the separate b98 package archive. The 9.3 cell subsequently hit its 240-second test deadline while the unchanged published updater had run for 119.956 seconds without output; its 180-second command limit was not exhausted. All commands and cleanup joined, but the update subphase and post-update state were not observed. The 9.4 cell and authority group were not reached. The run is not a completed upgrade campaign.

The fixture-only successor 1f8e9a2f corrects that orchestration mismatch without changing product or dependency inputs. Installed body allowances are 360/900/900 seconds, with 10/19/19-minute Actions steps containing the existing 180-second teardown and a 60-second runner margin inside the unchanged 75-minute job. The published-cell allocations combine observed setup with estimated serial work; the 9.4 cold-native reserve is unmeasured. Per-command 180 seconds, readiness/query limits, source-native 240 seconds, and quiet-output 300 seconds are unchanged. One existing durable recorder now emits fixed safe phase labels only after settled work and proof writes. All 21 focused tests passed with one existing platform skip; services/root types, lint, workflow validation, formatting, both size guards, and fresh independent review passed. Current-head CI 36216776596 failed on two incoming-main changes outside these six files: #158313 makes the workspace quota walk reject a disappearing rsync temporary manifest, and #158464 moves a Control UI type while leaving an E2E caller on the former export. Both were checked against the exact CI main parent; canonical repair ownership is being coordinated. The prior fresh native result retains its original package and tooling identity.

The preceding 0fc9a98b tooling head passed CI 36189805456: 153 successful jobs and 17 intentional skips. The preceding product head CI 36208857347 passed for 08448caa: 153 successful jobs and 17 intentional skips. The published Windows 9.3/9.4 upgrades, authority checks, and their cleanup remain required before merge. Completed shared-owner receipts may cover unchanged Scheduled Task contracts after verifying the actual task path and source applicability; they do not certify a different package archive by implication. Historical artifacts, modeled tests, and finalization Doctor alone do not substitute for those results.

Measured test cost and source limits

The table retains its recorded historical source boundaries. After the fixed-main carry, the already-landed root fixture tests are composition checks rather than feature-only changes. Their latest one-worker invocation walls were 6.14s (ordered SQLite), 66.10s (routing), and 27.24s for the seven incoming Task XML-default cases. No unchanged Node behavior tests were repeated.

Test-cost observations for PR 151608 — final Node and canonical fixture cut

Inventory: 44 distinct changed test files, verified against base 4368865c48b5f86b3274350c76d5349b95381261 and final staged tree bac34a688e3b155c5bcb63d6a15698f58fc12f86 over HEAD be3e7dccb6be221af83b0faf2d181bed56519fc0. Historical rows remain intact. N rows cover the frozen Node diagnostic postimages; B rows cover the canonical fixture/route correction and the paths measurement on the final tree. The historical extraction used existing evidence. W rows below add a current-head native Windows measurement.

Timing definitions: “case sum” adds the integer-millisecond durations printed beside passed cases. It is not independent file wall time, pure assertion-body time, or a sum suitable for predicting parallel wall time. “Shard elapsed” is Vitest’s printed Duration; “single” means that shard contains one test file, including setup/import/transform overhead. “Runner / external wall” gives the maintained runner’s total; N and B rows also give the independent invocation’s externally measured real wall, including its wrapper overhead. Historical observations do not certify current-head test cost.

Settings/source: F = historical focused-services receipt explicitly records Node 24.21.0, maintained scripts/run-vitest.mjs, --maxWorkers=1, HEAD 7220 / tree 103b93bd, exit 0; it is not current source. C = fixed436 cohort at HEAD 38347 + pending 436, staged 492755f1ed13b7f0d8c6dcad65625660ec75a0aa; later unused-import removal produced 1848 without production/assertion changes (parent execution-history binding). C and all H rows have default/unrecorded worker settings; no standalone one-worker claim. H = historical log without a verified source tuple in this extraction.

N measurement binding: windows-inspection-costs.json records the original measurement at HEAD be3e7dccb6be221af83b0faf2d181bed56519fc0 / staged tree 128f6b66e0eccbc32c94160c4d3e5993bbe72377. The Node diagnostic postimages remain frozen and unchanged in final bac34a688e3b155c5bcb63d6a15698f58fc12f86. Four separate maintained scripts/run-vitest.mjs invocations used Node 24.21.0 and explicit --maxWorkers=1; all joined under parent handle 56865, exit 0: 143 passed, 10 existing skips. The extracted test-support module has no standalone file invocation.

B measurement binding: final staged tree bac34a688e3b155c5bcb63d6a15698f58fc12f86 replaces unexecuted provisional d103 with canonical PR 158209 / 715b host-role correction and PR 158409 / efbc literal fixture routing. Exact Git blobs are 45e6484970abcaa97b7fa60cace3093dc39b12dc for the SQLite fixture producer, 093127272838b82d7cdcc984a0fac97186a20c63 for its outer test, and f9972871f8fc2d030841c77d95fcf366468694a3 for the routing test. Three separate maintained Node invocations used explicit --maxWorkers=1; parent reports processes 16939/54594 fully joined. The host test passed once and asserts all seven nested fixture outcomes; the routing test passed 96 cases, and paths passed 10. This table qualifies those measured file invocations, not the entire staged tree or native Windows campaign.

Changed test file Observed passed / skipped Case sum Shard elapsed Runner / external wall Evidence / binding
src/cli/daemon-cli.coverage.test.ts 7 / 0 8.910s 35.48s (shared) 158.81s focused-services-1/output.log · F
src/cli/daemon-cli/register-service-commands.test.ts 53 / 0 0.696s 19.82s (shared) 72.09s status-native-timeout-green.log · H
src/cli/daemon-cli/status.gather.test.ts 138 / 0 2.022s 25.30s (single) 39.38s fixed436-status-tests.log · C
src/cli/update-cli.candidate-activation.test.ts 21 / 0 23.881s 119.79s (shared) 157.18s fixed0484-canonical-fixture-tests.log · H
src/cli/update-cli.post-core-recovery.test.ts 11 / 0 9.607s 119.79s (shared) 157.18s fixed0484-canonical-fixture-tests.log · H
src/cli/update-cli.windows-lifecycle.test.ts 24 / 0 33.402s 119.79s (shared) 157.18s fixed0484-canonical-fixture-tests.log · H
src/cli/update-cli.windows-recovery.test.ts 17 / 0 6.870s 119.79s (shared) 157.18s fixed0484-canonical-fixture-tests.log · H
src/cli/update-cli/update-command-migrated-windows.test.ts 5 / 0 1.904s 19.01s (shared) 157.18s fixed0484-canonical-fixture-tests.log · H
src/cli/update-cli/update-command-service-direct-action.test.ts 2 / 0 0.011s 39.79s (shared) 64.89s fixed-168d-affected-tests.log · H
src/cli/update-cli/update-command-service-maintenance-handoff.test.ts 63 / 0 7.670s 19.01s (shared) 157.18s fixed0484-canonical-fixture-tests.log · H
src/cli/update-cli/update-command-service-maintenance.test.ts 62 / 0 0.920s 39.79s (shared) 64.89s fixed-168d-affected-tests.log · H
src/cli/update-cli/update-command-service-root-plan.test.ts 9 / 0 0.044s 39.79s (shared) 64.89s fixed-168d-affected-tests.log · H
src/cli/update-cli/update-command-service-windows-probe.test.ts 6 / 0 0.031s 39.79s (shared) 64.89s fixed-168d-affected-tests.log · H
src/cli/update-cli/update-command-service.test.ts 8 / 29 0.307s 24.41s (single) 27.89s direct-action-prefix-fixture-fixed.log · H
src/commands/doctor-gateway-legacy-services.test.ts 24 / 0 0.378s 32.40s (shared) 152.94s fixed-a682-affected-tests.log · H
src/commands/doctor-gateway-services.test.ts 79 / 0 0.212s 10.71s (single) 39.38s fixed436-status-tests.log · C
src/commands/doctor-maintenance.installation.test.ts 42 / 0 120.307s 129.42s (single) 166.15s doctor-installation-green.log · H
src/daemon/constants.test.ts 26 / 0 0.002s 343ms (single) 158.81s focused-services-1/output.log · F
src/daemon/inspect.test.ts 43 / 9 0.434s 29.11s (shared) 47.18s systemd-inline-lower-green.log · H
src/daemon/inspect.windows.test.ts 20 / 0 0.052s 29.11s (shared) 47.18s systemd-inline-lower-green.log · H
src/daemon/launchd-plist.native.test.ts 4 / 0 0.155s 33.00s (shared) 158.81s focused-services-1/output.log · F
src/daemon/paths.test.ts 10 / 0 0.001s 420ms (single, 1 worker) 1.39s / 1.78s windows-inspection-paths-cost.log · B
src/daemon/schtasks-exec.test.ts 16 / 0 0.755s 56.48s (shared) 78.27s registration-cold-query-green.log · H
src/daemon/schtasks-runtime-probe.windows.test.ts 4 / 0 0.092s 56.48s (shared) 78.27s registration-cold-query-green.log · H
src/daemon/schtasks-runtime.test.ts 27 / 0 0.360s 45.57s (shared) 72.09s status-native-timeout-green.log · H
src/daemon/schtasks-state-probe.test.ts 15 / 0 0.095s 45.57s (shared) 72.09s status-native-timeout-green.log · H
src/daemon/schtasks-state-probe.windows.test.ts 1 / 0 1.801s 2.75s (single) 71.91s (shared) Windows run 36265587963 · W
src/daemon/schtasks.env-case.real.test.ts 6 / 0 6.944s 61.31s (single) 71.91s (shared) Windows run 36265587963 · W
src/daemon/schtasks.installed-command.test.ts 6 / 0 0.440s 2.99s (single) 4.69s shared-profiled-cleanup-tests.log · H
src/daemon/schtasks.installed-package.test.ts 2 / 0 0.007s 1.41s (shared) 3.15s shared-fixture-consolidation-tests.log · H
src/daemon/schtasks.integration-xml.test.ts 4 / 0 0.003s 24.18s (single) 40.39s xml-default-fixture-tests.log · H
src/daemon/schtasks.integration.e2e.test.ts — — — — No reusable timing located in selected local targeted logs
src/daemon/schtasks.startup-fallback.test.ts 87 / 0 2.095s 56.48s (shared) 78.27s registration-cold-query-green.log · H
src/daemon/schtasks.test.ts 110 / 0 2.794s 27.87s (shared) 30.73s windows-probe-cold-budget-green.log · H
src/daemon/service-audit.definition-facts.test.ts 53 / 0 0.348s 35.56s (shared) 47.36s command-position-green3.log · H
src/daemon/service.systemd-scope.test.ts 22 / 0 0.244s 27.31s (shared) 152.94s fixed-a682-affected-tests.log · H
src/daemon/service.test.ts 75 / 0 3.964s 27.31s (shared) 152.94s fixed-a682-affected-tests.log · H
src/daemon/systemd-unit.test.ts 29 / 0 0.001s 333ms (single) 47.18s systemd-inline-lower-green.log · H
src/flows/doctor-core-checks.test.ts 26 / 0 1.566s 56.77s (single) 158.81s focused-services-1/output.log · F
src/flows/doctor-gateway-services-check.test.ts 5 / 0 0.025s 50.84s (single) 152.94s fixed-a682-affected-tests.log · H
test/scripts/check-workflows.test.ts 13 / 0 0.937s 21.14s (single) 24.19s windows-v8-workflow-tests.log · H
src/daemon/inspect.test.ts 43 / 9 0.393s 21.95s (single, 1 worker) 25.80s / 26.34s windows-inspection-inspect-green.log · N
src/daemon/inspect.windows.test.ts 20 / 0 0.059s 20.49s (single, 1 worker) 22.94s / 23.29s windows-inspection-inspect-windows-green.log · N
src/commands/doctor-gateway-legacy-services.test.ts 25 / 0 0.371s 21.48s (single, 1 worker) 24.28s / 24.59s windows-inspection-doctor-green.log · N
src/cli/daemon-cli/status.print.test.ts 55 / 1 0.123s 16.62s (single, 1 worker) 18.92s / 19.26s windows-inspection-status-green.log · N
test/non-isolated-runner.sqlite.test.ts 1 / 0 2.697s 3.88s (single, 1 worker) 4.82s / 5.18s canonical-host-fixture-green.log · B
test/scripts/test-projects-routing.test.ts 96 / 0 25.180s 66.77s (single, 1 worker) 67.54s / 67.81s canonical-fixture-routing-green.log · B

Requested cohort readback: fixed436 has 217 passed cases, shard durations of 25.30s and 10.71s, and invocation wall of 39.38s. Registration has 187 passed cases, 56.48s for the five-file daemon shard and 16.49s for the single-file CLI shard, and invocation wall of 78.27s. Shared-fixture consolidation has 18 passed cases: process-env contributes 10 case lines totaling 1ms in a 351ms single-file shard; installed-command contributes 6/350ms and installed-package 2/7ms in a shared 1.41s shard. Its invocation wall is 3.15s. XML has 15 passed cases: integration-xml contributes 4/3ms in a 24.18s single-file shard, while update-autostart has 11 cases in a 6.27s single-file shard; invocation wall is 40.39s. Companion files outside the changed-file inventory are not additional inventory rows.

Native evidence limitation: historical Windows logs windows-diagnostic-36123699024-attempt2-job-108041189490.log (tooling ca6 / candidate 629) and windows-positive-36119196910-job-108022328045.log (tooling 6eb / candidate 629) are failed cells, not current per-file cost. The retained 361191 inspection JSON records an install command at 98.127s and status command at 19.761s, but that is command wall, not full E2E test wall. The workflow’s configured one-worker / Node 26.8.2 does not establish observed CPU usage or a completed current cell. Shared native receipt 36189933355 / dff3aeb5 requires the parent/Windows owner’s exact local locator and source binding; this table does not invent one.

Concrete gaps: the authority-only installed-mode timing for src/daemon/schtasks.integration.e2e.test.ts is qualified above, while the full upgrade campaign remains incomplete; the two smaller Windows-native files now have W measurements. Multi-file shard rows lack independent per-file elapsed time. Except for the four N, three B, and two W rows, standalone one-worker timing remains unmeasured for these historical rows; retain these observations rather than relabeling them or replaying the whole campaign. The filtered 8-passed / 29-skipped service-test observation is partial coverage, not a whole-file measurement.

The routing measurement traverses the actual repository import graph to prove that compile-cache changes select generated fixtures. A static string check or isolated mock would not establish this edge. The 67.81s wall is retained as the cost of that meaningful routing proof, separate from its 25.180s sum of printed case durations.

The installed native workflow still requires completed upgrade and final Task-authority receipts. The two smaller Windows-native timing gaps are filled by the exact-head W run; the separately bound authority-only integration timing is recorded above and does not qualify the uncompleted published-updater cells.

The routing file's 67.81-second standalone wall time includes the real repository dependency graph needed to prove generated imports select this fixture; a string assertion or isolated mock would not protect that selection. The older slow maintenance/lifecycle cohorts exercise actual installer, migration and interruption boundaries rather than replacing their owners with mocks. Native Windows files require their platform and owned Task/process settlement; their measured partial-run timings are retained without claiming complete-file qualification.

The installed-allowance follow-up used one explicit-worker invocation over four relevant files: 21 passed and one existing platform skip in 123.53 seconds maintained wall (124.50 seconds external), including 60.846 seconds of worker preparation. The installed-package file has three cases totaling 1.386 seconds; the unchanged command helper has six cases totaling 0.991 seconds. Those two files shared an 11.38-second daemon shard, so these are not separate file wall measurements. The native E2E registration changed only its installed-mode allowance; no new lower native run is claimed.

@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime cli CLI command changes size: XL maintainer Maintainer-authored PR labels Sep 18, 2026
@steipete
steipete marked this pull request as ready for review September 18, 2026 08:09
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 18, 2026
@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 27, 2026, 5:41 AM ET / 09:41 UTC (Revision 53).

ClawSweeper review

What this changes

The branch adds registered Windows Task inspection, service discovery, profile and deadline handling, plus Doctor and status guidance and native proof workflows.

Merge readiness

⛔ Blocked before merge - 6 items remain

Keep this PR open. Native Windows evidence supports the strict reader and Task authority checks, but ordinary Gateway status still bypasses the registered-action read. Published-updater completion also remains unqualified under the repository's update-proof policy.

Priority: P2
Reviewed head: 8a184400b4cfc177f8365af4f4bbc46e7cf25072
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Strong native boundary evidence supports the reader, but the selected-status wiring gap and unresolved upgrade qualification limit merge readiness.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): Windows native runs exercise the registered-command reader through installed-service checks and show after-fix Task authority effects, including refusal before foreign or reassigned Task changes. Ordinary status with a divergent registered launcher remains a correctness finding, and published-updater command completion remains a separate upgrade gate; no stored-data contract changes were identified.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): Windows native runs exercise the registered-command reader through installed-service checks and show after-fix Task authority effects, including refusal before foreign or reassigned Task changes. Ordinary status with a divergent registered launcher remains a correctness finding, and published-updater command completion remains a separate upgrade gate; no stored-data contract changes were identified.
Evidence reviewed 11 items Current main still reads the default Windows launcher: The current-main reader starts from resolveTaskScriptPath and does not inspect the registered action in its ordinary command path.
New registered read is conditional: The proposed reader probes Task Scheduler only when requireLoaded is set; otherwise it can fall through to the default script path.
Ordinary status does not request the registered read: The status entry point passes only its ordinary environment and timeout arguments to the shared service-state reader.
Findings 1 actionable finding [P2] Read the registered Task action for ordinary Gateway status
Security None None.

How this fits together

OpenClaw reads launchd, systemd, or Windows Task Scheduler to describe installed Gateway services and decide whether an update may control one. Those observations feed CLI status and Doctor diagnostics and the updater's stop and restart decisions.

flowchart LR
  A[Installed service definition] --> B[Platform service reader]
  B --> C{Command and profile verified?}
  C -->|Yes| D[Gateway status and Doctor]
  C -->|Yes| E[Update service admission]
  C -->|Unknown| F[Inspection warning]
  E --> G[Native stop or restart]
Loading

Decision needed

Question Recommendation
Does this branch's changed Windows update-inspection path require a completed published-updater-to-final-candidate cell before merge, despite the PR body's narrower qualification claim? Require published upgrade proof: Complete a published-updater transition with observable command settlement, service state, and cleanup for the final candidate.

Why: Root repository policy calls for published-driver × candidate proof for update and service-lifecycle changes, while the available 9.3 and 9.4 receipts do not complete that transition; an exception needs explicit maintainer intent.

Before merge

  • Read the registered Task action for ordinary Gateway status (P2) - Late discovery on this unchanged reviewed head: the new Task probe runs only with requireLoaded, but ordinary gateway status calls the service-state reader without that option. A registered Task can point to another launcher or profile while the default script remains, so status still reports or probes the wrong Gateway. Wire the status entry point to the registered read and preserve unknown-inspection reporting.
  • Resolve merge risk (P1) - Existing Windows installations with edited or unreadable Task definitions may now skip updater service control and need an operator restart. The final candidate has no completed published-updater transition establishing command settlement and Gateway recovery.
  • Complete next step (P2) - Repair ordinary Windows status so it reads the registered Task action, then resolve the final-candidate published-updater proof gate before merge.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.

Findings

  • [P2] Read the registered Task action for ordinary Gateway status — src/daemon/schtasks-layout.ts:435-437
Agent review details

Security

None.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

Metric Value Why it matters
Production versus proof growth production +1,360/-554; test/support +7,714/-1,324 The PR attributes the growth to one shared reader and native boundary proof, making owner-level review especially valuable.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-gateway-legacy-services.ts, migration/backfill/repair: src/flows/doctor-core-checks.ts, migration/backfill/repair: src/flows/doctor-gateway-services-check.ts, unknown-data-model-change: src/flows/doctor-core-checks.ts, unknown-data-model-change: src/flows/doctor-gateway-services-check.ts, unknown-truncated-pull-files. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Qualify a released upgrade (recommended)
    After correcting selected status, demonstrate the final candidate with a published Windows updater and retain the command, Gateway, and cleanup outcomes.
  2. Accept operator recovery
    A maintainer can expressly accept the unresolved released-driver behavior and document when operators must restart the Gateway manually.

Technical review

Best possible solution:

Use the registered Task action and its resolved profile for selected Windows diagnostics while retaining typed unknown results and foreign-task refusals, then qualify the final candidate against a published updater.

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

Yes, the remaining status gap is source-reproducible: point a registered Task at a different launcher or profile while a default launcher remains, and ordinary status still reads the default path. This read-only review did not run that native scenario.

Is this the best way to solve the issue?

No. The strict reader is the right owner, but ordinary selected status must request its registered-action path before using the command as Gateway target context.

Full review comments:

  • [P2] Read the registered Task action for ordinary Gateway status — src/daemon/schtasks-layout.ts:435-437
    Late discovery on this unchanged reviewed head: the new Task probe runs only with requireLoaded, but ordinary gateway status calls the service-state reader without that option. A registered Task can point to another launcher or profile while the default script remains, so status still reports or probes the wrong Gateway. Wire the status entry point to the registered read and preserve unknown-inspection reporting.
    Confidence: 0.9
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.89

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (linked_artifact): Windows native runs exercise the registered-command reader through installed-service checks and show after-fix Task authority effects, including refusal before foreign or reassigned Task changes. Ordinary status with a divergent registered launcher remains a correctness finding, and published-updater command completion remains a separate upgrade gate; no stored-data contract changes were identified.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove merge-risk: 🚨 security-boundary: Current PR review merge-risk labels are merge-risk: 🚨 compatibility, merge-risk: 🚨 availability.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: ⏳ waiting on author.

Label justifications:

  • P2: This is a bounded service-inspection repair with meaningful Windows operator impact and a remaining diagnostic wiring defect.
  • merge-risk: 🚨 compatibility: Stricter inspection can turn previously managed custom Task definitions into unavailable update states.
  • merge-risk: 🚨 availability: An update may proceed without verified service control, while the published-updater transition has not completed.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (linked_artifact): Windows native runs exercise the registered-command reader through installed-service checks and show after-fix Task authority effects, including refusal before foreign or reassigned Task changes. Ordinary status with a divergent registered launcher remains a correctness finding, and published-updater command completion remains a separate upgrade gate; no stored-data contract changes were identified.
  • proof: sufficient: Contributor real behavior proof is sufficient. Windows native runs exercise the registered-command reader through installed-service checks and show after-fix Task authority effects, including refusal before foreign or reassigned Task changes. Ordinary status with a divergent registered launcher remains a correctness finding, and published-updater command completion remains a separate upgrade gate; no stored-data contract changes were identified.

Evidence

What I checked:

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Cover ordinary Gateway status with a registered Task action that differs from the default launcher, and repair the call path.
  • Resolve the published-updater proof requirement for the final candidate with explicit command and service outcomes.

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 (52 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-26T19:34:47.150Z sha c0f54ab :: needs real behavior proof before merge. :: [P3] Record the installed Windows integration test cost
  • reviewed 2026-09-26T20:46:04.882Z sha ec74258 :: needs real behavior proof before merge. :: [P3] Record the installed Windows integration test cost
  • reviewed 2026-09-27T00:38:59.356Z sha e5d7bda :: needs real behavior proof before merge. :: [P3] Record the installed Windows integration test cost
  • reviewed 2026-09-27T01:37:43.004Z sha e5d7bda :: needs real behavior proof before merge. :: [P3] Record the installed Windows integration test cost
  • reviewed 2026-09-27T02:19:00.493Z sha e5d7bda :: needs real behavior proof before merge. :: [P3] Record the installed Windows integration test cost
  • reviewed 2026-09-27T02:54:28.085Z sha 8a18440 :: blocked before merge. :: none
  • reviewed 2026-09-27T03:03:07.433Z sha 8a18440 :: blocked before merge. :: none
  • reviewed 2026-09-27T03:27:33.853Z sha 8a18440 :: blocked before merge. :: none

@steipete
steipete force-pushed the codex/recovery-split-windows branch from bc8cacd to 360f2dd Compare September 18, 2026 09:52
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation commands Command implementations labels Sep 18, 2026
@steipete
steipete force-pushed the codex/recovery-split-service-inventory branch from 23966f8 to 19d63ff Compare September 18, 2026 19:00
@openclaw-barnacle openclaw-barnacle Bot removed docs Improvements or additions to documentation commands Command implementations labels Sep 18, 2026
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.
@steipete
steipete force-pushed the codex/recovery-split-service-inventory branch from 19d63ff to 8628748 Compare September 24, 2026 16:40
@steipete steipete changed the title fix: retain complete native Gateway service discovery fix(daemon): inspect registered Gateway services accurately Sep 24, 2026
@steipete
steipete changed the base branch from codex/recovery-split-windows to main September 24, 2026 16:42
@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 24, 2026
steipete added a commit that referenced this pull request Sep 26, 2026
Merge the qualified service base from #151608 and retain exact CMD/VBS
Startup identity through the canonical state reader. Carry the private
profile facts from #152875 so explicit CLI profiles win over saved defaults.
Keep the caller's absolute deadline, including an already expired allowance,
and preserve the existing joined native inspection and updater diagnostics.
Receive main 2746686 for the canonical OpenRouter guard repair without changing this PR's feature patch. Preserve the reviewed Windows reader sources and receive the POSIX managed-helper inspection fix with its 86-case proof.
Carry main 2b2ae31 after CI exposed a retired declaration-diagnostics
fixture hook. All service-inventory feature postimages and the stable
patch remain unchanged. The current emitter-bound SDK suite passes
26 cases and declaration-boundary proof passes 14 with 3 platform skips.
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.
steipete added a commit that referenced this pull request Sep 26, 2026
Control both same-window and split-window admission schedules instead of
assuming every upsert batch coalesces within 20 ms. Keep exact delivery,
read-receipt, durable-claim, and socket-close assertions and release held
work even when an assertion fails.

The original expectation fails deterministically when the third append
crosses the debounce window. Production behavior is unchanged.

Related: #151608
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.
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Sep 27, 2026
@steipete steipete closed this Sep 27, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants