Skip to content

fix(agents): replies stall when a chat is marked read as a turn starts - #158209

Merged
roboclaw-bot merged 5 commits into
mainfrom
openclaw/context-engine-outbox-admission-20260925
Sep 25, 2026
Merged

roboclaw-bot merged 5 commits into
mainfrom
openclaw/context-engine-outbox-admission-20260925

Conversation

@IWhatsskill

@IWhatsskill IWhatsskill commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: a reply stalls for about 10 seconds before the model starts, and the Gateway stops responding for that time, when a chat is marked read while the durable context engine advances the previous turn. It shows up in the Control UI chat with a durable context engine such as lossless-claw.

User Impact

User impact: Control UI replies start without the 10-second pause, and other chats on the same Gateway stay responsive. The durable context engine keeps its own path for these turns, so it no longer falls back to the legacy engine.

No configuration, schema, stored payload, durability, retention, permission, or plugin contract change.

Why This Change Was Made

Session entry writes, such as the read marker from sessions.patch, run in the SQLite worker. The worker holds the write lock while it waits for the host thread to grant its commit. The durable turn outbox ran its SQLite synchronously on the host thread, so its busy wait blocked the thread that had to grant the worker's commit. Both then waited until the busy timeout, which ran twice (delete, then the error-path update).

Following worker access, the outbox now runs its SQLite in the agent database worker through the existing openOpenClawAgentSqliteWorkerStore, modeled on the heartbeat outcome store. The host thread only awaits prepared results.

  • Before a run: one worker transaction recovers the session's rows, checks for advanceable work, and records the known admission when nothing is pending. The drain runs only when rows are pending.
  • After a turn: acceptance commits in its own worker transaction. The closed-range read and ready/blocked publication follow in a second one, so a failed read, publication, or commit leaves the turn accepted, and the next recovery advances it, as on main. engine.commitTurn() stays outside any transaction. The acknowledgment (delete) or failure record is then a worker transaction.
  • Discards of unaccepted intents run in the worker and are awaited by the runner.
  • The recorder's admission handler may now return its write:
    • Persistence awaits it.
    • waitForRuntimePersistence settles it before dispatch and rejects if it failed, so the turn owner stops before provider dispatch instead of running without a durable intent.
    • A write reported from inside a session write lane (markRuntimePersisted from the session guard) starts detached, so it queues behind that lane instead of reentering it.
  • Incognito agent databases keep their single in-memory owner and run the same kernels inside write admission, as the heartbeat store does.

The outbox kernels are unchanged apart from taking a connection. readClosedTranscriptTurnInDatabase reads through the worker's connection. The lazy outbox DDL is recorded as installed for a connection once its transaction commits, so later worker commands skip it. contextEngineTurnOutbox is registered as a runtime worker entrypoint.

Storage review checkpoint: this changes execution placement and writer admission only.

  • FIFO ordering comes from the existing store writer queue.
  • Current authority is rechecked through the captured agent database execution.
  • Every write is awaited.

Evidence

Verified head: 7572332c8d3abc17b9a6a8f7f8975325acc4e7ca.

  • CI passed: run 36194155201, 152 successful jobs and 18 planned skips. The required openclaw/ci-gate also passed.
  • Review: ClawSweeper's exact-head review found no actionable defects and marked the PR ready for maintainer review. Independent AutoReview covered the admission fix, dead-code cleanup, and final fixture correction; substantive findings were resolved or rejected with source/caller evidence. No production changes followed that review.
  • Additional focused validation: 39 tests passed across the three files below in 50.49 seconds wall time. They cover provider dispatch, synchronous/asynchronous admission failures, worker queue ordering, accepted-turn recovery, and outbox cleanup. For this run, the successful admission case was temporarily expanded to four model calls and three real tool executions; admission ran once and the user message was not duplicated. That temporary expansion was restored afterward and is not an additional committed test.
node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/attempt-prompt-submit.admission.test.ts src/agents/harness/context-engine-turn-attempt.test.ts src/agents/harness/context-engine-turn-outbox.test.ts --maxWorkers=1
  • Isolated Gateway smoke on the same head: the CLI runtime build passed. Five chat turns completed through chat.send, agent.wait, and chat.history, with 15 model requests, 10 tool executions, and five distinct context-engine advancement callbacks. Two concurrent sessions.patch loops performed 247 read-marker updates alongside 400 health requests. No database-lock errors, legacy fallback, or delayed-liveness warnings were observed. The outbox was empty afterward; SQLite integrity and foreign-key checks passed. The Gateway, SQLite workers, tool execution, and RPCs were real; the model and context engine were synthetic fixtures.
  • Earlier focused proof: 130 selected production/cleanup tests plus the corrected SQLite-cleanup fixture passed. The fixture correction adds isMainThread: true to its existing host-thread mock without changing its seven assertions; its final CI test cost was 3.173 seconds. The admission fix and fixture correction have recorded red/green evidence. Targeted types, lint, formatting, unused-code scans, and git diff --check passed.

Limits

  • The originally affected long-lived Gateway has not been tested with this build. The fresh-state Gateway smoke is not a deterministic reproduction of that installation's stall, a live-model test, or a before/after performance benchmark. The original live trace and failing-before/passing-after regressions support the defect mechanism.
  • The local combined changed-check command stopped at the existing agents-root 721/720 baseline budget. The budget and guards were not weakened; targeted checks and the final GitHub CI passed. The combined local command is not claimed green.
  • The earlier full integration suite was not run to completion locally; only its affected canonical-descendant case was selected and verified. Full-suite local success is not claimed.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M labels Sep 25, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 25, 2026
@clawsweeper

clawsweeper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 25, 2026, 6:23 PM ET / 22:23 UTC (Revision 7).

ClawSweeper review

What this changes

Moves durable context-engine turn records into the agent database worker and waits for transcript admission before sending a prompt to the model.

Merge readiness

✅ Ready for maintainer review

Current main and the latest release retain the synchronous outbox path implicated in the reported Gateway stall. The proposed worker migration remains useful; the earlier blocking findings are addressed, and this review found no new actionable defect.

Priority: P1
Reviewed head: 7572332c8d3abc17b9a6a8f7f8975325acc4e7ca

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Relevant Gateway evidence and recovery tests support a sound worker migration, with the originally affected installation still untested.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (logs): The moved outbox is reached by chat.send. The PR reports an isolated Gateway run with lossless-claw and Ollama: eight replies completed during 3,186 sessions.patch read-marker writes without locks or legacy fallback. Later admission changes have focused dispatch tests; the final commit changes only a fixture. The original long-lived Gateway remains untested. No stored-data contract changes, so migration proof is not applicable.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): The moved outbox is reached by chat.send. The PR reports an isolated Gateway run with lossless-claw and Ollama: eight replies completed during 3,186 sessions.patch read-marker writes without locks or legacy fallback. Later admission changes have focused dispatch tests; the final commit changes only a fixture. The original long-lived Gateway remains untested. No stored-data contract changes, so migration proof is not applicable.
Evidence reviewed 8 items Current main retains synchronous access: The before-run path opens the agent database and directly recovers and drains the outbox on the caller thread; the central files are unchanged from the PR merge base.
Latest release retains the path: The supplied v2026.9.6 tag also opens and drains the outbox in the caller path.
Feature history: Recent merged work on durable context-engine turns includes background maintenance, model-budget preservation, and blocked-row handling. This identifies routing candidates, not the introduction of the reported stall.
Findings None None.
Security None None.

How this fits together

OpenClaw stores chat turns in an agent SQLite database and advances a selected context engine from a durable turn outbox. Read-marker updates share that database, while outbox recovery affects when the next reply can start.

flowchart LR
A[Chat message] --> B[Transcript admission]
C[Read marker update] --> D[Agent database writer queue]
B --> D
D --> E[Turn outbox worker]
E --> F{Earlier turn pending?}
F -->|Yes| G[Context engine advancement]
F -->|No| H[Model reply]
G --> H
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +490, Tests +618, Other +4. Total +1112 across 22 files.

View PR surface stats
Area Files Added Removed Net
Source 13 710 220 +490
Tests 7 649 31 +618
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 4 0 +4
Total 22 1363 251 +1112

Review metrics

Metric Value Why it matters
After-fix Gateway run 8 chat turns; 3,186 read-marker patches; 0 lock failures The author exercised the affected runtime path under overlapping database writes.

Technical review

Best possible solution:

Keep outbox SQL under the admitted agent database worker while preserving turn ordering, recovery, and stored payloads during concurrent read-marker writes.

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

No deterministic current-main reproduction was established in the fresh-state harness. The captured long-lived Gateway failure trace and current main's synchronous outbox path support the reported mechanism.

Is this the best way to solve the issue?

Yes. The patch uses the existing agent database worker and preserves the durable outbox format and recovery contract, with focused checks for admission and publication failures.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The reported race stalls replies for about ten seconds and briefly leaves the shared Gateway unresponsive.
  • merge-risk: 🚨 session-state: Outbox ordering and accepted-turn recovery determine which transcript turns reach the durable context engine.
  • merge-risk: 🚨 availability: The worker scheduling change addresses a Gateway event-loop stall, so concurrency behavior deserves attention at merge.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The moved outbox is reached by chat.send. The PR reports an isolated Gateway run with lossless-claw and Ollama: eight replies completed during 3,186 sessions.patch read-marker writes without locks or legacy fallback. Later admission changes have focused dispatch tests; the final commit changes only a fixture. The original long-lived Gateway remains untested. No stored-data contract changes, so migration proof is not applicable.
  • proof: sufficient: Contributor real behavior proof is sufficient. The moved outbox is reached by chat.send. The PR reports an isolated Gateway run with lossless-claw and Ollama: eight replies completed during 3,186 sessions.patch read-marker writes without locks or legacy fallback. Later admission changes have focused dispatch tests; the final commit changes only a fixture. The original long-lived Gateway remains untested. No stored-data contract changes, so migration proof is not applicable.

Evidence

What I checked:

Likely related people:

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

Rating scale

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

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (6 earlier review cycles)
  • reviewed 2026-09-25T16:39:27.335Z sha 87795b7 :: blocked before merge. :: none
  • reviewed 2026-09-25T17:10:31.261Z sha 87795b7 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-25T19:37:15.992Z sha fe4797a :: blocked before merge. :: [P1] Persist accepted turns before fallible publication | [P1] Stop dispatch when outbox admission fails | [P2] Install the outbox schema before worker commands
  • reviewed 2026-09-25T20:51:01.192Z sha 088db34 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-25T21:54:21.617Z sha 80ea107 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-25T22:04:11.473Z sha 7572332 :: needs maintainer review before merge. :: none

@IWhatsskill IWhatsskill self-assigned this Sep 25, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Sep 25, 2026
@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XL and removed size: M labels Sep 25, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 25, 2026
@IWhatsskill
IWhatsskill force-pushed the openclaw/context-engine-outbox-admission-20260925 branch from fe4797a to 3b7a46a Compare September 25, 2026 20:27
The durable context-engine turn outbox ran its SQLite on the host thread. When a worker transaction, such as the read marker from sessions.patch, held the write lock while waiting on the host for its commit grant, the host's busy wait stalled both until the busy timeout, about 10 s per Control UI turn.

Run the outbox in the agent database worker through openOpenClawAgentSqliteWorkerStore. A run's start recovers, checks and admits in one worker transaction; acceptance commits before the closed-range read and publication; engine.commitTurn stays outside any transaction; the lazy outbox DDL is recorded once per connection. The transcript recorder settles its admission write before dispatch, rejects when it fails, and starts a write reported inside a session write lane detached so it queues behind that lane.
@IWhatsskill
IWhatsskill force-pushed the openclaw/context-engine-outbox-admission-20260925 branch from 3b7a46a to 088db34 Compare September 25, 2026 20:43
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 25, 2026
roboclaw-bot and others added 3 commits September 25, 2026 21:16
Remove obsolete direct-database drain and transcript-reader paths left behind by the worker migration; exercise the canonical owners in the existing tests.

Co-authored-by: IWhatsskill <[email protected]>
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

Keep the forbidden Worker constructor while matching the compile-cache thread imports introduced on main.

Co-authored-by: IWhatsskill <[email protected]>
@roboclaw-bot

roboclaw-bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Final maintainer verification for 7572332:

  • Findings and repairs: outbox SQL now uses the agent database worker; context-engine-turn-attempt.ts retains accepted turns across publication failures. user-turn-transcript-admission-write.ts captures synchronous handler failures, and attempt-prompt-submit.ts waits before provider dispatch. Obsolete direct-database paths were removed. The final change only adds isMainThread: true to test/non-isolated-runner.sqlite-fixtures.ts.
  • Reviews and source: inspected the AutoReview dispositions and ClawSweeper's exact-head review, plus the recorder, provider boundary, worker ordering, and recovery coverage. Security guards, dependencies, schema, stored payloads, permissions, and public plugin contracts are unchanged.
  • Review status: no actionable findings remain. ClawSweeper reviewed this exact head at 2026-09-25 22:23 UTC, within the repository's 12-hour completion window. No production changes followed the reviewed head.
  • Executed checks: node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/attempt-prompt-submit.admission.test.ts src/agents/harness/context-engine-turn-attempt.test.ts src/agents/harness/context-engine-turn-outbox.test.ts --maxWorkers=1 passed 39/39 tests in 50.49 seconds. The successful admission case was temporarily expanded to three tool iterations and restored after proving four provider calls, one admission, and no duplicate user entry. The CLI runtime build and git diff --check also passed.
  • Behavior and limits: the PR body records the earlier red/green evidence and additional isolated Gateway smoke: 5 turns, 15 model requests, 10 tool executions, 247 concurrent read-marker writes, and 400 health requests. No database locks or legacy fallback; outbox empty and SQLite integrity checks passed. The model/context engine were synthetic fixtures, not a live-model or original long-lived-installation test. The documented local agents-root 721/720 baseline failure remains; the combined local check and full local integration suite are not claimed green.
  • CI and merge procedure: exact-head CI passed with 152 successful jobs and 18 planned skips; required openclaw/ci-gate checks passed. Native review artifacts validated and prepare-run completed without changing or pushing the head. Preparation uses the enforced GitHub-gate mode. Merge has not yet been submitted; the next step is the native head-pinned squash workflow with normal repository gates.

@roboclaw-bot
roboclaw-bot merged commit 715b24a into main Sep 25, 2026
248 checks passed
@roboclaw-bot
roboclaw-bot deleted the openclaw/context-engine-outbox-admission-20260925 branch September 25, 2026 22:44
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Merged via squash.

steipete added a commit to DonnieFi/openclaw that referenced this pull request Sep 26, 2026
Replace the provisional physical-thread metadata with the logical-host
fixture contract from merged openclaw#158209. Preserve every cleanup assertion and
the forbidden Worker constructor.

Carry merged openclaw#158409's literal dependency resolvers, caller update and
selection regression. Exact canonical postimages, the ordered cleanup case,
dependency-selection case, selected checks and independent review pass.
steipete added a commit that referenced this pull request Sep 26, 2026
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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 26, 2026
openclaw#158209)

* fix(agents): replies stall when a chat is marked read as a turn starts

The durable context-engine turn outbox ran its SQLite on the host thread. When a worker transaction, such as the read marker from sessions.patch, held the write lock while waiting on the host for its commit grant, the host's busy wait stalled both until the busy timeout, about 10 s per Control UI turn.

Run the outbox in the agent database worker through openOpenClawAgentSqliteWorkerStore. A run's start recovers, checks and admits in one worker transaction; acceptance commits before the closed-range read and publication; engine.commitTurn stays outside any transaction; the lazy outbox DDL is recorded once per connection. The transcript recorder settles its admission write before dispatch, rejects when it fails, and starts a write reported inside a session write lane detached so it queues behind that lane.

* fix(agents): await turn admission before provider dispatch

Co-authored-by: IWhatsskill <[email protected]>

* test(agents): avoid overlapping worker test registrations

Co-authored-by: IWhatsskill <[email protected]>

* fix(agents): retain synchronous turn admission failures

Remove obsolete direct-database drain and transcript-reader paths left behind by the worker migration; exercise the canonical owners in the existing tests.

Co-authored-by: IWhatsskill <[email protected]>

* test: declare host thread in SQLite cleanup fixture

Keep the forbidden Worker constructor while matching the compile-cache thread imports introduced on main.

Co-authored-by: IWhatsskill <[email protected]>

---------

Co-authored-by: IWhatsskill <[email protected]>
steipete added a commit that referenced this pull request Sep 27, 2026
* 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.

* 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): 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(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.

* test(windows): handle omitted scheduled task settings

* test(windows): preserve native context and failure evidence

* test(daemon): wait for installed gateway readiness before inspection

* test(daemon): stop installed fixtures through their profiled CLI

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

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

* test(windows): budget installed service phases and retain 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.

* 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(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): 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(daemon): cover retained Task ownership refusal

* test(windows): preserve XML bytes around enabled export lines
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 28, 2026
…#151608)

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

* 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): 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(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.

* test(windows): handle omitted scheduled task settings

* test(windows): preserve native context and failure evidence

* test(daemon): wait for installed gateway readiness before inspection

* test(daemon): stop installed fixtures through their profiled CLI

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

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

* test(windows): budget installed service phases and retain 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.

* 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(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): 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(daemon): cover retained Task ownership refusal

* test(windows): preserve XML bytes around enabled export lines
steipete added a commit that referenced this pull request Sep 28, 2026
* 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.

* 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(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.

* test(windows): honor omitted task XML defaults

Use the existing task XML setter for disabled installed fixtures and
normalize only the task-level Enabled setting in the enable roundtrip.
Keep all other definition, native state, cleanup, and sibling build
refusal assertions intact.

Co-authored-by: Donnie Fiander <[email protected]>

* test: preserve native and npm fixture environment

Use the canonical native service environment projection for installed Windows
fixtures, retaining private application and npm paths with case-aware overrides.
Keep credentials and Node options outside the projection.

Apply the exact isolated npm global-config fixture correction from #158197 so
version-selection tests reach their existing assertions after config discovery.

Validation: 16 focused cases, all selected changed checks, and independent P2
review passed. Product and dependency inputs are unchanged; Windows installed
upgrade and sibling-build qualification remains outstanding.

* test(windows): await installed readiness before status checks

Use the existing HTTP startup-readiness owner after install and update, while
retaining strict one-shot status, build identity, and sibling continuity checks.

Stop registered fixture services through the guarded owner before deleting Task
definitions. Proven absence skips only stop; unknown inspection or stop failure
retains the error and cleanup authority instead of bypassing the guard.

Validation: source-identical readiness/stop owner proof (71 cases), affected
services types, lint, formatting and ratchets passed. Fresh P2 review's request
to delete after failed stop was rejected against the retained-authority contract.
Native Windows completion remains unqualified; no deadline or assertion changed.

* fix(tests): wait for queued RPC admission before restart

Await the exact terminal chat event after deferred registration before
releasing the held first response. Preserve the actual queue assertion,
all delivery and restart checks, and the overall test deadline.

Refs #150153
Refs #152875

Source-equivalent carry of #158347 (4713210).

* test(windows): stop installed fixtures in their own profile

Invoke the guarded installed CLI through the existing managed command owner,
using the admitted Task entry, profile and environment. Vitest's synthetic
ambient state must not decide whether that Task can be stopped.

Keep the existing 180-second command lifetime and child join, without inheriting
an already-aborted test-body signal during cleanup. Unknown registration and
failed stop still retain authority; proven absence skips only stop.

Validation: affected services types, lint, formatting and independent P2 review
passed. Shared command-owner proof remains retained. Native completion is still
pending; no service guard, process assertion or test deadline was weakened.

* 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]>

* test: preserve threaded SQLite cleanup fixture metadata

Carry the exact qualified d103e23/#158407 fixture correction for incoming
compile-cache initialization. The non-isolated harness runs in threads;
retain its false/null metadata and forbidden Worker constructor without
changing assertions, order, or timeouts.

* test: align SQLite lifecycle proof with canonical host contract

Replace the provisional physical-thread metadata with the logical-host
fixture contract from merged #158209. Preserve every cleanup assertion and
the forbidden Worker constructor.

Carry merged #158409's literal dependency resolvers, caller update and
selection regression. Exact canonical postimages, the ordered cleanup case,
dependency-selection case, selected checks and independent review pass.

* test(windows): preserve installed command budgets and progress

The aggregate 240-second fixture deadline cut the published updater short
before its existing 180-second command budget. Allocate installed cells
360/900/900 seconds and matching 10/19/19-minute Actions envelopes, including
the existing teardown and runner margin. Source-native and command limits,
assertions, and the quiet watchdog stay unchanged.

Reuse the existing durable recorder for real phase progress, preserving
original failures and emitting only fixed labels. The Task-only 9.4 cell
needs one sibling fence, with no Startup fingerprint allowance.

The 32 focused cases, selected types and export scans, workflow validation,
owned lint, and independent review pass. Retain the unchanged main replay
lint-cap failure separately. Production and dependency inputs are unchanged.

* test(windows): retain installed updater failure progress

Read the isolated selected service update ledger before native fixture cleanup and retain only phase and step metadata. Preserve the original updater error and all existing execution budgets.\n\nValidation: 15 focused tests, incremental changed-file checks, and independent review passed. The moving-main ratchet failure on three untouched older files is retained separately.

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

* fix(daemon): ignore unrelated registered task profiles

Read-only Scheduled Task discovery can inspect a static unrelated command
without requiring an OpenClaw profile. Keep selected-service profile checks
strict, and preserve launcher, registration and deadline revalidation.

The installed Windows fixture exposed a false Doctor finding for a Helper
that only runs node.exe --version. Add its causal collector regression and
retain the selected-service rejection assertion. Receive the canonical
2b2ae31 SDK fixture fix so mutation occurs after real declaration emission.

Receiving tests and core/services/SDK types pass; focused lint and P2 review
are clean. The full changed gate still encounters the inherited OpenRouter
suppression defect already repaired on main. The production change requires
new package acceptance and native Windows proof before landing.

* fix(build): give external recovery steps for stale dist

The live-build refusal now names an external stop, successful rebuild, and
start sequence for every matching service. Explain that an already-current
update does not rebuild stale output, and document the default-profile
commands with failure-short-circuiting in the source update guide.

This changes guidance only, without altering admission or lifecycle policy.
The existing fence suite passes 37 cases with one platform skip; focused
lint, formatting and independent P2 review are clean.

* test(daemon): observe published updater settlement

Record launcher, command, and output lifecycle timestamps for the published
update command. After its current ledger run becomes terminal, retain at
most two bounded and sanitized process snapshots with creation and CPU/I/O
facts. Fence progress and snapshots to that same run; observations neither
refresh progress nor change command, cleanup, or watchdog budgets.

This diagnoses a published 9.3 command that timed out after its candidate
reported successful activation and verification. Preserve the failure and
avoid inferring early process exit from post-timeout cleanup observations.

34 focused cases, services types, scoped lint, formatting, and independent
P2 review pass. Native diagnostic execution remains required.

* fix(daemon): recognize the released waiting task launcher

Accept the exact waiting VBS form generated by the published 2026.9.3
installer during an owned service-definition audit. Keep custom launcher
behavior classified as an unknown edit and preserve all selector, command,
root, and native authority checks.

Receive the three reviewed postimages from ec74258. The actual audit
regression fails on the original implementation; 55 receiving cases pass.
The shared owner also verified 140 backup/rewrite cases, core/services types,
scoped lint and P2 review. This repairs the observed reconciliation warning;
it does not claim to explain the independent updater settlement timeout.

* test(daemon): sample unsettled updates before the command deadline

Keep the same two-snapshot cap, current-run binding and progress behavior. Capture an unfinished run at 300 seconds so a slower installation cannot prevent all process observations. Rename the diagnostic field to reflect both active and terminal observations. The original observer regression fails; 25 cases, scoped lint/types and independent P2 review pass. Command and cleanup budgets are unchanged.

* test(daemon): preserve CRCRLF task export comparisons

* fix(windows): enable a verified disabled task on explicit start

Receive the shared selected-service start repair, preserving published command fingerprints and optional Enabled metadata behavior. Keep the finalization process fixture's real entrypoint exports available. Source-build recovery ownership remains unchanged.

* docs(windows): clarify explicit start partial effects

Document that successful enablement remains an audited effect when the later launch fails. Preserve the existing explicit-start contract and require inspection before retrying; do not imply rollback after authority loss.

* docs: clarify source CLI recovery uses the existing build

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Donnie Fiander <[email protected]>
steipete added a commit that referenced this pull request Sep 28, 2026
* 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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
…w#152875)

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

* 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(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.

* test(windows): honor omitted task XML defaults

Use the existing task XML setter for disabled installed fixtures and
normalize only the task-level Enabled setting in the enable roundtrip.
Keep all other definition, native state, cleanup, and sibling build
refusal assertions intact.

Co-authored-by: Donnie Fiander <[email protected]>

* test: preserve native and npm fixture environment

Use the canonical native service environment projection for installed Windows
fixtures, retaining private application and npm paths with case-aware overrides.
Keep credentials and Node options outside the projection.

Apply the exact isolated npm global-config fixture correction from openclaw#158197 so
version-selection tests reach their existing assertions after config discovery.

Validation: 16 focused cases, all selected changed checks, and independent P2
review passed. Product and dependency inputs are unchanged; Windows installed
upgrade and sibling-build qualification remains outstanding.

* test(windows): await installed readiness before status checks

Use the existing HTTP startup-readiness owner after install and update, while
retaining strict one-shot status, build identity, and sibling continuity checks.

Stop registered fixture services through the guarded owner before deleting Task
definitions. Proven absence skips only stop; unknown inspection or stop failure
retains the error and cleanup authority instead of bypassing the guard.

Validation: source-identical readiness/stop owner proof (71 cases), affected
services types, lint, formatting and ratchets passed. Fresh P2 review's request
to delete after failed stop was rejected against the retained-authority contract.
Native Windows completion remains unqualified; no deadline or assertion changed.

* fix(tests): wait for queued RPC admission before restart

Await the exact terminal chat event after deferred registration before
releasing the held first response. Preserve the actual queue assertion,
all delivery and restart checks, and the overall test deadline.

Refs openclaw#150153
Refs openclaw#152875

Source-equivalent carry of openclaw#158347 (4713210).

* test(windows): stop installed fixtures in their own profile

Invoke the guarded installed CLI through the existing managed command owner,
using the admitted Task entry, profile and environment. Vitest's synthetic
ambient state must not decide whether that Task can be stopped.

Keep the existing 180-second command lifetime and child join, without inheriting
an already-aborted test-body signal during cleanup. Unknown registration and
failed stop still retain authority; proven absence skips only stop.

Validation: affected services types, lint, formatting and independent P2 review
passed. Shared command-owner proof remains retained. Native completion is still
pending; no service guard, process assertion or test deadline was weakened.

* 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]>

* test: preserve threaded SQLite cleanup fixture metadata

Carry the exact qualified d103e23/openclaw#158407 fixture correction for incoming
compile-cache initialization. The non-isolated harness runs in threads;
retain its false/null metadata and forbidden Worker constructor without
changing assertions, order, or timeouts.

* test: align SQLite lifecycle proof with canonical host contract

Replace the provisional physical-thread metadata with the logical-host
fixture contract from merged openclaw#158209. Preserve every cleanup assertion and
the forbidden Worker constructor.

Carry merged openclaw#158409's literal dependency resolvers, caller update and
selection regression. Exact canonical postimages, the ordered cleanup case,
dependency-selection case, selected checks and independent review pass.

* test(windows): preserve installed command budgets and progress

The aggregate 240-second fixture deadline cut the published updater short
before its existing 180-second command budget. Allocate installed cells
360/900/900 seconds and matching 10/19/19-minute Actions envelopes, including
the existing teardown and runner margin. Source-native and command limits,
assertions, and the quiet watchdog stay unchanged.

Reuse the existing durable recorder for real phase progress, preserving
original failures and emitting only fixed labels. The Task-only 9.4 cell
needs one sibling fence, with no Startup fingerprint allowance.

The 32 focused cases, selected types and export scans, workflow validation,
owned lint, and independent review pass. Retain the unchanged main replay
lint-cap failure separately. Production and dependency inputs are unchanged.

* test(windows): retain installed updater failure progress

Read the isolated selected service update ledger before native fixture cleanup and retain only phase and step metadata. Preserve the original updater error and all existing execution budgets.\n\nValidation: 15 focused tests, incremental changed-file checks, and independent review passed. The moving-main ratchet failure on three untouched older files is retained separately.

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

* fix(daemon): ignore unrelated registered task profiles

Read-only Scheduled Task discovery can inspect a static unrelated command
without requiring an OpenClaw profile. Keep selected-service profile checks
strict, and preserve launcher, registration and deadline revalidation.

The installed Windows fixture exposed a false Doctor finding for a Helper
that only runs node.exe --version. Add its causal collector regression and
retain the selected-service rejection assertion. Receive the canonical
98b1a5b SDK fixture fix so mutation occurs after real declaration emission.

Receiving tests and core/services/SDK types pass; focused lint and P2 review
are clean. The full changed gate still encounters the inherited OpenRouter
suppression defect already repaired on main. The production change requires
new package acceptance and native Windows proof before landing.

* fix(build): give external recovery steps for stale dist

The live-build refusal now names an external stop, successful rebuild, and
start sequence for every matching service. Explain that an already-current
update does not rebuild stale output, and document the default-profile
commands with failure-short-circuiting in the source update guide.

This changes guidance only, without altering admission or lifecycle policy.
The existing fence suite passes 37 cases with one platform skip; focused
lint, formatting and independent P2 review are clean.

* test(daemon): observe published updater settlement

Record launcher, command, and output lifecycle timestamps for the published
update command. After its current ledger run becomes terminal, retain at
most two bounded and sanitized process snapshots with creation and CPU/I/O
facts. Fence progress and snapshots to that same run; observations neither
refresh progress nor change command, cleanup, or watchdog budgets.

This diagnoses a published 9.3 command that timed out after its candidate
reported successful activation and verification. Preserve the failure and
avoid inferring early process exit from post-timeout cleanup observations.

34 focused cases, services types, scoped lint, formatting, and independent
P2 review pass. Native diagnostic execution remains required.

* fix(daemon): recognize the released waiting task launcher

Accept the exact waiting VBS form generated by the published 2026.9.3
installer during an owned service-definition audit. Keep custom launcher
behavior classified as an unknown edit and preserve all selector, command,
root, and native authority checks.

Receive the three reviewed postimages from ec74258. The actual audit
regression fails on the original implementation; 55 receiving cases pass.
The shared owner also verified 140 backup/rewrite cases, core/services types,
scoped lint and P2 review. This repairs the observed reconciliation warning;
it does not claim to explain the independent updater settlement timeout.

* test(daemon): sample unsettled updates before the command deadline

Keep the same two-snapshot cap, current-run binding and progress behavior. Capture an unfinished run at 300 seconds so a slower installation cannot prevent all process observations. Rename the diagnostic field to reflect both active and terminal observations. The original observer regression fails; 25 cases, scoped lint/types and independent P2 review pass. Command and cleanup budgets are unchanged.

* test(daemon): preserve CRCRLF task export comparisons

* fix(windows): enable a verified disabled task on explicit start

Receive the shared selected-service start repair, preserving published command fingerprints and optional Enabled metadata behavior. Keep the finalization process fixture's real entrypoint exports available. Source-build recovery ownership remains unchanged.

* docs(windows): clarify explicit start partial effects

Document that successful enablement remains an audited effect when the later launch fails. Preserve the existing explicit-start contract and require inspection before retrying; do not imply rollback after authority loss.

* docs: clarify source CLI recovery uses the existing build

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Donnie Fiander <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
)

* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants