Skip to content

fix(test): expect Active Memory status diagnostics in incognito - #168182

Merged
steipete merged 1 commit into
mainfrom
ci/fix3-incognito-memory-status
Oct 10, 2026
Merged

steipete merged 1 commit into
mainfrom
ci/fix3-incognito-memory-status

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #164409

What Problem This Solves

Fixes the incognito Active Memory integration test failing on main because it expects the old one-line status response.

User Impact

No production behavior change. Incognito storage isolation, prompt behavior, and authority checks remain unchanged.

Why This Change Was Made

e5bc415fed93 intentionally added separate trigger-recall and cross-conversation configuration diagnostics to /active-memory status. Update this integration fixture to expect the complete three-line response, retaining exact object/string equality and every existing privacy assertion. The status handler reads configuration and session state; it returns before the mutation branch. The actor backend still requires memory-only SQLite.

Evidence

  • Adjacent-commit bisect on Linux: parent 14b764a9c338 passes the original expectation; e5bc415fed93 fails with exactly the two added lines. The original expectation on main 56e7dbab5bb2 reproduces the same failure.
  • Updated incognito integration file: 11/11 passed, 12.27 s Vitest wall time, including its prompt, host-SQL and authority assertions.
  • Active Memory plugin index tests: 141/141 passed, 79.05 s.
  • P2 autoreview is clean, and the file passes formatting. No test cases, timeouts, retries, or assertions were removed or relaxed.

Infrastructure fallback and proof gap: the full infra owning config, check-changed, full typecheck, and boundary lint were not completed. Testbox did not admit the job within 15 minutes. AWS completed the diagnosis, but the broader setup exhausted /tmp inodes before tests started. Attempts to move that setup to disk were then blocked by coordinator command-admission timeouts; Hetzner also failed to admit a lease. This ready PR is the maintainer infrastructure fallback, with those gates explicitly outstanding.

Remote results above belong to base 56e7dbab5bb2 plus this exact patch. The rebase onto 9948a4b83404 changes none of the failing test, Active Memory status owner, or incognito worker owner beyond the reviewed expectation update.

The status command intentionally gained trigger-recall and cross-conversation setting details in e5bc415 (#164409). Keep exact response equality while expecting all three lines, preserving the existing prompt, incognito actor, host-SQL, and authority assertions.
@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

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

View the workflow run.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 10, 2026
@clawsweeper

clawsweeper Bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR updates the incognito Active Memory integration test to expect all three status lines.

Example: The incognito fixture runs /active-memory status for agent main with both recall settings enabled.

  • Before: The test expects only “Active Memory: on for this session.” and rejects the additional diagnostics.
  • After: The test expects the session status, trigger-recall configuration, and cross-conversation setting together.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch is correct; validation consists of reported integration runs and source verification, with broader gates explicitly outstanding.
Proof confidence 🦐 gold shrimp (3/6) This test-only correction changes no shipped behavior; supplied integration results support the revised expectation, and no new runtime proof is required.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: The incognito integration suite rejects the intentional expanded Active Memory status response.
Reason: The narrow fixture correction restores useful integration coverage without changing runtime policy or relaxing assertions.

Merge readiness

✅ Ready for maintainer review

Keep this PR: current main still has the outdated expectation, and this focused correction matches the intentional status output without weakening privacy coverage.

Priority: P3
Reviewed head: b86040127a988794c8478d6e475d7e372e8b27f0

Before merge

None.

Findings

None.

Agent review details

How this fits together

The integration fixture loads the bundled Active Memory plugin through the actor-backed session SDK and checks its prompt and command responses while retaining storage-isolation and authority assertions.

flowchart TD
  A[Incognito integration fixture] --> B[Actor session SDK]
  A --> C[Bundled Active Memory plugin]
  B --> C
  C --> D[Status command handler]
  D --> E[Three line response]
  E --> F[Exact response assertion]
Loading

Technical review

Best possible solution:

Land the exact expectation correction while preserving the existing incognito isolation and authority coverage.

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

Source confirms that the fixture's one-line expectation differs from the handler's three-line response; the PR additionally reports a failing baseline comparison, but this review ran no tests.

Is this the best way to solve the issue?

Updating the independent expected response is appropriate because the production diagnostics are intentional and documented, and the patch retains strict comparison and privacy assertions.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 2d6f7a3052a0.

Provenance checked

  • Incognito Active Memory status expectation keeps the original intent (320d57b: Exercise real Active Memory prompt and status hooks through the actor SDK without durable ingestion.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 320d57b adds src/state/openclaw-agent-execution-incognito.memory.test.ts:335 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 320d57bd4fb1; files: src/state/openclaw-agent-execution-incognito.memory.test.ts)
  • Ayush Tiwari: Raw commit e5bc415 adds extensions/active-memory/index.ts:188 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e5bc415fed93; files: extensions/active-memory/index.ts)

PR surface

Tests +6. Total +6 across 1 file. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 7 1 +6
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 7 1 +6

Labels

Label changes:

  • add P3: This repairs a deterministic integration-test expectation without changing production behavior.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This repairs a deterministic integration-test expectation without changing production behavior.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

Reviewed October 10, 2026, 12:15 AM ET / 04:15 UTC.

@steipete
steipete enabled auto-merge (squash) October 10, 2026 04:18
@steipete
steipete merged commit dfdda05 into main Oct 10, 2026
102 checks passed
@steipete
steipete deleted the ci/fix3-incognito-memory-status branch October 10, 2026 04:20
RomneyDa pushed a commit that referenced this pull request Oct 10, 2026
…168182)

The status command intentionally gained trigger-recall and cross-conversation setting details in e5bc415 (#164409). Keep exact response equality while expecting all three lines, preserving the existing prompt, incognito actor, host-SQL, and authority assertions.

(cherry picked from commit dfdda05)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 11, 2026
…penclaw#168182)

The status command intentionally gained trigger-recall and cross-conversation setting details in 2c43dab (openclaw#164409). Keep exact response equality while expecting all three lines, preserving the existing prompt, incognito actor, host-SQL, and authority assertions.
tomorrowflow added a commit to tomorrowflow/openclaw that referenced this pull request Oct 13, 2026
* test(doctor): expect migrated Claude CLI wildcard routing

The Anthropic Doctor repair intentionally adds anthropic/* for legacy
Claude CLI sign-ins without an API credential. Keep the exact migrated
model-map and allowlist assertions, and check that an unseeded Claude
model resolves to claude-cli. Isolate ambient Anthropic credentials so
the fixture always exercises that repair.

* fix(vllm): honor declared reasoning efforts in served template dialects (#150149)

* feat(vllm): expose a reasoning-effort ladder for Qwen thinking formats

The vLLM plugin flattens every Qwen thinking-format model to a binary
`/think off|on` profile and strips `reasoning_effort` from the request,
because Qwen chat-template thinking is an on/off flag. vLLM reasoning parsers
can honor `reasoning_effort` as well, though: the server in front of
qwen38-flash-next accepts `low`, `medium` and `xhigh` and rejects the rest, so
the flag alone leaves the effort at the server default with no way to lower it.

Let a model row opt in through the existing `compat.supportedReasoningEfforts`
list. When a Qwen-format model declares it, the plugin exposes that ladder
(plus `off`) instead of the binary profile, the completions transport keeps
sending the level as `reasoning_effort` next to `enable_thinking: true`, and
the plugin's payload patch no longer deletes it while thinking is enabled.
`/think off` still sends only the disabled flag. Rows without the list keep
the binary profile and payload exactly as before.

* fix(vllm): preserve model mappings and current-call dialects

* fix(vllm): preserve native effort mappings during session setup

* style(vllm): use boolean reasoning guards

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: krell11 <[email protected]>

* fix: Doctor skips diagnostics when maintenance is declined (#168065)

* chore(agents): cover promised-stream recovery and repair custody (#158495)

Co-authored-by: Gio Della-Libera <[email protected]>
Co-authored-by: Gio Della-Libera <[email protected]>

* fix: custom reasoning models ignore thinking levels (#168056)

* fix: send thinking controls to custom reasoning models

Enable compatible-route effort defaults for reasoning-capable models while preserving explicit opt-outs and provider dialect exclusions. Omit implicit off controls on custom scalar routes, preserve declared off contracts, and surface unsupported fields with the model-level opt-out instead of silently retrying off.

* test: use the request effort type in custom route cases

* docs: clarify custom model effort admission and clamping

* chore(release): prepare 2026.10.5-beta.1

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(changelog): carry interim 2026.10.5 notes

Interim section so packaging gates have a 2026.10.5 body; regenerated from full history once the Code SHA is green.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(release): mxc-sandbox npm preflight fails on unreviewed mxc-sdk 0.9.0 bwrap probes (#168165)

* fix(release): review mxc-sdk 0.9.0 bubblewrap probe spawns in plugin npm scan

@microsoft/mxc-sdk 0.9.0 (from #167411) adds three bwrap-probe scripts that
spawn a fixed `bwrap --version` probe through a detached Node anchor. Record
exact reviewed counts for them and shrink platform.js from 4 to 3 so the
@openclaw/mxc-sandbox exact-artifact scan passes again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(release): keep mxc-sdk platform.js limit covering the stable line

Stable v2026.9.9 still ships mxc-sdk 0.8.0 (4 platform.js exec sites), and
the dependency inventory is a shared upper bound across supported release
lines, so keep the limit at 4 and note that 0.9.0 has 3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
(cherry picked from commit ae71c921365ab735c8b31fa15e4310d43dfe9f06)

* fix(ci): narrow release harness lockfile to its sparse checkout (#168172)

pnpm 12 rejects a frozen install whose lockfile records importers that are
absent on disk. The trusted release harness is a sparse checkout (scripts,
packages, patches), so every harness install failed with
ERR_PNPM_OUTDATED_LOCKFILE after the pnpm 12 bump (#167411), blocking
Full Release Validation's npm artifact preparation.

Co-authored-by: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 5a680062cdb3554b52e3eee5499e24bf8c0a3850)

* test(lint): allowlist sqlite observer iterator receiver capture

00ae274c0a1 (#168029) intentionally captures native iterator next/return so its wrappers can invoke them with the caller's receiver; record the two suppressions on the explicit allowlist.

(cherry picked from commit bc8f693df3aee184c65626f7e9c9c58889c51a8b)

* test(gateway): observe catalog renewal without forcing a refresh

Since #168050, an explicit forced catalog refresh waits for an ordinary expiry renewal and then starts a fresh acquisition. The metadata fixture used that operation as a wait barrier, unintentionally requesting a second renewal and turning its failure case into immediate recovery.

Wait for the existing catalog-published or catalog-failed event instead. Preserve every publication, broadcast, pending-status, recovery and dedupe assertion without changing production behavior or timing limits.

Linux proof: parent passes 5 cases; #168050 and current main fail the same 3. The repair passes all 5 and 41 metadata siblings. Injected duplicate publications fail the exact retained assertions. Types, lint, check-changed and P2 review pass. Full owning config records 4894 passes, 13 failures reproduced on clean base, and a separate SQLite WAL-identity SIGKILL; its unfinished test passes separately on clean base.

(cherry picked from commit 5033097b75dd6a8582a07a6b22969a75d750d8f7)

* test(gateway): observe query probes in memory reload fixture

Follow #167891, which routes embedding availability probes through the query-budget embed operation. Record that operation in the synthetic provider alongside batch embedding so reload recovery still verifies the exact provider generation and subsequent indexing.

Keep every recovery, watcher, and indexing assertion unchanged. No production behavior or timeout changes.

(cherry picked from commit fc7c5047e59a7d7d4ae37b0f8991786d2def1b76)

* test(memory): align incognito status with configuration diagnostics (#168182)

The status command intentionally gained trigger-recall and cross-conversation setting details in e5bc415fed93 (#164409). Keep exact response equality while expecting all three lines, preserving the existing prompt, incognito actor, host-SQL, and authority assertions.

(cherry picked from commit dfdda05fe3c5d2e71c916f8662996f6ccec8d1e1)

* fix(release): settle generated npm locks at npm's reload fixpoint (#168191)

npm --package-lock-only can assign nested override sets to a shared node
differently on a fresh tree than when it reloads the written lock, so the
package-local bundled dependency install (npm ci --install-strategy=shallow)
rejected amazon-bedrock-mantle's lock with 'Missing: @smithy/[email protected]'.
Rerun npm from the written lock until it is unchanged (bounded), folded into
the existing shrinkwrap-override repair loop.

(cherry picked from commit 9250ad1213ef21cfb569bbe1598c2663324cf9c2)

* fix(ci): align UI recovery tests with current interaction contracts (#168195)

(cherry picked from commit 5c7d73950d93896b51b99cbf6cc0ce8149f1577a)

* build(release): pin pnpm 12.9.0 from #168103

Backport only the pnpm 12.9.0 selection from main's dependency refresh
(c44c2e51ad3, #168103): packageManager, the lockfile env header, image seed
hashes, bootstrap/installer pins and their tests. pnpm 12.9.0 accepts lockfile
importers absent from the sparse release harness, which pnpm 12.7.0 rejects.

(cherry picked from commit c44c2e51ad3fdeaa84a0aa35a36c4f83a116c746, pnpm hunks only)

* Revert "fix(ci): narrow release harness lockfile to its sparse checkout (#168172)" (#168217)

pnpm 12.9.0 (pinned on main since #168103) already accepts lockfile importers
whose directories are absent from the sparse release harness. The narrowing
step rewrote .release-harness/pnpm-lock.yaml, which leaves the trusted harness
tree dirty and fails npm preflight's clean-harness guard
([[ -z "$(git -C .release-harness status --porcelain)" ]]) in
"Prepare publishable npm package".

This reverts commit 5a680062cdb3554b52e3eee5499e24bf8c0a3850.

(cherry picked from commit 4578c1dde1cb8b7217709845d091176e1d2cccc5)

* fix(update): leave live current handoff owners alone in update repair (#168197)

#168043 treated every protocol-free version-2 update lease as legacy custody, but current writers still create root leases of that shape. With another live updater or repair holding the root lease (for example parallel qa-lab packaged-candidate setups sharing the per-machine handoff database), openclaw update repair exited 1 with 'Handoff owners are live or unverified' instead of leaving the live owner alone, which broke checks-ui-e2e-real-gateway on main. Legacy update reclamation now requires a child-lineage key; live root owners make repair a no-op as before, while dead legacy child-lineage rows (#168000) are still reclaimed and live or uninspectable legacy children still get actionable guidance. Refs #168000.

(cherry picked from commit efa552b9cef854d4f0b74eb8119ae9035f4fb79b)

* test(plugins): pin a stable host version in managed install channel tests (#168230)

(cherry picked from commit 0a55cbe057e0e0f4d7a2013e01e925b0fcfbca93)

* test(gateway): expect cold-start discovery before credential-free refresh (#168235)

Since #167458 cold Gateway startup runs the full discovery an explicit
refresh would, including providers without credentials. Since #168050 an
explicit refresh does not join an ordinary in-flight acquisition and
acquires fresh responses instead. The credential-free models.list test
still asserted that startup made no provider request, so it depended on
whether startup discovery had fetched before the first read (CI: 2
requests; slow hosts: model already published).

Wait for the startup publication (1 request), then prove the explicit
refresh publishes the fresh response (2 requests) and replaces the
startup row, and that ordinary reads do not rediscover.

(cherry picked from commit 9fc63cc93f65fd27bf390cc9a77ffb5f0bc57cf9)

* fix(ci): gateway config RPC suite deadlocks on agent mutations after acknowledgement barrier (#168242)

* test(gateway): hold agent config publication mid-RPC instead of across it

Since #167894 agents.create/update/delete acknowledge only after the
config reloader applies the write. The config RPC suite held its hot-reload
barrier across the whole agent RPC, so the RPC could never settle and the
client timed out. Read config.get while publication is held mid-RPC, then
release, and drop the unneeded barrier from the large-shrink delete case.

* test(gateway): keep the reload hold in one barrier hook

(cherry picked from commit 5c6b01a42fa76b4555f475278c554dbc6984e82d)

* fix(release): keep ClawHub retry classification source-resolvable in release harness (#168234)

(cherry picked from commit 21490fb9dc601f5eb9b398ee1b2bbfc6768aacfb)

* fix(ci): ignore the dormant sqlite source-fence admission module in Knip (#168241)

#168018 landed src/infra/sqlite-source-fence-admission.ts as the dormant host
half of the durable cross-store source fence; only its broker tests import it,
so deadcode:full fails check-dependencies on main and release branches.

(cherry picked from commit d719f09ad46f2bbe07a97aa9c50845e672fefc40)

* test(whatsapp): expect carried overflow in long styled chunks

The WhatsApp delivery-recovery test for long bold replies has been red on
main since #167958 (69bfe7b645c8). That change taught the shared
render-aware Markdown chunker to carry the overflow of a re-split chunk
into the next source window instead of sending it as its own tiny
message. A 340-character bold reply at textChunkLimit 160 now arrives as
*x158* / *x158* / *x24* instead of *x158* / *xx* / *x158* / *xx* / *x20*;
the old expectation encoded exactly the orphan-chunk artifact #167958
removed.

Update the expectation to the intended contract: every chunk keeps its
style markers and stays within the limit, the content is exact, only the
first chunk quotes the reply target, and each part reports one receipt.
Reverting only render-aware-chunking.ts to 69bfe7b645c8^ restores the
old output, which pins the cause. Main's scoped CI never selected this
suite for the markdown-core change, so the red surfaced only when a later
PR widened changed-test selection.

(cherry picked from commit 281379b0111a2c7c18afff10d00845614f7325cf)

* test(e2e): accept Doctor pinning ownerless legacy cron jobs to their historical owner (#168314)

(cherry picked from commit b43da95af1513b59c19df2c3390c78fc9909e29e)

* fix(plugins): Windows Gateway startup stalls capturing installed plugin files (#168313)

Plugin source capture routed every Windows file through fs-safe's guarded
clone, which skips native copies and path-admission caching on win32, so
Gateways with installed plugins spent minutes in synchronous capture before
binding (cross-OS installer-fresh, release checks 38020418926). Windows now
uses the existing pinned-descriptor copy for small ordinary files, as it did
before the guarded-clone migration (#164680); large and native files keep the
guarded clone. The small-copy guard tests now run on Windows too.

(cherry picked from commit 2cb28836a5deefd4c8b87f6188db2955f77df24c)
(cherry picked from commit e86845769895c9b417ce7846787a6f1a85106725)

* fix(sessions): register disk-budget worker as a runtime process entrypoint (#168310)

The vitest worker build compiles runtimeProcessEntrypoints but not ad hoc
tsdown entries, so children running from the compiled test tree could not
load config/sessions/disk-budget.worker.js.

(cherry picked from commit 587a19170f3c333ad94507212e1ea18ec7c52d18)

* test(plugins): settle the startup index before measuring memory watcher retirement (#168327)

The test disposed Memory Core immediately after opening its manager, while the
dirty startup index sync was still running. Close drains accepted syncs by
contract, so on loaded release-ci runners the drain exceeded the fixed 5s
plugin retirement budget (PluginInstanceDrainTimeoutError, 2 still-running
calls); cleanup itself settled about 3.7s later. Settle the startup index
first so the budget measures watcher retirement.

(cherry picked from commit fdb06ff5ca8cb1fad79f16e0b976996503345116)

* test(plugins): park the late memory probe on embed, not embedBatch

#167891 moved the memory embedding probe to provider.embed, so the late-probe
fixture parked on embedBatch never entered and the test hung until its 120s
timeout in every release-ci checks-node-agentic-plugins run.

(cherry picked from commit 3cfab51ef9a8, src/plugins/memory-runtime.owners.test.ts hunk only)

* fix(agents): re-admit runs on the configured generation after a catalog publication (#168410)

* fix(agents): derive run owners from admitted generations after catalog publication

* test(agents): cover superseded admitted generations with uncovered selections

* fix(agents): re-admit uncovered selections on the configured generation

* fix(agents): re-admit only superseded configured generations

* test(agents): keep derived parents confined after catalog publication

* fix(agents): bind re-admitted generation locally and prove revocation rejects re-admission

(cherry picked from commit 171df4e1c5a08e1da631c4fff50c420db2bb6f84)

* test(gateway): retry plugin reload refused by post-ready registry refresh (#168594)

* test(gateway): retry plugin reload refused by post-ready registry refresh

* test(gateway): await post-ready maintenance before plugin reload instead of polling

* test(gateway): drop default deferred type argument

(cherry picked from commit 4e3707f634c9f2176ed2d18034c8389484e4ae25)

* test(plugins): start dreaming under the boot path, not the reload candidate deadline (#168608)

* test(plugins): start dreaming under the boot path, not the reload candidate deadline

* test(plugins): observe dreaming starts through a typed spy

(cherry picked from commit 8076cd878f22bf41cf104feaf7fa8be037bc7029)

* test(qa-lab): size the repeated-turn child close budget for loaded CI (#168622)

(cherry picked from commit 53d2109ebfce9e2612115315d8b814cbcef6266d)

* docs(changelog): 2026.10.5-beta.1 release notes

* fix(release): make update compatibility coverage test-only (#168836)

(cherry picked from commit c6d71fae0ed1c0f7968c8d05c410345246af235b)

* docs(changelog): record #168836 in 2026.10.5-beta.1 notes

* fix(release): record 2026.10.1 updater compatibility (#168740)

(cherry picked from commit 217d8bfb7cfa06a5a6c7d3381f92cbae7b269eac)

* docs(changelog): record #168740 in 2026.10.5-beta.1 notes

* fix(update): keep the 10.1 updater's original cleanup queue across replacement (2026.10.5 backport) (#168883)

* fix(update): keep the 10.1 updater's original cleanup queue across replacement

Backport of the cleanup-owner bridge from #168849 for 2026.10.5-beta.1.
The 2026.10.1 cleanup facade now re-exports runCliDisposerAfterPending through
the original owner URL so Node reuses the already-loaded pending-disposer
queue. Recorder and historical inventory changes from #168849 are not included.

* docs(update): keep only the 10.1 cleanup-bridge note in the backport

* docs(changelog): record #168883 in 2026.10.5-beta.1 notes

* fix(test): seed retained OAuth sidecar after published baseline setup

The published-driver upgrade lane added a synthetic orphan OAuth sidecar before
baseline Doctor. Published OpenClaw 2026.10.1 refuses that retired state during
fixture setup, so scheduled main run 38106494410 failed before invoking the
candidate updater. Seed the same bytes immediately before update, after baseline
Doctor and session preparation. Keep the post-update byte-preservation assertion
and referenced-sidecar security behavior unchanged.

Extend the existing lifecycle fake to require absence during baseline Doctor and
presence when update starts. No new test cases, timers, retries, or weakened exit
assertions are added. The original driver with these assertions failed at
seed-state; the fixed existing six-case lifecycle harness passed (10.337s summed
case time). Syntax, scoped oxlint, Docker E2E package guard, formatting, and diff
checks passed. Independent Codex autoreview was scoped-clean through P2.

Real published-driver proof on Blacksmith Testbox
https://github.com/openclaw/openclaw/actions/runs/38107590369 used
OPENCLAW_PUBLISHED_DRIVER_LEGACY_SQLITE=1 and published 2026.10.1 against a
canonical package built from cfcb7bda177 plus this exact two-file patch (source
carrier 438ed57bfac616d285ef251d9c3f10729b5f83dd). Baseline seed-state passed in
7.957s; service readiness, identity and durable/incognito session setup passed.
The full cell remains RED: update recorded finished/succeeded but its published
caller exited 1 after 195.355s while resolving its old runtime-cleanup-DlrF_x2c
chunk after package replacement. Current main's earlier cleanup-import fix
eded1a387b79 (#165233) cannot change that already-running published caller;
separate branch fix/update-cleanup-stable-driver at b2276e6d84aa owns candidate
compatibility repair. All candidate cleanup chunks match the tarball's content
inventory; the obsolete hash is absent from both tarball and compatibility
inventory. Later post-update preservation and repeat-upgrade assertions were not
reached, so this is proof of the original fixture repair, not a green upgrade
cell. Candidate Doctor also emitted retired setup-inventory warnings, traced to
a returned metadata callback outliving its newly disposed scope (01ead786dc19).

Remote proof completed in 608.221s including canonical package build; the package
build took 3m25.9s. Artifacts downloaded and task-owned Testbox stopped, with
completed status verified. The Doctor title PR candidate was not included in this
emergency fixture proof.

(cherry picked from commit 951dffef48a9f5458984d87890c42cf8ae203ab7)

* docs(changelog): refresh 2026.10.5-beta.1 record target

* fix(update): accept native Windows spellings of the recovery capture directory (#168968)

* fix(update): accept native Windows spellings of the recovery capture directory

The post-swap Doctor compared the pinned capture's native realpath string with
the locator the driver recorded. On Windows, native realpath expands 8.3 short
names and normalizes case, so an update from published 2026.10.1 under a
short-name profile path refused with "Update recovery capture changed
location" and rolled back. Compare the recorded path's own lstat identity
with the pin instead: it must still be a real directory (not a link) and the
same directory, regardless of spelling.

* fix(update): compare the capture identity with exact bigint stats

* fix(update): rely on the pin's exact identity check for the capture locator

(cherry picked from commit a216ad8eea6a15fee9341f7bdf2f51e9012ec441)

* docs(changelog): record #168968 in 2026.10.5-beta.1 notes

* fix(update): serve the 2026.10.1 updater's pending-migration read after replacement (#169031)

(cherry picked from commit 34e71463b60e42ab073f576502e3daf996009dfa)

* docs(changelog): record #169031 in 2026.10.5-beta.1 notes

* test(gateway): stabilize manual model policy catalog fixture

Author contextWindow for all synthetic models so the legacy and
capability-negotiated requests compare the same public metadata even when
background catalog discovery completes between them. Keep the strict row
comparison and all policy, auth, session, and default-reset assertions.

The intended credential-scoped background enrichment by Ayaan Zaidi in
#167460 can fill
omitted windows with 128000; the public response field is not an internal
leak. A controlled real-worker completion reproduced the hourly mismatch.

Validation: controlled before/after reproduction, 20 pressured runs,
three original CI shard replays, types, lint, format, boundaries, and P2.
The whole owning config ran; its five unrelated failures all passed when
run independently. Existing dead-export findings remain outside this fix.

(cherry picked from commit 504885e7b765c7f99182e152cbe95d8e922cc958)

* test(codex): wait on catalog publications instead of timing cold model reads (#169281)

The first demanded models.list prepares the cold catalog worker before native
discovery starts. Its duration is host-dependent (about 15s on loaded CI shards,
18-45s on a loaded local host), so a 15s expect.poll could expire while that
first read was still running and fail with its pending, row-less result.

Wait on prepared catalog publications through the shared
waitForCatalogPublication helper, bounded by the test signal, for both the
initial native row and each account transition.

(cherry picked from commit 68127439e6c989a585f35c0e3ac8d767d758bd09)

* fix(update): retain and reclaim updater runtimes under alternate path spellings (#169292)

The updater decides whether to retain its own runtime by checking that the native realpath of its package root is inside an install being replaced. Mutation roots, the package owner, cwd and the temporary directory were resolved with the spelling-preserving realpath, so a Windows 8.3 profile (C:\Users\RUNNER~1) or a differently cased path on a case-insensitive volume made the replaced install look unrelated. The updater then skipped retention and its workers loaded the replacement package's code. Retained-runtime maintenance had the same split: it compared ordinary-spelled marker paths and live registrations with native realpaths, so it could neither recognize abandoned runtimes nor match the live owner. Resolve all of these boundaries with the native identity resolver.

(cherry picked from commit 032a58bf34d643d59482656bfe0005c27d5c1e17)

* chore(build): stop packing the update-compat inventory (#169268)

(cherry picked from commit db8dbef60ed6c03b4fb9e0bee1f820a1815b988b)

* chore(deps): refresh eligible dependencies through October 2 (#168103)

Refresh compatible dependency pins published by 2026-10-02T22:42:59Z,
including pnpm 12.9.0 and authenticated CUA 0.32.0 native artifacts.
Keep reproduced compiler, patched-package, and native compatibility holds.

Classify Gemini CONTINUATION responses as length-limited in both transports,
preserving partial content without promoting incomplete function calls.

Make the benchmark deadline fixture wait for owned child readiness and
assert abort and deadline results outside deadline error normalization.

(cherry picked from commit c44c2e51ad3fdeaa84a0aa35a36c4f83a116c746)

* fix: Doctor maintenance fails when state inspection is slow (#168161)

Worked on by:
- @obviyus

OpenClaw-Publication: 85113cab-ac33-4ffb-9385-7afc8fbd683e

Co-authored-by: obviyus <[email protected]>
(cherry picked from commit 0c91469b2dabc593638e7080b6674fda5f1dee3b)

* fix(update): recover blocked updates after completed receipt identity drift (#168388)

* fix(update): recover retired receipts with an independent helper

Allow a newer standalone recovery helper to archive an exact completed publication receipt under fresh update ownership, preserving bytes and leaving the serving installation unchanged. Keep unfinished recovery bound to its original helper. Document the first-hop recovery route for published updaters blocked by historical device IDs.

* fix(update): clarify completed receipt recovery checks

Avoid shadowing the prior settlement during archival, check external status before the stale-receipt regression, and link the first-hop recovery procedure from update repair guidance.

(cherry picked from commit eae2e5421daa5b0647126830917df8772ab35f70)

* fix: preserve model fallback after provider timeouts (#168605)

Restore configured model fallback after a primary provider timeout by checking failed, aborted, and yielded attempt eligibility before reading the completed-turn transcript boundary. Remove duplicate eligibility checks while retaining successful-turn authority validation and transcript integrity assertions. The shared finalizer also serves ordinary replies.

Related: #168456
Related: #168509

The separate keyed-user assertion reported on fallback re-entry remains unverified; #168456 stays open.

Validation: production-boundary regression and failing production-only negative control; 125 files / 1,454 tests and core plus affected test-type graphs on Testbox; live isolated Gateway proof with a synthetic provider showed two primary requests, one fallback request, one delivery, one original user key, and one final answer. Independent review found no actionable findings. The reviewed patch was unchanged by the subsequent main integration; GitHub CI gates bind the prepared head.

Co-authored-by: Peter Steinberger <[email protected]>
(cherry picked from commit e52cbaafccaeffdc5f75ea7925d0364a902b1d56)

* fix: preserve replies while their agent finishes starting (#168826)

New replies arriving while an agent is still starting now wait for its prepared runtime publication. Ready agents remain available and existing cancellation and failure handling is preserved.

Closes #157814.

Proof: startup tests 10/10; original production fails both regression cases; adjacent admission/auth tests 38/38. Required CI passes. Production LOC +20. Static checks pass except the independently reproduced baseline dead export documented in the PR.
(cherry picked from commit cce7888a7c73e3b5aa26f4470ec81649e23d8327)

* fix(update): carry the service heap budget into update children (#168889)

Doctor, candidate checks, recovery and verification spawned by openclaw update now inherit the managed Gateway service's Node heap controls (service argv --max-old-space-size and NODE_OPTIONS), so large-state hosts no longer OOM during update. Only heap flags are projected, never service preloads. Fixes #168729.

(cherry picked from commit 9a62c5b5cd2eb98a47e7091dfa1484cfe8dd7809)

* perf(update): skip redundant rehashing during retention and publication (#168958)

Runtime retention no longer rehashes files whose ctime changed only because of its own hard link, and package publication reuses settled verification observations instead of re-reading unchanged trees. Backup, rollback, copy verification and metadata checks are unchanged. Measured tiny-state update: 8m14s -> 6m31s (publication 145 s -> 84 s).

(cherry picked from commit c96fac1cc6a48f7249ac21575a73e025bfcc3e51)

* fix(update): run deferred official owners' webhook-listener migration in candidate Doctor (#169035)

Updating to 2026.10.1 with an enabled webhook channel (e.g. Microsoft Teams) could fail before activation: candidate Doctor skipped the host webhook-listener migration because the installed official owner was deferred, then candidate startup required that migration. Doctor now resolves the trusted deferred owner's migration while preserving installed-owner origin, allowlists and authored endpoints. Fixes #168872. Supersedes #168962, thanks @sirius1024.

(cherry picked from commit 054004acbc73fc814882cd696afc851eb4c251dc)

* fix(telegram): resolve polling workers in source and package builds (#154286)

Restore Telegram polling from source checkouts and compiled plugin captures. Resolve the worker through the shared runtime owner, retain its package build entry, and preserve CPU tracking, acknowledgement, and shutdown behavior.

Validated with a failing baseline regression, 3 focused tests, real worker polling against a synthetic HTTP Bot API in source/package/host layouts, full build, formatting, type-aware lint, package typecheck, and independent review. Required CI is green. The max-lines and unused-export failures are independently reproduced on pristine main.

Fixes #154180.

Co-authored-by: 琚耀辉0668001366 <[email protected]>
(cherry picked from commit dd053f96aa300a82443d5ab9725f206214e9c36e)

* fix(update): settle legacy package-activation records after metadata-only drift (#169027)

A 2026.9.8 activation record whose previous package tree changed only in ctime/nlink (its own rollback touches them) could never be retired or repaired, blocking every later update. Legacy-format records now settle when root identity and package version match, with a recorded warning (the previous generation is reinstallable package code, not user data); current-format records keep full verification. update repair no longer exits 0 while package recovery is still pending. Fixes #168856.

(cherry picked from commit 3e832726ad2a19e1a19d07651e7817a6dd8aa2b9)

* fix(update): settle stale handoff leases and completed receipts instead of blocking updates (#169038)

openclaw update refused with update-recovery-pending when the managed handoff lease database was missing or replaced (e.g. after a temp cleanup), even though update repair could settle it, and refused completed previous receipts as not safely replaceable. Admission now runs the existing settlement when nothing is at risk (dry-run only reports it) and archives completed receipts. Production net +25 LOC after deleting the obsolete in-place receipt replacement path. Fixes #167506, #167771.

(cherry picked from commit ff6f58a8c32b6daa4bf1cf5f60b3493ae96d1764)

* fix(release): size the plugin publication manifest cap for its file-entry cap (#169084)

The publication manifest lists one inventory row per packed file, and the
tar entry cap already allows 20k files for bundled SDKs, but the manifest
itself was capped at 4 MiB. @openclaw/amazon-bedrock-mantle-provider
2026.10.5-beta.1 packs 14,206 files (bundled @aws/bedrock-token-generator),
producing a 4.47 MiB manifest that the publish step rejected before npm
publication. Raise the manifest cap to 16 MiB and keep packed package.json
on its own 4 MiB bound.

(cherry picked from commit d29e2d5be0f618c13417d74fa48216384ea3bb74)

* fix(ui): recover updated chats through the serving document (#168941)

* fix(ui): probe the serving document when recovering stale chats

* test(ui): gate recovery on the serving document

* test(ui): expect the serving document during login recovery

(cherry picked from commit cb1b6cdb9c74cd17b92b141a55c3f4e448ca5aba)

* chore(release): prepare 2026.10.5-beta.2

* docs(changelog): 2026.10.5-beta.2 release notes

* fix: stop catalog refreshes retaining duplicate native plugin graphs (#169272)

Related: #159662. This repairs its duplicate native-graph retention path, not every reported memory-growth or shutdown symptom.

Supersedes #162080, carrying @mcooks-cmd's fix forward on current main. Thank you to @mcooks-cmd for identifying and fixing the retained native-module identity problem; their branch is left intact.

## What Problem This Solves

Fixes: a long-lived Gateway's model-catalog worker retains another native ESM plugin graph whenever the same workspace's plugin context changes.

## User Impact

An unchanged installed native ESM entry now evaluates once per workspace during a catalog worker's lifetime. Registration remains generation-owned, workspaces remain isolated, and lazy imports—including imports from compiled TypeScript helpers—continue after the originating generation retires. New installed paths/workspaces still add resident modules; installed source replacements are picked up on worker restart. CommonJS and explicit recovery behavior are unchanged.

## Why This Change Was Made

Current main already caches each workspace's current plugin context, but replacing that context still gives unchanged installed code a new capture URL that Node cannot unload. The loader now owns one retained capture/compiler/module record per installed entry and workspace, with separate live generation owners. A single registration guard rejects calls through another generation's replaced API handle. Cleanup has one owner, including failed compiled evaluations.

This ports the fix onto main's newer source custody, digest validation, native recovery, Node/Bun selection, and admission reuse. The new identity module, instance-method monkey-patching, parallel retention maps, duplicate API-facade guard, separate worker fixture, both oversized retention test additions, and all knip/wrapper/test-inventory changes were eliminated.

## Evidence

Fresh real-worker comparison against main `34292e09ea88e45a4b0013470ce4ddc6c71aa3ca`, using the same generated installed `type: module` plugin, an initial catalog and **20 context changes**:

| Measurement | Main | Candidate |
| --- | ---: | ---: |
| Entry evaluations | 1 → 21 | 1 → 1 |
| Distinct capture URLs | 21 | 1 |
| Array buffers, first → last | 5,269,381 → 89,208,672 B | 5,269,386 → 5,063,679 B |
| Array-buffer growth | +83,939,291 B | −205,707 B |
| JS heap, first → last | 111,752,168 → 103,941,920 B | 114,025,592 → 108,785,304 B |

The regression fails on main and passes on the candidate. The fixture retains a 4 MiB typed array; the leak is visible in external/array-buffer memory, not an increasing sampled JS heap. These are generated-fixture measurements, not a replay of acpx/codex/slack.

- Focused proof: **174 passed, 1 skipped**, across eight files; wrapper wall time **81.52 s** with `--maxWorkers=1`. The catalog heap file took **26.80 s**, including its existing CommonJS regression. Boundaries cover workspace isolation, lazy import after release, compiled helper after release, failed acquisition/evaluation cleanup, stale-generation registration, source custody/recovery, and existing module-generation behavior.
- Real isolated Gateway: installed native ESM plugin, initial config plus three agent-model config edits, with the expected model returned by `models.list` after every edit. Seven worker catalog samples kept **one evaluation and one capture URL**. Two edits produced one expected catalog-superseded response while replacement settled; no other RPC failure. A separate run also passed three plugin-config edits (which replace the inventory worker). Both Gateways and their state were task-owned and cleaned up.
- Build passed; targeted Oxlint: **0 warnings/errors**; line-cap and max-lines ratchets passed. The build reports the same existing advisory `chat boot JS requests: 36 exceeds 35` on both main and candidate.
- Required `gpt-6-astra` review completed in three bounded passes. Its failed-evaluation compiler-retention finding was fixed and regression-covered; both subsequent passes found no actionable defects. The unchanged standalone Bun module-generation regression also passed.
- [ClawSweeper is ready on exact head `35acee784c154ed822a74fc35c71677006423837`](https://github.com/openclaw/openclaw/pull/169272#issuecomment-6112243735), with no findings or remaining proof requests.
- [CI run 38164303145, attempt 2](https://github.com/openclaw/openclaw/actions/runs/38164303145/attempts/2) completed: 53 jobs succeeded, 25 were unselected/skipped, and no jobs remain running or cancelled. The only failing test is `gateway.models-policy-reload.e2e.test.ts:175` (expected 0 artifact loads, received 1), also [reproduced on clean main `34292e09ea88e45a4b0013470ce4ddc6c71aa3ca`](https://github.com/openclaw/openclaw/pull/169272#issuecomment-6112330402); the aggregate CI gate consequently remains red. The previously cancelled shard passed on rerun.
- `openclaw/security-sensitive-review` passed with “No sensitive product changes.” No human security approval or bypass is required by that gate.

### Generation-authority proof

The final test extends the same real catalog-worker fixture; no mock registrar or substitute guard is used. Alpha generation 0 arms a deferred call, alpha generation 1 replaces its module's API handle and publishes its own catalog, then a distinct beta workspace invokes alpha's retained direct-call function and releases alpha generation 0's deferred call. Both calls hit `registerProvider` on alpha generation 1's handle:

```json
{
  "alpha0": {"evaluations": 1, "registrations": 1, "modelId": "revision-0"},
  "alpha1": {"evaluations": 1, "registrations": 2, "sameCaptureAsAlpha0": true, "modelId": "revision-1"},
  "beta": {"evaluations": 2, "registrations": 1, "separateCapture": true, "neighborRejected": true, "releasedRejected": true, "registrationEffects": 0, "modelId": "revision-2"},
  "alphaAfterForeignCalls": {"registrations": 2, "sameCaptureAsAlpha0": true, "modelId": "revision-1"}
}
```

Both rejection assertions require the generation-mismatch error, not just any thrown error. The effect counter increments only after `registerProvider` returns, so a silently closed/no-op API would fail this proof. The direct calls perform no lazy import; rejection therefore cannot be attributed to a resolver/file error. The extended boundary passed in **2.786 s** (**31.08 s** wrapper wall time including fresh worker-artifact preparation); the rest of the already-passing production-path evidence is unchanged.

### Simplification size

Against main: production **+282/−47** (net +235), tests **+379/−1** (net +378), docs **+11/−3**. Total **+672/−51** (net +621).

Compared with #162080's delta: **117 fewer net production lines**, **1,263 fewer net test lines**, and no tooling/inventory changes; overall net growth drops from **2,022 to 621 lines**. Remaining growth owns the capture/compiler lifetime and distinct regressions rather than duplicate measurement scaffolding.

Backport notes: release/2026.10.5 lacks main's intervening plugin-state-operation
module loader/source binding, selective multi-entry capture, and the slimmed
generation-artifact shape (main dropped source-input verification and
assertSourceCurrent; the branch keeps them, and its retainSourceCustody returns
a custody with assertCurrent/sourceDigest). The fix logic in
plugin-instance-module-loader.ts is ported verbatim minus main's state-operation
lines. PluginGenerationArtifact is exported as the branch factory's inferred
return type instead of main's hand-written type, which does not match the
branch's custody shape. No prerequisite commits were pulled in.

Co-authored-by: mcooks-cmd <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit a81bb54f094f0bb5df760b4fe7e100c791c757d1)

* fix(release): release:candidate refuses to resume after a release-tooling repair on main (#169257)

* fix(release): let bound candidate state follow repaired tooling forward

* test(release): prove legacy candidate state resumes across a tooling rebind

* test(release): type the legacy rebind fixture from current state

* refactor(release): drop release tooling from release-candidate state identity

Backport notes: release/2026.10.5 predates main's planning-flag reconciliation
(savedToolingSha guard, retained-request-aware savedPublishWorkflowRef, and the
three-argument reconcileReleaseCandidateState). Ported only the logic onto the
branch's simpler expressions: toolingSha and publishWorkflowRef leave the strict
state keys, and savedPublishWorkflowRef reuses a saved tag only when it names
the current tooling SHA, so repaired tooling gets its own tag. Tests port the
repaired-tooling matrix cases and the reconcile unit test (two-argument form).
The regular-release.md hunk is dropped: it rewrites a planning-flags paragraph
that does not exist on this branch.

(cherry picked from commit 0b0c2f216658ba62557fe4dbd444a6ebeb4b0f7c)

* fix: recover catalog config after failed native ESM refresh (#169321)

* fix: recover catalog config after failed native ESM refresh

* fix: provide catalog regression response timeout

(cherry picked from commit d0df645f66013c79290904ac9c4e69f9749b94fd)

* fix: stop catalog refreshes retaining duplicate native plugin graphs (#169272) (production half)

Completes the #169272 backport: the earlier backport commit c21fa6aa758
carried only its docs and tests, because the adapted production changes were
never staged. This adds them.

Backport notes: plugin-instance-module-loader.ts is main's post-fix file minus
main's plugin-state-operation lines, which release/2026.10.5 never had; its fix
delta is identical to a81bb54f094. PluginGenerationArtifact is exported as the
branch factory's inferred return type, because main's hand-written type does
not match the branch's custody shape. Selective multi-entry capture is not taken.

(cherry picked from commit a81bb54f094f0bb5df760b4fe7e100c791c757d1)

* fix(doctor): recovery copies miss Canvas and Memory Core files before migrations move them (#169436)

* fix(doctor): capture Canvas and Memory Core migration sources before repair

Canvas legacy documents and Memory Core host-event/sidecar files were absent
from the Doctor/updater recovery capture, so recovery copies lacked bytes the
migrations then deleted or moved. Declare their backup inventories from the
same source/path owners the migrations use, without mutating state.

Extracted from #169295.

* fix(memory-core): capture retry rollback journals before sidecar import

(cherry picked from commit 7187a9afa71af15eb5f7889f6af47faed021097a)

* docs(changelog): refresh 2026.10.5-beta.2 notes

* fix(gateway): Control UI turns stop after unrelated pairing activity (#169457)

* fix(gateway): stop unrelated pairing traffic from revoking operator turns

Remove the operator pin on the best-effort pairing publication cache.
Keep revocation with the Gateway owner and the direct recovery admission check.
Preserve node publication fences, post-commit receipts, and bootstrap cleanup results.

Fixes #169134
Supersedes #169137, thanks @Oldrich333

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

* test(gateway): keep state database close out of pairing pin regression

Database-handle closure revokes through the profile admission owner, which this change does not touch.

* test(gateway): remove unused pairing publication import

* fix(gateway): revoke complete pairing prune batches before cleanup

* test(gateway): rotate recovered callers through the Gateway handler

---------

Co-authored-by: Oldrich333 <[email protected]>
(cherry picked from commit 99f7d3c0f284425d090482325ff18ab9fbab25d8)

* fix(agentsapi): preserve saved sessions across binding upgrades (#168150)

* fix(agentsapi): preserve saved sessions across binding upgrades

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

* fix(agentsapi): preserve saved sessions across binding upgrades

Worked on by:
- @steipete

Co-authored-by: steipete <[email protected]>
OpenClaw-Publication: 3f57ecde-03cc-4f19-8557-30821da7c572

---------

Co-authored-by: steipete <[email protected]>
(cherry picked from commit bc524d8903002ca70d07f9770b2f993e5e7aec59)

* fix: restart-auth release proof exceeds job deadline and misses stop policy (#168097)

* fix: restart-auth release proof exceeds job deadline and misses stop policy

* fix(test): isolate survivor stop policy from runner cgroup

* fix(test): resolve release fixture workspace imports from source

(cherry picked from commit 2d991c67599c2adc4dc5deaee940d27e3c15cf07)

* fix(doctor): preserve installed plugins when path safety checks block them (#168111)

* fix(doctor): preserve blocked local plugin configuration

Treat discovery-blocked plugins as present across validation, stale cleanup, migration reporting, and install-health recovery without weakening execution checks.

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

* fix(doctor): preserve installed plugins when path safety checks block them

Worked on by:
- @obviyus

Co-authored-by: obviyus <[email protected]>
OpenClaw-Publication: 061fdf3e-0e82-4bf8-902a-6c792389eb6a

* test(doctor): account for blocked plugin inspection in canary

Retain the exact convergence result and no-replacement assertions while expecting the newly returned empty blocked-plugin set.

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

* fix(doctor): preserve installed plugins when path safety checks block them

Worked on by:
- @obviyus

Co-authored-by: obviyus <[email protected]>
OpenClaw-Publication: b9dcd2d0-4973-43e2-bd81-f4b22db176ff

---------

Co-authored-by: obviyus <[email protected]>
(cherry picked from commit e048d9d952d6d9016718af7828bd153385459d0a)

* test(subagents): stop polling scheduler effects in cancellation concurrency tests (#168128)

The sibling-cancellation cases waited for swarm-scheduler and lifecycle-admission
effects with vi.waitFor, whose default 1 s budget expires on a loaded host before
the owner runs ("expected vi.fn() to be called 2 times, but got 0 times"), while
the file passes in isolation. Resolve a deferred from inside the owner's own
callbacks (onRemoved, onInterrupt, start) once the expected number of calls has
arrived and await that instead, keeping the same assertions. Guard the awaits with
awaitGateBeforeSettlement so a kill that settles before the publication fails with
a named reason, and with withinTest so the finally cleanup still runs on the test
deadline. No timeout is widened.

Co-authored-by: Peter Steinberger <[email protected]>
(cherry picked from commit 2d6f7a3052a03867896f10d521969c78c4555d9a)

* fix(memory): prevent repeated daily-note blocks during flush (#168123)

Reject replayed saved content before an append, explain the flush-specific write contract, and preserve note bytes for a new-content retry. Covers host and sandbox writers, copied read windows, line endings, and reusable Markdown structure. Related: #164650.

(cherry picked from commit 77bbc865a05bb38e4284e651ddf229d8ac10a53c)

* test(plugins): status test fails since metadata snapshots carry diagnostics (#168264)

## What Problem This Solves

Fixes: `src/plugins/status.test.ts` fails on `main` with `TypeError: params.diagnostics is not iterable` since #168111. Every PR whose changed-test shard includes it goes red (seen on #167996).

## User Impact

User impact: none; this is a test fixture fix. CI goes green again for PRs that run this test.

## Why This Change Was Made

#168111 made `projectPluginInstallHealth` read `params.metadata.diagnostics`, a field the plugin metadata snapshot always carries. The shared mocked snapshot in `status.test.ts` omits that field. The fix adds `diagnostics: []` to the mock, so the fixture matches the real snapshot shape. Production code is unchanged.

## Evidence

- Before: on #167996's CI (which merges current `main`), `checks-node-changed-compact-small-10` and `checks-node-changed-compact-large-11-1` both fail the same 2 tests: `applies the full bundled provider compat chain before loading plugins` and `projects imported state before and after diagnostics evaluate native modules`. Locally on `main`-based code, the file fails standalone the same way.
- After: `node scripts/run-vitest.mjs run src/plugins/status.test.ts` passes 7/7.
- No overlap with Pash/Sarah changes: `git log origin/main [email protected] [email protected] -- src/plugins/status.test.ts` is empty.

Merge danger: two-way door. Blast radius: one test fixture.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit e7eece5bae3dd756856a2ca2e371a6a13516d66b)

* fix: keep task replies in their chat and avoid Reef commit-link false positives (#168248)

* fix: keep task replies in their chat and avoid Reef commit-link false positives

Worked on by:
- @steipete

Co-authored-by: steipete <[email protected]>
OpenClaw-Publication: b8920c6f-576c-434e-8115-ab813ea0bdb1

* fix: preserve internal media task delivery routes

Interpret the internal WebChat sentinel at media admission while retaining captured WebChat origins for interactive completions. Fixes the three media routing regressions from the initial PR CI without changing their expectations.

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

* fix: retain first-contact transcript mirrors without rebinding routes

Create a separate missing mirror identity through the existing worker-backed session operation after successful delivery. Preserve existing mirror rows and routing, creation provenance, and caller guards. Cover real send-handler persistence and transcript append for missing and existing mirrors.

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

---------

Co-authored-by: steipete <[email protected]>
(cherry picked from commit 56521b610f441ae4f7190a2d82b7acd4feba2991)

* fix(sessions): coalesce pending Home creation notices (#168239)

Keep session creation awareness in one replaceable, bounded queue entry so dashboard activity leaves capacity for reminders and hook wakes. Preserve store ownership, untrusted metadata wrapping, accepted actionable events, and full-queue rejection. Cover concurrent creation bursts, global scope, size bounds, replacement receipts, and drain lifecycle.

(cherry picked from commit addfa4853e2f61dd1398d8e0dbe6f5776a6e5ae6)

* fix(workboard): keep fallback runs active until the overall outcome settles (#168215)

When a Workboard card's run failed on the first model candidate and continued on a fallback, the card was moved to blocked (and could get stuck in review on real exhaustion) because attempt-level agent_end events settled the card before the overall session outcome was known. Both attempt outcomes now settle from the session's overall state: fallback success goes running to done with no blocked event, and genuine exhaustion still blocks with failureCount 1. Hook-time reads use the active lifecycle service reader, and linked Incognito sessions are read by exact identity without private content. Builds on #167745 by @skyzhao1223 (fork rejected maintainer pushes); related #167746 by @ericcurtin. Fixes #167574.

Co-authored-by: skyzhao1223 <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit 9f7cb66e186b15519ff435caf5383c7d109a179d)

* fix(recovery): keep interrupted completion replies from being lost (#167814)

* fix(recovery): preserve terminal completion claims

* fix(recovery): keep deferred turns pending

* test(agents): align fallback auth fixtures with their runtime owner

Seed the fallback auth database under agent test before runtime directory
registration. The previous temporary parent name became its durable owner;
later auth usage writes opened it as test, killing the pooled SQLite worker
and invalidating retained reply database generations.

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

* test(reply): await collected drain settlement

Observe the existing detached Gateway root release before asserting that
collected input custody has drained. The default polling deadline raced
real database work under the broad suite.

Keep the queue-absence assertion and require normal settlement without
adding a timeout, a production seam, or another test case.

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

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: goutamadwant <[email protected]>
(cherry picked from commit 78e6318772e0bcd6aa79cb14d1b1ed2bbd2c39a7)

* fix(gateway): avoid blocking stops on native skills watcher cleanup (#168273)

## What Problem This Solves

Fixes Gateway stops spending 10–38 seconds retiring skills watchers one at a time on macOS.

## User Impact

Process-owning Gateway stops no longer wait for individual native watcher shutdowns. In-process restarts, hosted stops, and embedded Gateways still fully retire their watchers before continuing.

The installed updater cannot change the old Gateway's shutdown behavior. Once the candidate Gateway is running, later stops and updates use this fix. There are no configuration, schema, or stored-state changes.

## Why This Change Was Made

Stopping each FSEvents stream synchronously blocks the JavaScript thread on a native round trip. A Gateway that owns its process can instead fence skills observation immediately and let process exit release the native resources together. Detached subscriptions remain owned so an explicit later close can still retire them.

The stop decision stays with the existing process-exit owner. No overlap with protected maintainer changes.

## Evidence

- Retained macOS reproduction: closing 20 native watchers took 11.5 seconds, with the event loop blocked for the entire close.
- The regression exercises the real early-runtime unsubscribe path with real fs-safe subscriptions. It covers an exiting Gateway, late callbacks after detachment, explicit later retirement, and a Gateway that stays in-process.
- The original implementation fails the exiting-Gateway assertion by retiring all 32 subscriptions instead of zero.
- Real macOS CLI `gateway run` → `skills.status` → SIGTERM, with 20 extra skill roots and 293 reported skills: `restart.close.skills-watcher` fell from **514.9 ms to 0.4 ms**. Both processes exited cleanly without reaching the shutdown deadline.
- Total SIGTERM-to-exit time was 2.588 s before and 11.311 s after; the candidate spent 7.58 s in plugin metadata retirement under host contention. This demonstrates removal of the skills-watcher bottleneck, not an overall shutdown speedup.
- The native comparison used the runtime change at `adfd008c553f`; the final adjustment only narrows an internal export and fixes optional-promise handling in the regression test.
- All 16 focused startup/watcher tests passed on the final head (67.19 s wall time for the two-file command); core and core-test type checks passed.
- [Final-head CI is green](https://github.com/openclaw/openclaw/actions/runs/38032671854). The plugin-activation test initially reported `settled` instead of `worker`; rerunning that job on the unchanged head passed.

Two-way door: reverting restores the previous shutdown behavior. The blast radius is skills watcher cleanup during Gateway shutdown; normal skills discovery and refresh are unchanged.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit 8832904b171a34dd5b134f9985208d2ecabea24f)

* fix(memory): rebuild cached index managers when provider config changes (#151263)

* fix(memory): rebuild cached index managers when provider config changes

A models.providers hot reload never rebuilt an already-cached memory
index manager: the manager cache key never saw the provider config the
embedding adapter reads, so a manager built against an absent or wrong
endpoint kept retrying that config for the lifetime of the process.

The openai-compatible adapter now exposes its synchronous, secret-free
resolveIndexIdentity (mirroring the runtime cacheKeyData slice), and the
memory provider requirement embeds that identity so the registry cache
key changes with the endpoint/model and rebuilds the manager.

Closes #151055

* fix(plugins): carry sanitized headers into the index identity mirror

The synchronous resolveIndexIdentity mirror omitted the sanitized client
headers that the runtime cacheKeyData includes, so a stored identity
written by the runtime hashed differently from the identity resolved by
plain status reads. An unchanged configuration was therefore reported as
a provider_settings mismatch, and rebuilding could not clear it because
the writer kept the header-bearing identity.

Derive the sanitized headers in the mirror from the same configuration
inputs (the sanitizer drops auth-bearing names, and buildHeaders without
an apiKey adds no auth), and share the destination-ownership check
between both paths instead of resolving it lazily only at create time.

* chore: retrigger CI against an updated merge base

The hybrid compact fallback timing assertion failure was fixed on main
by settling exclusive admission before runtime placement; retrigger so
the merge commit picks that up.

* chore: retrigger CI after a shared-state broker admission clash in checks-node-compact-large-12

* fix(memory): refresh cached managers after provider config reload

Use the memory index service's existing reload lifecycle for models.providers
changes. Retire cached managers before reacquiring them with the new config,
without adapter-specific identity polling on the memory search path.

Related: #151055
Co-authored-by: ruel225 <[email protected]>

* chore: prune stale max-lines allowance

* test(memory): identify bundled reload fixture ownership

---------

Co-authored-by: ruel225 <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
(cherry picked from commit 72eafadc01a01781cd4ac114f9397c02af9b367f)

* fix(ai): keep unfinished reasoning private at tool boundaries (#168294)

* fix(ai): keep unfinished reasoning private at tool boundaries

Do not recover an unfinished inline reasoning block when a native tool delta arrives before the terminal finish reason. Preserve ordinary terminal-stop text recovery.

Loopback HTTP regressions cover managed and direct streams ending in length or content_filter. Remote focused suites, changed-lane tests, targeted lint, formatting, and core types pass. Full check-changed stops on the inherited 456/455 environment-variable count budget failure, reproduced against the untouched index.

* test(ai): await completion streams and refresh cache telemetry parity

Await the transport factory before iterating or reading its typed result. Record the cacheTelemetry fields introduced by 96c8ba5fe64 in the successful OpenAI parity snapshot.

The complete successful request/event/terminal trace matches the PR parent byte-for-byte against the refreshed snapshot; no production behavior changes. Remote parity, transport suites, exact core-3 type graphs, root stripe 2/4, format and lint pass. The full changed lane reaches an unrelated SQLite iterator-custody failure, reproduced standalone on Node 24.19.0 and CI Node 24.21.0.

(cherry picked from commit 757d73980426df41869314a063b17fc847b36511)

* fix: prevent session admission stack overflows in large fleets (#168354)

* fix: prevent session admission stack overflows in large fleets

Flatten bulk database writer acquisition without changing synchronous FIFO reservation or inherited async authority. Share the established session identity acquisition loop and unwind partial reservations when a later acquisition throws synchronously.

Cover fleet-scale success and original rejection delivery, caller context, reentry, competing writers, and partial-acquisition failure. Refs #168160.

* fix: include acquisition helper in maintainer wrapper

Keep the trusted-anchor runtime source inventory closed over the new agent admission dependency. Both complete wrapper closure suites pass; production source is unchanged from the fleet proof.

(cherry picked from commit 38fee354e63626edea4ce6f620461acc15d571f4)

* fix(models): Claude CLI models vanish from the picker after a plugin config change (#168315)

## What Problem This Solves

Fixes: every Claude CLI (`claude-cli/*`) model disappears from the model picker and `models.list` after a dynamic config change to `agents` or `plugins`, such as turning on ACP OpenCode in Models settings, until the catalog is explicitly refreshed.

## User Impact

User impact: Claude CLI models stay listed when another plugin or agent setting changes while the Gateway is running. Turning ACP OpenCode on now shows its models next to Claude CLI instead of replacing them.

## Why This Change Was Made

A config change to `agents` or `plugins` rebuilds the prepared model catalog. The rebuild keeps a discovered provider's rows only when the new agent facts prove the same account. Claude CLI availability comes from a discovery-only native sign-in credential that the rebuild's agent facts do not carry, so its rows were dropped. The follow-up changed-only pass then only looked at providers with stored credentials, so nothing reacquired Claude CLI.

The changed-only pass now also reacquires providers that the rebuild could not retain and that the new inventory still lacks. Retention rules are unchanged: unverifiable rows are still not carried over. The provider is reacquired under the new generation. The changed-only provider selection moved next to the retention decision in `prepared-model-runtime.catalog-source.ts`, which keeps `catalog-access.ts` under its line cap.

No config, schema, or protocol changes.

## Evidence

Regression: `src/agents/prepared-model-runtime.catalog-owner.test.ts` › "reacquires discovered providers that a config rebuild cannot retain". It publishes an inventory in which one provider's credential exists only in discovery auth, rebuilds after an unrelated `plugins` change, and runs the changed-only pass.
- origin/main production code: fails, catalog is `[ 'plain/plain-model' ]` (the discovery-only provider is gone, no worker reacquisition).
- This branch: passes.

Real Gateway (isolated loopback profile, native `claude` login, no API keys, acpx `nativeAgents.opencode=false` at start). `config.patch` set `plugins.entries.acpx.config.nativeAgents.opencode=true` (dynamic reload, no restart), then `models.list`:

| Build | view `all` before | view `all` after toggle | `default`/`configured` after |
| --- | --- | --- | --- |
| origin/main a285e8b | claude-cli 11, kimi 4, openai 8 | acp-opencode 84, kimi 4, openai 8 (**claude-cli 0**) | acp-opencode 84 only |
| this branch | claude-cli 11, kimi 4, openai 8 | acp-opencode 84, claude-cli 11, kimi 4, openai 8 | acp-opencode 84 + claude-cli 10 |

Toggling it back off on this branch kept claude-cli 11 in every sample, and no sample returned an empty list. On main, a `refresh: true` before the toggle did not prevent the drop.

A Claude CLI turn (`openclaw agent`, session model `claude-cli/claude-haiku-5-5`) on the same Gateway went through the Claude Code CLI runner. Claude Code refused it at the account's usage cap with `{"type":"cli_error","message":"You've hit your weekly limit · resets Oct 12 …"}`. That confirms the routing, but there is no completed reply.

The real-Gateway run used the first version of this fix. The final commit moves the same changed-only provider selection into `catalog-source.ts` to stay under the line cap; behavior is unchanged and the regression above passes on the final commit.

Checks: `pnpm exec oxlint --type-aware` on the changed files; focused Vitest for the catalog-owner, catalog-publication, and native-picker-failures suites; `node scripts/check-changed.mjs`.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit a14a5d1908eb567012624675d349266b86ff10d1)

* fix(codex): reap clients after model discovery times out (#168365)

Retire initialized shared Codex app-server clients when written model-discovery requests time out. Reuse the existing graceful retirement owner so active sibling leases finish before the process pair is reaped; successful discovery, pre-write cancellation, and native error responses retain their behavior.

The reviewed production-only negative control returned the same pooled PID. An isolated 45-agent Gateway comparison retained 90 processes on main and zero with the fix after 17 minutes. The PR records focused regression, full module, typecheck, and exact-head hosted CI evidence.

Land with the inherited CI exception for check-test-types-core-4: src/gateway/control-ui-public-session-refresh.test.ts(51,19), TS2345. …
tomorrowflow added a commit to tomorrowflow/openclaw that referenced this pull request Oct 13, 2026
* fix: retry chat initialization after rolled-back maintenance conflicts (#168078)

* fix: retry chat initialization after rolled-back maintenance conflicts

Worked on by:
- @steipete

Co-authored-by: steipete <[email protected]>
OpenClaw-Publication: 0215b7ad-4025-4ae1-80d3-6eda33c62608

* test: isolate memory maintenance fixture contracts

Reuse the verified fixture corrections from f5398146821c37bcb4d0866519f11208d6ece0c8 and assert complete retained archive context.

Co-authored-by: jacobtomlinson <[email protected]>
Co-authored-by: steipete <[email protected]>

* test: align CI fixtures with current lifecycle contracts

Retain typed maintenance refusal, native upsert, recovery-owner, and provider-turn assertions; preserve fallback failure diagnostics.

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

* fix: preserve dispatched user projections across model fallback

Treat retry instructions as an internal continuation only after the recorder owner confirms provider dispatch. Keep the original turn and its frozen projection unchanged.

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

* fix: retry chat initialization after rolled-back maintenance conflicts

Worked on by:
- @steipete

Co-authored-by: steipete <[email protected]>
OpenClaw-Publication: e524f5ea-75a5-4bc6-bb02-f099d23f5355

* fix: retry chat initialization after rolled-back maintenance conflicts

Worked on by:
- @steipete

Co-authored-by: steipete <[email protected]>
OpenClaw-Publication: 3d106eed-5360-48ec-99f0-11f51ef147a5

---------

Co-authored-by: steipete <[email protected]>
Co-authored-by: jacobtomlinson <[email protected]>

* test(doctor): expect migrated Claude CLI wildcard routing

The Anthropic Doctor repair intentionally adds anthropic/* for legacy
Claude CLI sign-ins without an API credential. Keep the exact migrated
model-map and allowlist assertions, and check that an unseeded Claude
model resolves to claude-cli. Isolate ambient Anthropic credentials so
the fixture always exercises that repair.

* fix(vllm): honor declared reasoning efforts in served template dialects (#150149)

* feat(vllm): expose a reasoning-effort ladder for Qwen thinking formats

The vLLM plugin flattens every Qwen thinking-format model to a binary
`/think off|on` profile and strips `reasoning_effort` from the request,
because Qwen chat-template thinking is an on/off flag. vLLM reasoning parsers
can honor `reasoning_effort` as well, though: the server in front of
qwen38-flash-next accepts `low`, `medium` and `xhigh` and rejects the rest, so
the flag alone leaves the effort at the server default with no way to lower it.

Let a model row opt in through the existing `compat.supportedReasoningEfforts`
list. When a Qwen-format model declares it, the plugin exposes that ladder
(plus `off`) instead of the binary profile, the completions transport keeps
sending the level as `reasoning_effort` next to `enable_thinking: true`, and
the plugin's payload patch no longer deletes it while thinking is enabled.
`/think off` still sends only the disabled flag. Rows without the list keep
the binary profile and payload exactly as before.

* fix(vllm): preserve model mappings and current-call dialects

* fix(vllm): preserve native effort mappings during session setup

* style(vllm): use boolean reasoning guards

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: krell11 <[email protected]>

* fix: Doctor skips diagnostics when maintenance is declined (#168065)

* chore(agents): cover promised-stream recovery and repair custody (#158495)

Co-authored-by: Gio Della-Libera <[email protected]>
Co-authored-by: Gio Della-Libera <[email protected]>

* fix: custom reasoning models ignore thinking levels (#168056)

* fix: send thinking controls to custom reasoning models

Enable compatible-route effort defaults for reasoning-capable models while preserving explicit opt-outs and provider dialect exclusions. Omit implicit off controls on custom scalar routes, preserve declared off contracts, and surface unsupported fields with the model-level opt-out instead of silently retrying off.

* test: use the request effort type in custom route cases

* docs: clarify custom model effort admission and clamping

* chore(release): prepare 2026.10.5-beta.1

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(changelog): carry interim 2026.10.5 notes

Interim section so packaging gates have a 2026.10.5 body; regenerated from full history once the Code SHA is green.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(release): mxc-sandbox npm preflight fails on unreviewed mxc-sdk 0.9.0 bwrap probes (#168165)

* fix(release): review mxc-sdk 0.9.0 bubblewrap probe spawns in plugin npm scan

@microsoft/mxc-sdk 0.9.0 (from #167411) adds three bwrap-probe scripts that
spawn a fixed `bwrap --version` probe through a detached Node anchor. Record
exact reviewed counts for them and shrink platform.js from 4 to 3 so the
@openclaw/mxc-sandbox exact-artifact scan passes again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(release): keep mxc-sdk platform.js limit covering the stable line

Stable v2026.9.9 still ships mxc-sdk 0.8.0 (4 platform.js exec sites), and
the dependency inventory is a shared upper bound across supported release
lines, so keep the limit at 4 and note that 0.9.0 has 3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
(cherry picked from commit ae71c921365ab735c8b31fa15e4310d43dfe9f06)

* fix(ci): narrow release harness lockfile to its sparse checkout (#168172)

pnpm 12 rejects a frozen install whose lockfile records importers that are
absent on disk. The trusted release harness is a sparse checkout (scripts,
packages, patches), so every harness install failed with
ERR_PNPM_OUTDATED_LOCKFILE after the pnpm 12 bump (#167411), blocking
Full Release Validation's npm artifact preparation.

Co-authored-by: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 5a680062cdb3554b52e3eee5499e24bf8c0a3850)

* test(lint): allowlist sqlite observer iterator receiver capture

00ae274c0a1 (#168029) intentionally captures native iterator next/return so its wrappers can invoke them with the caller's receiver; record the two suppressions on the explicit allowlist.

(cherry picked from commit bc8f693df3aee184c65626f7e9c9c58889c51a8b)

* test(gateway): observe catalog renewal without forcing a refresh

Since #168050, an explicit forced catalog refresh waits for an ordinary expiry renewal and then starts a fresh acquisition. The metadata fixture used that operation as a wait barrier, unintentionally requesting a second renewal and turning its failure case into immediate recovery.

Wait for the existing catalog-published or catalog-failed event instead. Preserve every publication, broadcast, pending-status, recovery and dedupe assertion without changing production behavior or timing limits.

Linux proof: parent passes 5 cases; #168050 and current main fail the same 3. The repair passes all 5 and 41 metadata siblings. Injected duplicate publications fail the exact retained assertions. Types, lint, check-changed and P2 review pass. Full owning config records 4894 passes, 13 failures reproduced on clean base, and a separate SQLite WAL-identity SIGKILL; its unfinished test passes separately on clean base.

(cherry picked from commit 5033097b75dd6a8582a07a6b22969a75d750d8f7)

* test(gateway): observe query probes in memory reload fixture

Follow #167891, which routes embedding availability probes through the query-budget embed operation. Record that operation in the synthetic provider alongside batch embedding so reload recovery still verifies the exact provider generation and subsequent indexing.

Keep every recovery, watcher, and indexing assertion unchanged. No production behavior or timeout changes.

(cherry picked from commit fc7c5047e59a7d7d4ae37b0f8991786d2def1b76)

* test(memory): align incognito status with configuration diagnostics (#168182)

The status command intentionally gained trigger-recall and cross-conversation setting details in e5bc415fed93 (#164409). Keep exact response equality while expecting all three lines, preserving the existing prompt, incognito actor, host-SQL, and authority assertions.

(cherry picked from commit dfdda05fe3c5d2e71c916f8662996f6ccec8d1e1)

* fix(release): settle generated npm locks at npm's reload fixpoint (#168191)

npm --package-lock-only can assign nested override sets to a shared node
differently on a fresh tree than when it reloads the written lock, so the
package-local bundled dependency install (npm ci --install-strategy=shallow)
rejected amazon-bedrock-mantle's lock with 'Missing: @smithy/[email protected]'.
Rerun npm from the written lock until it is unchanged (bounded), folded into
the existing shrinkwrap-override repair loop.

(cherry picked from commit 9250ad1213ef21cfb569bbe1598c2663324cf9c2)

* fix(ci): align UI recovery tests with current interaction contracts (#168195)

(cherry picked from commit 5c7d73950d93896b51b99cbf6cc0ce8149f1577a)

* build(release): pin pnpm 12.9.0 from #168103

Backport only the pnpm 12.9.0 selection from main's dependency refresh
(c44c2e51ad3, #168103): packageManager, the lockfile env header, image seed
hashes, bootstrap/installer pins and their tests. pnpm 12.9.0 accepts lockfile
importers absent from the sparse release harness, which pnpm 12.7.0 rejects.

(cherry picked from commit c44c2e51ad3fdeaa84a0aa35a36c4f83a116c746, pnpm hunks only)

* Revert "fix(ci): narrow release harness lockfile to its sparse checkout (#168172)" (#168217)

pnpm 12.9.0 (pinned on main since #168103) already accepts lockfile importers
whose directories are absent from the sparse release harness. The narrowing
step rewrote .release-harness/pnpm-lock.yaml, which leaves the trusted harness
tree dirty and fails npm preflight's clean-harness guard
([[ -z "$(git -C .release-harness status --porcelain)" ]]) in
"Prepare publishable npm package".

This reverts commit 5a680062cdb3554b52e3eee5499e24bf8c0a3850.

(cherry picked from commit 4578c1dde1cb8b7217709845d091176e1d2cccc5)

* fix(update): leave live current handoff owners alone in update repair (#168197)

#168043 treated every protocol-free version-2 update lease as legacy custody, but current writers still create root leases of that shape. With another live updater or repair holding the root lease (for example parallel qa-lab packaged-candidate setups sharing the per-machine handoff database), openclaw update repair exited 1 with 'Handoff owners are live or unverified' instead of leaving the live owner alone, which broke checks-ui-e2e-real-gateway on main. Legacy update reclamation now requires a child-lineage key; live root owners make repair a no-op as before, while dead legacy child-lineage rows (#168000) are still reclaimed and live or uninspectable legacy children still get actionable guidance. Refs #168000.

(cherry picked from commit efa552b9cef854d4f0b74eb8119ae9035f4fb79b)

* test(plugins): pin a stable host version in managed install channel tests (#168230)

(cherry picked from commit 0a55cbe057e0e0f4d7a2013e01e925b0fcfbca93)

* test(gateway): expect cold-start discovery before credential-free refresh (#168235)

Since #167458 cold Gateway startup runs the full discovery an explicit
refresh would, including providers without credentials. Since #168050 an
explicit refresh does not join an ordinary in-flight acquisition and
acquires fresh responses instead. The credential-free models.list test
still asserted that startup made no provider request, so it depended on
whether startup discovery had fetched before the first read (CI: 2
requests; slow hosts: model already published).

Wait for the startup publication (1 request), then prove the explicit
refresh publishes the fresh response (2 requests) and replaces the
startup row, and that ordinary reads do not rediscover.

(cherry picked from commit 9fc63cc93f65fd27bf390cc9a77ffb5f0bc57cf9)

* fix(ci): gateway config RPC suite deadlocks on agent mutations after acknowledgement barrier (#168242)

* test(gateway): hold agent config publication mid-RPC instead of across it

Since #167894 agents.create/update/delete acknowledge only after the
config reloader applies the write. The config RPC suite held its hot-reload
barrier across the whole agent RPC, so the RPC could never settle and the
client timed out. Read config.get while publication is held mid-RPC, then
release, and drop the unneeded barrier from the large-shrink delete case.

* test(gateway): keep the reload hold in one barrier hook

(cherry picked from commit 5c6b01a42fa76b4555f475278c554dbc6984e82d)

* fix(release): keep ClawHub retry classification source-resolvable in release harness (#168234)

(cherry picked from commit 21490fb9dc601f5eb9b398ee1b2bbfc6768aacfb)

* fix(ci): ignore the dormant sqlite source-fence admission module in Knip (#168241)

#168018 landed src/infra/sqlite-source-fence-admission.ts as the dormant host
half of the durable cross-store source fence; only its broker tests import it,
so deadcode:full fails check-dependencies on main and release branches.

(cherry picked from commit d719f09ad46f2bbe07a97aa9c50845e672fefc40)

* test(whatsapp): expect carried overflow in long styled chunks

The WhatsApp delivery-recovery test for long bold replies has been red on
main since #167958 (69bfe7b645c8). That change taught the shared
render-aware Markdown chunker to carry the overflow of a re-split chunk
into the next source window instead of sending it as its own tiny
message. A 340-character bold reply at textChunkLimit 160 now arrives as
*x158* / *x158* / *x24* instead of *x158* / *xx* / *x158* / *xx* / *x20*;
the old expectation encoded exactly the orphan-chunk artifact #167958
removed.

Update the expectation to the intended contract: every chunk keeps its
style markers and stays within the limit, the content is exact, only the
first chunk quotes the reply target, and each part reports one receipt.
Reverting only render-aware-chunking.ts to 69bfe7b645c8^ restores the
old output, which pins the cause. Main's scoped CI never selected this
suite for the markdown-core change, so the red surfaced only when a later
PR widened changed-test selection.

(cherry picked from commit 281379b0111a2c7c18afff10d00845614f7325cf)

* test(e2e): accept Doctor pinning ownerless legacy cron jobs to their historical owner (#168314)

(cherry picked from commit b43da95af1513b59c19df2c3390c78fc9909e29e)

* fix(plugins): Windows Gateway startup stalls capturing installed plugin files (#168313)

Plugin source capture routed every Windows file through fs-safe's guarded
clone, which skips native copies and path-admission caching on win32, so
Gateways with installed plugins spent minutes in synchronous capture before
binding (cross-OS installer-fresh, release checks 38020418926). Windows now
uses the existing pinned-descriptor copy for small ordinary files, as it did
before the guarded-clone migration (#164680); large and native files keep the
guarded clone. The small-copy guard tests now run on Windows too.

(cherry picked from commit 2cb28836a5deefd4c8b87f6188db2955f77df24c)
(cherry picked from commit e86845769895c9b417ce7846787a6f1a85106725)

* fix(sessions): register disk-budget worker as a runtime process entrypoint (#168310)

The vitest worker build compiles runtimeProcessEntrypoints but not ad hoc
tsdown entries, so children running from the compiled test tree could not
load config/sessions/disk-budget.worker.js.

(cherry picked from commit 587a19170f3c333ad94507212e1ea18ec7c52d18)

* test(plugins): settle the startup index before measuring memory watcher retirement (#168327)

The test disposed Memory Core immediately after opening its manager, while the
dirty startup index sync was still running. Close drains accepted syncs by
contract, so on loaded release-ci runners the drain exceeded the fixed 5s
plugin retirement budget (PluginInstanceDrainTimeoutError, 2 still-running
calls); cleanup itself settled about 3.7s later. Settle the startup index
first so the budget measures watcher retirement.

(cherry picked from commit fdb06ff5ca8cb1fad79f16e0b976996503345116)

* test(plugins): park the late memory probe on embed, not embedBatch

#167891 moved the memory embedding probe to provider.embed, so the late-probe
fixture parked on embedBatch never entered and the test hung until its 120s
timeout in every release-ci checks-node-agentic-plugins run.

(cherry picked from commit 3cfab51ef9a8, src/plugins/memory-runtime.owners.test.ts hunk only)

* fix(agents): re-admit runs on the configured generation after a catalog publication (#168410)

* fix(agents): derive run owners from admitted generations after catalog publication

* test(agents): cover superseded admitted generations with uncovered selections

* fix(agents): re-admit uncovered selections on the configured generation

* fix(agents): re-admit only superseded configured generations

* test(agents): keep derived parents confined after catalog publication

* fix(agents): bind re-admitted generation locally and prove revocation rejects re-admission

(cherry picked from commit 171df4e1c5a08e1da631c4fff50c420db2bb6f84)

* test(gateway): retry plugin reload refused by post-ready registry refresh (#168594)

* test(gateway): retry plugin reload refused by post-ready registry refresh

* test(gateway): await post-ready maintenance before plugin reload instead of polling

* test(gateway): drop default deferred type argument

(cherry picked from commit 4e3707f634c9f2176ed2d18034c8389484e4ae25)

* test(plugins): start dreaming under the boot path, not the reload candidate deadline (#168608)

* test(plugins): start dreaming under the boot path, not the reload candidate deadline

* test(plugins): observe dreaming starts through a typed spy

(cherry picked from commit 8076cd878f22bf41cf104feaf7fa8be037bc7029)

* test(qa-lab): size the repeated-turn child close budget for loaded CI (#168622)

(cherry picked from commit 53d2109ebfce9e2612115315d8b814cbcef6266d)

* docs(changelog): 2026.10.5-beta.1 release notes

* fix(release): make update compatibility coverage test-only (#168836)

(cherry picked from commit c6d71fae0ed1c0f7968c8d05c410345246af235b)

* docs(changelog): record #168836 in 2026.10.5-beta.1 notes

* fix(release): record 2026.10.1 updater compatibility (#168740)

(cherry picked from commit 217d8bfb7cfa06a5a6c7d3381f92cbae7b269eac)

* docs(changelog): record #168740 in 2026.10.5-beta.1 notes

* fix(update): keep the 10.1 updater's original cleanup queue across replacement (2026.10.5 backport) (#168883)

* fix(update): keep the 10.1 updater's original cleanup queue across replacement

Backport of the cleanup-owner bridge from #168849 for 2026.10.5-beta.1.
The 2026.10.1 cleanup facade now re-exports runCliDisposerAfterPending through
the original owner URL so Node reuses the already-loaded pending-disposer
queue. Recorder and historical inventory changes from #168849 are not included.

* docs(update): keep only the 10.1 cleanup-bridge note in the backport

* docs(changelog): record #168883 in 2026.10.5-beta.1 notes

* fix(test): seed retained OAuth sidecar after published baseline setup

The published-driver upgrade lane added a synthetic orphan OAuth sidecar before
baseline Doctor. Published OpenClaw 2026.10.1 refuses that retired state during
fixture setup, so scheduled main run 38106494410 failed before invoking the
candidate updater. Seed the same bytes immediately before update, after baseline
Doctor and session preparation. Keep the post-update byte-preservation assertion
and referenced-sidecar security behavior unchanged.

Extend the existing lifecycle fake to require absence during baseline Doctor and
presence when update starts. No new test cases, timers, retries, or weakened exit
assertions are added. The original driver with these assertions failed at
seed-state; the fixed existing six-case lifecycle harness passed (10.337s summed
case time). Syntax, scoped oxlint, Docker E2E package guard, formatting, and diff
checks passed. Independent Codex autoreview was scoped-clean through P2.

Real published-driver proof on Blacksmith Testbox
https://github.com/openclaw/openclaw/actions/runs/38107590369 used
OPENCLAW_PUBLISHED_DRIVER_LEGACY_SQLITE=1 and published 2026.10.1 against a
canonical package built from cfcb7bda177 plus this exact two-file patch (source
carrier 438ed57bfac616d285ef251d9c3f10729b5f83dd). Baseline seed-state passed in
7.957s; service readiness, identity and durable/incognito session setup passed.
The full cell remains RED: update recorded finished/succeeded but its published
caller exited 1 after 195.355s while resolving its old runtime-cleanup-DlrF_x2c
chunk after package replacement. Current main's earlier cleanup-import fix
eded1a387b79 (#165233) cannot change that already-running published caller;
separate branch fix/update-cleanup-stable-driver at b2276e6d84aa owns candidate
compatibility repair. All candidate cleanup chunks match the tarball's content
inventory; the obsolete hash is absent from both tarball and compatibility
inventory. Later post-update preservation and repeat-upgrade assertions were not
reached, so this is proof of the original fixture repair, not a green upgrade
cell. Candidate Doctor also emitted retired setup-inventory warnings, traced to
a returned metadata callback outliving its newly disposed scope (01ead786dc19).

Remote proof completed in 608.221s including canonical package build; the package
build took 3m25.9s. Artifacts downloaded and task-owned Testbox stopped, with
completed status verified. The Doctor title PR candidate was not included in this
emergency fixture proof.

(cherry picked from commit 951dffef48a9f5458984d87890c42cf8ae203ab7)

* docs(changelog): refresh 2026.10.5-beta.1 record target

* fix(update): accept native Windows spellings of the recovery capture directory (#168968)

* fix(update): accept native Windows spellings of the recovery capture directory

The post-swap Doctor compared the pinned capture's native realpath string with
the locator the driver recorded. On Windows, native realpath expands 8.3 short
names and normalizes case, so an update from published 2026.10.1 under a
short-name profile path refused with "Update recovery capture changed
location" and rolled back. Compare the recorded path's own lstat identity
with the pin instead: it must still be a real directory (not a link) and the
same directory, regardless of spelling.

* fix(update): compare the capture identity with exact bigint stats

* fix(update): rely on the pin's exact identity check for the capture locator

(cherry picked from commit a216ad8eea6a15fee9341f7bdf2f51e9012ec441)

* docs(changelog): record #168968 in 2026.10.5-beta.1 notes

* fix(update): serve the 2026.10.1 updater's pending-migration read after replacement (#169031)

(cherry picked from commit 34e71463b60e42ab073f576502e3daf996009dfa)

* docs(changelog): record #169031 in 2026.10.5-beta.1 notes

* test(gateway): stabilize manual model policy catalog fixture

Author contextWindow for all synthetic models so the legacy and
capability-negotiated requests compare the same public metadata even when
background catalog discovery completes between them. Keep the strict row
comparison and all policy, auth, session, and default-reset assertions.

The intended credential-scoped background enrichment by Ayaan Zaidi in
#167460 can fill
omitted windows with 128000; the public response field is not an internal
leak. A controlled real-worker completion reproduced the hourly mismatch.

Validation: controlled before/after reproduction, 20 pressured runs,
three original CI shard replays, types, lint, format, boundaries, and P2.
The whole owning config ran; its five unrelated failures all passed when
run independently. Existing dead-export findings remain outside this fix.

(cherry picked from commit 504885e7b765c7f99182e152cbe95d8e922cc958)

* test(codex): wait on catalog publications instead of timing cold model reads (#169281)

The first demanded models.list prepares the cold catalog worker before native
discovery starts. Its duration is host-dependent (about 15s on loaded CI shards,
18-45s on a loaded local host), so a 15s expect.poll could expire while that
first read was still running and fail with its pending, row-less result.

Wait on prepared catalog publications through the shared
waitForCatalogPublication helper, bounded by the test signal, for both the
initial native row and each account transition.

(cherry picked from commit 68127439e6c989a585f35c0e3ac8d767d758bd09)

* fix(update): retain and reclaim updater runtimes under alternate path spellings (#169292)

The updater decides whether to retain its own runtime by checking that the native realpath of its package root is inside an install being replaced. Mutation roots, the package owner, cwd and the temporary directory were resolved with the spelling-preserving realpath, so a Windows 8.3 profile (C:\Users\RUNNER~1) or a differently cased path on a case-insensitive volume made the replaced install look unrelated. The updater then skipped retention and its workers loaded the replacement package's code. Retained-runtime maintenance had the same split: it compared ordinary-spelled marker paths and live registrations with native realpaths, so it could neither recognize abandoned runtimes nor match the live owner. Resolve all of these boundaries with the native identity resolver.

(cherry picked from commit 032a58bf34d643d59482656bfe0005c27d5c1e17)

* chore(build): stop packing the update-compat inventory (#169268)

(cherry picked from commit db8dbef60ed6c03b4fb9e0bee1f820a1815b988b)

* chore(deps): refresh eligible dependencies through October 2 (#168103)

Refresh compatible dependency pins published by 2026-10-02T22:42:59Z,
including pnpm 12.9.0 and authenticated CUA 0.32.0 native artifacts.
Keep reproduced compiler, patched-package, and native compatibility holds.

Classify Gemini CONTINUATION responses as length-limited in both transports,
preserving partial content without promoting incomplete function calls.

Make the benchmark deadline fixture wait for owned child readiness and
assert abort and deadline results outside deadline error normalization.

(cherry picked from commit c44c2e51ad3fdeaa84a0aa35a36c4f83a116c746)

* fix: Doctor maintenance fails when state inspection is slow (#168161)

Worked on by:
- @obviyus

OpenClaw-Publication: 85113cab-ac33-4ffb-9385-7afc8fbd683e

Co-authored-by: obviyus <[email protected]>
(cherry picked from commit 0c91469b2dabc593638e7080b6674fda5f1dee3b)

* fix(update): recover blocked updates after completed receipt identity drift (#168388)

* fix(update): recover retired receipts with an independent helper

Allow a newer standalone recovery helper to archive an exact completed publication receipt under fresh update ownership, preserving bytes and leaving the serving installation unchanged. Keep unfinished recovery bound to its original helper. Document the first-hop recovery route for published updaters blocked by historical device IDs.

* fix(update): clarify completed receipt recovery checks

Avoid shadowing the prior settlement during archival, check external status before the stale-receipt regression, and link the first-hop recovery procedure from update repair guidance.

(cherry picked from commit eae2e5421daa5b0647126830917df8772ab35f70)

* fix: preserve model fallback after provider timeouts (#168605)

Restore configured model fallback after a primary provider timeout by checking failed, aborted, and yielded attempt eligibility before reading the completed-turn transcript boundary. Remove duplicate eligibility checks while retaining successful-turn authority validation and transcript integrity assertions. The shared finalizer also serves ordinary replies.

Related: #168456
Related: #168509

The separate keyed-user assertion reported on fallback re-entry remains unverified; #168456 stays open.

Validation: production-boundary regression and failing production-only negative control; 125 files / 1,454 tests and core plus affected test-type graphs on Testbox; live isolated Gateway proof with a synthetic provider showed two primary requests, one fallback request, one delivery, one original user key, and one final answer. Independent review found no actionable findings. The reviewed patch was unchanged by the subsequent main integration; GitHub CI gates bind the prepared head.

Co-authored-by: Peter Steinberger <[email protected]>
(cherry picked from commit e52cbaafccaeffdc5f75ea7925d0364a902b1d56)

* fix: preserve replies while their agent finishes starting (#168826)

New replies arriving while an agent is still starting now wait for its prepared runtime publication. Ready agents remain available and existing cancellation and failure handling is preserved.

Closes #157814.

Proof: startup tests 10/10; original production fails both regression cases; adjacent admission/auth tests 38/38. Required CI passes. Production LOC +20. Static checks pass except the independently reproduced baseline dead export documented in the PR.
(cherry picked from commit cce7888a7c73e3b5aa26f4470ec81649e23d8327)

* fix(update): carry the service heap budget into update children (#168889)

Doctor, candidate checks, recovery and verification spawned by openclaw update now inherit the managed Gateway service's Node heap controls (service argv --max-old-space-size and NODE_OPTIONS), so large-state hosts no longer OOM during update. Only heap flags are projected, never service preloads. Fixes #168729.

(cherry picked from commit 9a62c5b5cd2eb98a47e7091dfa1484cfe8dd7809)

* perf(update): skip redundant rehashing during retention and publication (#168958)

Runtime retention no longer rehashes files whose ctime changed only because of its own hard link, and package publication reuses settled verification observations instead of re-reading unchanged trees. Backup, rollback, copy verification and metadata checks are unchanged. Measured tiny-state update: 8m14s -> 6m31s (publication 145 s -> 84 s).

(cherry picked from commit c96fac1cc6a48f7249ac21575a73e025bfcc3e51)

* fix(update): run deferred official owners' webhook-listener migration in candidate Doctor (#169035)

Updating to 2026.10.1 with an enabled webhook channel (e.g. Microsoft Teams) could fail before activation: candidate Doctor skipped the host webhook-listener migration because the installed official owner was deferred, then candidate startup required that migration. Doctor now resolves the trusted deferred owner's migration while preserving installed-owner origin, allowlists and authored endpoints. Fixes #168872. Supersedes #168962, thanks @sirius1024.

(cherry picked from commit 054004acbc73fc814882cd696afc851eb4c251dc)

* fix(telegram): resolve polling workers in source and package builds (#154286)

Restore Telegram polling from source checkouts and compiled plugin captures. Resolve the worker through the shared runtime owner, retain its package build entry, and preserve CPU tracking, acknowledgement, and shutdown behavior.

Validated with a failing baseline regression, 3 focused tests, real worker polling against a synthetic HTTP Bot API in source/package/host layouts, full build, formatting, type-aware lint, package typecheck, and independent review. Required CI is green. The max-lines and unused-export failures are independently reproduced on pristine main.

Fixes #154180.

Co-authored-by: 琚耀辉0668001366 <[email protected]>
(cherry picked from commit dd053f96aa300a82443d5ab9725f206214e9c36e)

* fix(update): settle legacy package-activation records after metadata-only drift (#169027)

A 2026.9.8 activation record whose previous package tree changed only in ctime/nlink (its own rollback touches them) could never be retired or repaired, blocking every later update. Legacy-format records now settle when root identity and package version match, with a recorded warning (the previous generation is reinstallable package code, not user data); current-format records keep full verification. update repair no longer exits 0 while package recovery is still pending. Fixes #168856.

(cherry picked from commit 3e832726ad2a19e1a19d07651e7817a6dd8aa2b9)

* fix(update): settle stale handoff leases and completed receipts instead of blocking updates (#169038)

openclaw update refused with update-recovery-pending when the managed handoff lease database was missing or replaced (e.g. after a temp cleanup), even though update repair could settle it, and refused completed previous receipts as not safely replaceable. Admission now runs the existing settlement when nothing is at risk (dry-run only reports it) and archives completed receipts. Production net +25 LOC after deleting the obsolete in-place receipt replacement path. Fixes #167506, #167771.

(cherry picked from commit ff6f58a8c32b6daa4bf1cf5f60b3493ae96d1764)

* fix(release): size the plugin publication manifest cap for its file-entry cap (#169084)

The publication manifest lists one inventory row per packed file, and the
tar entry cap already allows 20k files for bundled SDKs, but the manifest
itself was capped at 4 MiB. @openclaw/amazon-bedrock-mantle-provider
2026.10.5-beta.1 packs 14,206 files (bundled @aws/bedrock-token-generator),
producing a 4.47 MiB manifest that the publish step rejected before npm
publication. Raise the manifest cap to 16 MiB and keep packed package.json
on its own 4 MiB bound.

(cherry picked from commit d29e2d5be0f618c13417d74fa48216384ea3bb74)

* fix(ui): recover updated chats through the serving document (#168941)

* fix(ui): probe the serving document when recovering stale chats

* test(ui): gate recovery on the serving document

* test(ui): expect the serving document during login recovery

(cherry picked from commit cb1b6cdb9c74cd17b92b141a55c3f4e448ca5aba)

* chore(release): prepare 2026.10.5-beta.2

* docs(changelog): 2026.10.5-beta.2 release notes

* fix: stop catalog refreshes retaining duplicate native plugin graphs (#169272)

Related: #159662. This repairs its duplicate native-graph retention path, not every reported memory-growth or shutdown symptom.

Supersedes #162080, carrying @mcooks-cmd's fix forward on current main. Thank you to @mcooks-cmd for identifying and fixing the retained native-module identity problem; their branch is left intact.

## What Problem This Solves

Fixes: a long-lived Gateway's model-catalog worker retains another native ESM plugin graph whenever the same workspace's plugin context changes.

## User Impact

An unchanged installed native ESM entry now evaluates once per workspace during a catalog worker's lifetime. Registration remains generation-owned, workspaces remain isolated, and lazy imports—including imports from compiled TypeScript helpers—continue after the originating generation retires. New installed paths/workspaces still add resident modules; installed source replacements are picked up on worker restart. CommonJS and explicit recovery behavior are unchanged.

## Why This Change Was Made

Current main already caches each workspace's current plugin context, but replacing that context still gives unchanged installed code a new capture URL that Node cannot unload. The loader now owns one retained capture/compiler/module record per installed entry and workspace, with separate live generation owners. A single registration guard rejects calls through another generation's replaced API handle. Cleanup has one owner, including failed compiled evaluations.

This ports the fix onto main's newer source custody, digest validation, native recovery, Node/Bun selection, and admission reuse. The new identity module, instance-method monkey-patching, parallel retention maps, duplicate API-facade guard, separate worker fixture, both oversized retention test additions, and all knip/wrapper/test-inventory changes were eliminated.

## Evidence

Fresh real-worker comparison against main `34292e09ea88e45a4b0013470ce4ddc6c71aa3ca`, using the same generated installed `type: module` plugin, an initial catalog and **20 context changes**:

| Measurement | Main | Candidate |
| --- | ---: | ---: |
| Entry evaluations | 1 → 21 | 1 → 1 |
| Distinct capture URLs | 21 | 1 |
| Array buffers, first → last | 5,269,381 → 89,208,672 B | 5,269,386 → 5,063,679 B |
| Array-buffer growth | +83,939,291 B | −205,707 B |
| JS heap, first → last | 111,752,168 → 103,941,920 B | 114,025,592 → 108,785,304 B |

The regression fails on main and passes on the candidate. The fixture retains a 4 MiB typed array; the leak is visible in external/array-buffer memory, not an increasing sampled JS heap. These are generated-fixture measurements, not a replay of acpx/codex/slack.

- Focused proof: **174 passed, 1 skipped**, across eight files; wrapper wall time **81.52 s** with `--maxWorkers=1`. The catalog heap file took **26.80 s**, including its existing CommonJS regression. Boundaries cover workspace isolation, lazy import after release, compiled helper after release, failed acquisition/evaluation cleanup, stale-generation registration, source custody/recovery, and existing module-generation behavior.
- Real isolated Gateway: installed native ESM plugin, initial config plus three agent-model config edits, with the expected model returned by `models.list` after every edit. Seven worker catalog samples kept **one evaluation and one capture URL**. Two edits produced one expected catalog-superseded response while replacement settled; no other RPC failure. A separate run also passed three plugin-config edits (which replace the inventory worker). Both Gateways and their state were task-owned and cleaned up.
- Build passed; targeted Oxlint: **0 warnings/errors**; line-cap and max-lines ratchets passed. The build reports the same existing advisory `chat boot JS requests: 36 exceeds 35` on both main and candidate.
- Required `gpt-6-astra` review completed in three bounded passes. Its failed-evaluation compiler-retention finding was fixed and regression-covered; both subsequent passes found no actionable defects. The unchanged standalone Bun module-generation regression also passed.
- [ClawSweeper is ready on exact head `35acee784c154ed822a74fc35c71677006423837`](https://github.com/openclaw/openclaw/pull/169272#issuecomment-6112243735), with no findings or remaining proof requests.
- [CI run 38164303145, attempt 2](https://github.com/openclaw/openclaw/actions/runs/38164303145/attempts/2) completed: 53 jobs succeeded, 25 were unselected/skipped, and no jobs remain running or cancelled. The only failing test is `gateway.models-policy-reload.e2e.test.ts:175` (expected 0 artifact loads, received 1), also [reproduced on clean main `34292e09ea88e45a4b0013470ce4ddc6c71aa3ca`](https://github.com/openclaw/openclaw/pull/169272#issuecomment-6112330402); the aggregate CI gate consequently remains red. The previously cancelled shard passed on rerun.
- `openclaw/security-sensitive-review` passed with “No sensitive product changes.” No human security approval or bypass is required by that gate.

### Generation-authority proof

The final test extends the same real catalog-worker fixture; no mock registrar or substitute guard is used. Alpha generation 0 arms a deferred call, alpha generation 1 replaces its module's API handle and publishes its own catalog, then a distinct beta workspace invokes alpha's retained direct-call function and releases alpha generation 0's deferred call. Both calls hit `registerProvider` on alpha generation 1's handle:

```json
{
  "alpha0": {"evaluations": 1, "registrations": 1, "modelId": "revision-0"},
  "alpha1": {"evaluations": 1, "registrations": 2, "sameCaptureAsAlpha0": true, "modelId": "revision-1"},
  "beta": {"evaluations": 2, "registrations": 1, "separateCapture": true, "neighborRejected": true, "releasedRejected": true, "registrationEffects": 0, "modelId": "revision-2"},
  "alphaAfterForeignCalls": {"registrations": 2, "sameCaptureAsAlpha0": true, "modelId": "revision-1"}
}
```

Both rejection assertions require the generation-mismatch error, not just any thrown error. The effect counter increments only after `registerProvider` returns, so a silently closed/no-op API would fail this proof. The direct calls perform no lazy import; rejection therefore cannot be attributed to a resolver/file error. The extended boundary passed in **2.786 s** (**31.08 s** wrapper wall time including fresh worker-artifact preparation); the rest of the already-passing production-path evidence is unchanged.

### Simplification size

Against main: production **+282/−47** (net +235), tests **+379/−1** (net +378), docs **+11/−3**. Total **+672/−51** (net +621).

Compared with #162080's delta: **117 fewer net production lines**, **1,263 fewer net test lines**, and no tooling/inventory changes; overall net growth drops from **2,022 to 621 lines**. Remaining growth owns the capture/compiler lifetime and distinct regressions rather than duplicate measurement scaffolding.

Backport notes: release/2026.10.5 lacks main's intervening plugin-state-operation
module loader/source binding, selective multi-entry capture, and the slimmed
generation-artifact shape (main dropped source-input verification and
assertSourceCurrent; the branch keeps them, and its retainSourceCustody returns
a custody with assertCurrent/sourceDigest). The fix logic in
plugin-instance-module-loader.ts is ported verbatim minus main's state-operation
lines. PluginGenerationArtifact is exported as the branch factory's inferred
return type instead of main's hand-written type, which does not match the
branch's custody shape. No prerequisite commits were pulled in.

Co-authored-by: mcooks-cmd <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit a81bb54f094f0bb5df760b4fe7e100c791c757d1)

* fix(release): release:candidate refuses to resume after a release-tooling repair on main (#169257)

* fix(release): let bound candidate state follow repaired tooling forward

* test(release): prove legacy candidate state resumes across a tooling rebind

* test(release): type the legacy rebind fixture from current state

* refactor(release): drop release tooling from release-candidate state identity

Backport notes: release/2026.10.5 predates main's planning-flag reconciliation
(savedToolingSha guard, retained-request-aware savedPublishWorkflowRef, and the
three-argument reconcileReleaseCandidateState). Ported only the logic onto the
branch's simpler expressions: toolingSha and publishWorkflowRef leave the strict
state keys, and savedPublishWorkflowRef reuses a saved tag only when it names
the current tooling SHA, so repaired tooling gets its own tag. Tests port the
repaired-tooling matrix cases and the reconcile unit test (two-argument form).
The regular-release.md hunk is dropped: it rewrites a planning-flags paragraph
that does not exist on this branch.

(cherry picked from commit 0b0c2f216658ba62557fe4dbd444a6ebeb4b0f7c)

* fix: recover catalog config after failed native ESM refresh (#169321)

* fix: recover catalog config after failed native ESM refresh

* fix: provide catalog regression response timeout

(cherry picked from commit d0df645f66013c79290904ac9c4e69f9749b94fd)

* fix: stop catalog refreshes retaining duplicate native plugin graphs (#169272) (production half)

Completes the #169272 backport: the earlier backport commit c21fa6aa758
carried only its docs and tests, because the adapted production changes were
never staged. This adds them.

Backport notes: plugin-instance-module-loader.ts is main's post-fix file minus
main's plugin-state-operation lines, which release/2026.10.5 never had; its fix
delta is identical to a81bb54f094. PluginGenerationArtifact is exported as the
branch factory's inferred return type, because main's hand-written type does
not match the branch's custody shape. Selective multi-entry capture is not taken.

(cherry picked from commit a81bb54f094f0bb5df760b4fe7e100c791c757d1)

* fix(doctor): recovery copies miss Canvas and Memory Core files before migrations move them (#169436)

* fix(doctor): capture Canvas and Memory Core migration sources before repair

Canvas legacy documents and Memory Core host-event/sidecar files were absent
from the Doctor/updater recovery capture, so recovery copies lacked bytes the
migrations then deleted or moved. Declare their backup inventories from the
same source/path owners the migrations use, without mutating state.

Extracted from #169295.

* fix(memory-core): capture retry rollback journals before sidecar import

(cherry picked from commit 7187a9afa71af15eb5f7889f6af47faed021097a)

* docs(changelog): refresh 2026.10.5-beta.2 notes

* fix(gateway): Control UI turns stop after unrelated pairing activity (#169457)

* fix(gateway): stop unrelated pairing traffic from revoking operator turns

Remove the operator pin on the best-effort pairing publication cache.
Keep revocation with the Gateway owner and the direct recovery admission check.
Preserve node publication fences, post-commit receipts, and bootstrap cleanup results.

Fixes #169134
Supersedes #169137, thanks @Oldrich333

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

* test(gateway): keep state database close out of pairing pin regression

Database-handle closure revokes through the profile admission owner, which this change does not touch.

* test(gateway): remove unused pairing publication import

* fix(gateway): revoke complete pairing prune batches before cleanup

* test(gateway): rotate recovered callers through the Gateway handler

---------

Co-authored-by: Oldrich333 <[email protected]>
(cherry picked from commit 99f7d3c0f284425d090482325ff18ab9fbab25d8)

* fix(agentsapi): preserve saved sessions across binding upgrades (#168150)

* fix(agentsapi): preserve saved sessions across binding upgrades

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

* fix(agentsapi): preserve saved sessions across binding upgrades

Worked on by:
- @steipete

Co-authored-by: steipete <[email protected]>
OpenClaw-Publication: 3f57ecde-03cc-4f19-8557-30821da7c572

---------

Co-authored-by: steipete <[email protected]>
(cherry picked from commit bc524d8903002ca70d07f9770b2f993e5e7aec59)

* fix: restart-auth release proof exceeds job deadline and misses stop policy (#168097)

* fix: restart-auth release proof exceeds job deadline and misses stop policy

* fix(test): isolate survivor stop policy from runner cgroup

* fix(test): resolve release fixture workspace imports from source

(cherry picked from commit 2d991c67599c2adc4dc5deaee940d27e3c15cf07)

* fix(doctor): preserve installed plugins when path safety checks block them (#168111)

* fix(doctor): preserve blocked local plugin configuration

Treat discovery-blocked plugins as present across validation, stale cleanup, migration reporting, and install-health recovery without weakening execution checks.

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

* fix(doctor): preserve installed plugins when path safety checks block them

Worked on by:
- @obviyus

Co-authored-by: obviyus <[email protected]>
OpenClaw-Publication: 061fdf3e-0e82-4bf8-902a-6c792389eb6a

* test(doctor): account for blocked plugin inspection in canary

Retain the exact convergence result and no-replacement assertions while expecting the newly returned empty blocked-plugin set.

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

* fix(doctor): preserve installed plugins when path safety checks block them

Worked on by:
- @obviyus

Co-authored-by: obviyus <[email protected]>
OpenClaw-Publication: b9dcd2d0-4973-43e2-bd81-f4b22db176ff

---------

Co-authored-by: obviyus <[email protected]>
(cherry picked from commit e048d9d952d6d9016718af7828bd153385459d0a)

* test(subagents): stop polling scheduler effects in cancellation concurrency tests (#168128)

The sibling-cancellation cases waited for swarm-scheduler and lifecycle-admission
effects with vi.waitFor, whose default 1 s budget expires on a loaded host before
the owner runs ("expected vi.fn() to be called 2 times, but got 0 times"), while
the file passes in isolation. Resolve a deferred from inside the owner's own
callbacks (onRemoved, onInterrupt, start) once the expected number of calls has
arrived and await that instead, keeping the same assertions. Guard the awaits with
awaitGateBeforeSettlement so a kill that settles before the publication fails with
a named reason, and with withinTest so the finally cleanup still runs on the test
deadline. No timeout is widened.

Co-authored-by: Peter Steinberger <[email protected]>
(cherry picked from commit 2d6f7a3052a03867896f10d521969c78c4555d9a)

* fix(memory): prevent repeated daily-note blocks during flush (#168123)

Reject replayed saved content before an append, explain the flush-specific write contract, and preserve note bytes for a new-content retry. Covers host and sandbox writers, copied read windows, line endings, and reusable Markdown structure. Related: #164650.

(cherry picked from commit 77bbc865a05bb38e4284e651ddf229d8ac10a53c)

* test(plugins): status test fails since metadata snapshots carry diagnostics (#168264)

## What Problem This Solves

Fixes: `src/plugins/status.test.ts` fails on `main` with `TypeError: params.diagnostics is not iterable` since #168111. Every PR whose changed-test shard includes it goes red (seen on #167996).

## User Impact

User impact: none; this is a test fixture fix. CI goes green again for PRs that run this test.

## Why This Change Was Made

#168111 made `projectPluginInstallHealth` read `params.metadata.diagnostics`, a field the plugin metadata snapshot always carries. The shared mocked snapshot in `status.test.ts` omits that field. The fix adds `diagnostics: []` to the mock, so the fixture matches the real snapshot shape. Production code is unchanged.

## Evidence

- Before: on #167996's CI (which merges current `main`), `checks-node-changed-compact-small-10` and `checks-node-changed-compact-large-11-1` both fail the same 2 tests: `applies the full bundled provider compat chain before loading plugins` and `projects imported state before and after diagnostics evaluate native modules`. Locally on `main`-based code, the file fails standalone the same way.
- After: `node scripts/run-vitest.mjs run src/plugins/status.test.ts` passes 7/7.
- No overlap with Pash/Sarah changes: `git log origin/main [email protected] [email protected] -- src/plugins/status.test.ts` is empty.

Merge danger: two-way door. Blast radius: one test fixture.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit e7eece5bae3dd756856a2ca2e371a6a13516d66b)

* fix: keep task replies in their chat and avoid Reef commit-link false positives (#168248)

* fix: keep task replies in their chat and avoid Reef commit-link false positives

Worked on by:
- @steipete

Co-authored-by: steipete <[email protected]>
OpenClaw-Publication: b8920c6f-576c-434e-8115-ab813ea0bdb1

* fix: preserve internal media task delivery routes

Interpret the internal WebChat sentinel at media admission while retaining captured WebChat origins for interactive completions. Fixes the three media routing regressions from the initial PR CI without changing their expectations.

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

* fix: retain first-contact transcript mirrors without rebinding routes

Create a separate missing mirror identity through the existing worker-backed session operation after successful delivery. Preserve existing mirror rows and routing, creation provenance, and caller guards. Cover real send-handler persistence and transcript append for missing and existing mirrors.

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

---------

Co-authored-by: steipete <[email protected]>
(cherry picked from commit 56521b610f441ae4f7190a2d82b7acd4feba2991)

* fix(sessions): coalesce pending Home creation notices (#168239)

Keep session creation awareness in one replaceable, bounded queue entry so dashboard activity leaves capacity for reminders and hook wakes. Preserve store ownership, untrusted metadata wrapping, accepted actionable events, and full-queue rejection. Cover concurrent creation bursts, global scope, size bounds, replacement receipts, and drain lifecycle.

(cherry picked from commit addfa4853e2f61dd1398d8e0dbe6f5776a6e5ae6)

* fix(workboard): keep fallback runs active until the overall outcome settles (#168215)

When a Workboard card's run failed on the first model candidate and continued on a fallback, the card was moved to blocked (and could get stuck in review on real exhaustion) because attempt-level agent_end events settled the card before the overall session outcome was known. Both attempt outcomes now settle from the session's overall state: fallback success goes running to done with no blocked event, and genuine exhaustion still blocks with failureCount 1. Hook-time reads use the active lifecycle service reader, and linked Incognito sessions are read by exact identity without private content. Builds on #167745 by @skyzhao1223 (fork rejected maintainer pushes); related #167746 by @ericcurtin. Fixes #167574.

Co-authored-by: skyzhao1223 <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit 9f7cb66e186b15519ff435caf5383c7d109a179d)

* fix(recovery): keep interrupted completion replies from being lost (#167814)

* fix(recovery): preserve terminal completion claims

* fix(recovery): keep deferred turns pending

* test(agents): align fallback auth fixtures with their runtime owner

Seed the fallback auth database under agent test before runtime directory
registration. The previous temporary parent name became its durable owner;
later auth usage writes opened it as test, killing the pooled SQLite worker
and invalidating retained reply database generations.

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

* test(reply): await collected drain settlement

Observe the existing detached Gateway root release before asserting that
collected input custody has drained. The default polling deadline raced
real database work under the broad suite.

Keep the queue-absence assertion and require normal settlement without
adding a timeout, a production seam, or another test case.

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

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: goutamadwant <[email protected]>
(cherry picked from commit 78e6318772e0bcd6aa79cb14d1b1ed2bbd2c39a7)

* fix(gateway): avoid blocking stops on native skills watcher cleanup (#168273)

## What Problem This Solves

Fixes Gateway stops spending 10–38 seconds retiring skills watchers one at a time on macOS.

## User Impact

Process-owning Gateway stops no longer wait for individual native watcher shutdowns. In-process restarts, hosted stops, and embedded Gateways still fully retire their watchers before continuing.

The installed updater cannot change the old Gateway's shutdown behavior. Once the candidate Gateway is running, later stops and updates use this fix. There are no configuration, schema, or stored-state changes.

## Why This Change Was Made

Stopping each FSEvents stream synchronously blocks the JavaScript thread on a native round trip. A Gateway that owns its process can instead fence skills observation immediately and let process exit release the native resources together. Detached subscriptions remain owned so an explicit later close can still retire them.

The stop decision stays with the existing process-exit owner. No overlap with protected maintainer changes.

## Evidence

- Retained macOS reproduction: closing 20 native watchers took 11.5 seconds, with the event loop blocked for the entire close.
- The regression exercises the real early-runtime unsubscribe path with real fs-safe subscriptions. It covers an exiting Gateway, late callbacks after detachment, explicit later retirement, and a Gateway that stays in-process.
- The original implementation fails the exiting-Gateway assertion by retiring all 32 subscriptions instead of zero.
- Real macOS CLI `gateway run` → `skills.status` → SIGTERM, with 20 extra skill roots and 293 reported skills: `restart.close.skills-watcher` fell from **514.9 ms to 0.4 ms**. Both processes exited cleanly without reaching the shutdown deadline.
- Total SIGTERM-to-exit time was 2.588 s before and 11.311 s after; the candidate spent 7.58 s in plugin metadata retirement under host contention. This demonstrates removal of the skills-watcher bottleneck, not an overall shutdown speedup.
- The native comparison used the runtime change at `adfd008c553f`; the final adjustment only narrows an internal export and fixes optional-promise handling in the regression test.
- All 16 focused startup/watcher tests passed on the final head (67.19 s wall time for the two-file command); core and core-test type checks passed.
- [Final-head CI is green](https://github.com/openclaw/openclaw/actions/runs/38032671854). The plugin-activation test initially reported `settled` instead of `worker`; rerunning that job on the unchanged head passed.

Two-way door: reverting restores the previous shutdown behavior. The blast radius is skills watcher cleanup during Gateway shutdown; normal skills discovery and refresh are unchanged.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit 8832904b171a34dd5b134f9985208d2ecabea24f)

* fix(memory): rebuild cached index managers when provider config changes (#151263)

* fix(memory): rebuild cached index managers when provider config changes

A models.providers hot reload never rebuilt an already-cached memory
index manager: the manager cache key never saw the provider config the
embedding adapter reads, so a manager built against an absent or wrong
endpoint kept retrying that config for the lifetime of the process.

The openai-compatible adapter now exposes its synchronous, secret-free
resolveIndexIdentity (mirroring the runtime cacheKeyData slice), and the
memory provider requirement embeds that identity so the registry cache
key changes with the endpoint/model and rebuilds the manager.

Closes #151055

* fix(plugins): carry sanitized headers into the index identity mirror

The synchronous resolveIndexIdentity mirror omitted the sanitized client
headers that the runtime cacheKeyData includes, so a stored identity
written by the runtime hashed differently from the identity resolved by
plain status reads. An unchanged configuration was therefore reported as
a provider_settings mismatch, and rebuilding could not clear it because
the writer kept the header-bearing identity.

Derive the sanitized headers in the mirror from the same configuration
inputs (the sanitizer drops auth-bearing names, and buildHeaders without
an apiKey adds no auth), and share the destination-ownership check
between both paths instead of resolving it lazily only at create time.

* chore: retrigger CI against an updated merge base

The hybrid compact fallback timing assertion failure was fixed on main
by settling exclusive admission before runtime placement; retrigger so
the merge commit picks that up.

* chore: retrigger CI after a shared-state broker admission clash in checks-node-compact-large-12

* fix(memory): refresh cached managers after provider config reload

Use the memory index service's existing reload lifecycle for models.providers
changes. Retire cached managers before reacquiring them with the new config,
without adapter-specific identity polling on the memory search path.

Related: #151055
Co-authored-by: ruel225 <[email protected]>

* chore: prune stale max-lines allowance

* test(memory): identify bundled reload fixture ownership

---------

Co-authored-by: ruel225 <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
(cherry picked from commit 72eafadc01a01781cd4ac114f9397c02af9b367f)

* fix(ai): keep unfinished reasoning private at tool boundaries (#168294)

* fix(ai): keep unfinished reasoning private at tool boundaries

Do not recover an unfinished inline reasoning block when a native tool delta arrives before the terminal finish reason. Preserve ordinary terminal-stop text recovery.

Loopback HTTP regressions cover managed and direct streams ending in length or content_filter. Remote focused suites, changed-lane tests, targeted lint, formatting, and core types pass. Full check-changed stops on the inherited 456/455 environment-variable count budget failure, reproduced against the untouched index.

* test(ai): await completion streams and refresh cache telemetry parity

Await the transport factory before iterating or reading its typed result. Record the cacheTelemetry fields introduced by 96c8ba5fe64 in the successful OpenAI parity snapshot.

The complete successful request/event/terminal trace matches the PR parent byte-for-byte against the refreshed snapshot; no production behavior changes. Remote parity, transport suites, exact core-3 type graphs, root stripe 2/4, format and lint pass. The full changed lane reaches an unrelated SQLite iterator-custody failure, reproduced standalone on Node 24.19.0 and CI Node 24.21.0.

(cherry picked from commit 757d73980426df41869314a063b17fc847b36511)

* fix: prevent session admission stack overflows in large fleets (#168354)

* fix: prevent session admission stack overflows in large fleets

Flatten bulk database writer acquisition without changing synchronous FIFO reservation or inherited async authority. Share the established session identity acquisition loop and unwind partial reservations when a later acquisition throws synchronously.

Cover fleet-scale success and original rejection delivery, caller context, reentry, competing writers, and partial-acquisition failure. Refs #168160.

* fix: include acquisition helper in maintainer wrapper

Keep the trusted-anchor runtime source inventory closed over the new agent admission dependency. Both complete wrapper closure suites pass; production source is unchanged from the fleet proof.

(cherry picked from commit 38fee354e63626edea4ce6f620461acc15d571f4)

* fix(models): Claude CLI models vanish from the picker after a plugin config change (#168315)

## What Problem This Solves

Fixes: every Claude CLI (`claude-cli/*`) model disappears from the model picker and `models.list` after a dynamic config change to `agents` or `plugins`, such as turning on ACP OpenCode in Models settings, until the catalog is explicitly refreshed.

## User Impact

User impact: Claude CLI models stay listed when another plugin or agent setting changes while the Gateway is running. Turning ACP OpenCode on now shows its models next to Claude CLI instead of replacing them.

## Why This Change Was Made

A config change to `agents` or `plugins` rebuilds the prepared model catalog. The rebuild keeps a discovered provider's rows only when the new agent facts prove the same account. Claude CLI availability comes from a discovery-only native sign-in credential that the rebuild's agent facts do not carry, so its rows were dropped. The follow-up changed-only pass then only looked at providers with stored credentials, so nothing reacquired Claude CLI.

The changed-only pass now also reacquires providers that the rebuild could not retain and that the new inventory still lacks. Retention rules are unchanged: unverifiable rows are still not carried over. The provider is reacquired under the new generation. The changed-only provider selection moved next to the retention decision in `prepared-model-runtime.catalog-source.ts`, which keeps `catalog-access.ts` under its line cap.

No config, schema, or protocol changes.

## Evidence

Regression: `src/agents/prepared-model-runtime.catalog-owner.test.ts` › "reacquires discovered providers that a config rebuild cannot retain". It publishes an inventory in which one provider's credential exists only in discovery auth, rebuilds after an unrelated `plugins` change, and runs the changed-only pass.
- origin/main production code: fails, catalog is `[ 'plain/plain-model' ]` (the discovery-only provider is gone, no worker reacquisition).
- This branch: passes.

Real Gateway (isolated loopback profile, native `claude` login, no API keys, acpx `nativeAgents.opencode=false` at start). `config.patch` set `plugins.entries.acpx.config.nativeAgents.opencode=true` (dynamic reload, no restart), then `models.list`:

| Build | view `all` before | view `all` after toggle | `default`/`configured` after |
| --- | --- | --- | --- |
| origin/main a285e8b | claude-cli 11, kimi 4, openai 8 | acp-opencode 84, kimi 4, openai 8 (**claude-cli 0**) | acp-opencode 84 only |
| this branch | claude-cli 11, kimi 4, openai 8 | acp-opencode 84, claude-cli 11, kimi 4, openai 8 | acp-opencode 84 + claude-cli 10 |

Toggling it back off on this br…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS 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.

1 participant