Skip to content

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

Merged
RomneyDa merged 8 commits into
mainfrom
fix/superseded-generation-derived-owner
Oct 10, 2026
Merged

RomneyDa merged 8 commits into
mainfrom
fix/superseded-generation-derived-owner

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Release blocker for 2026.10.5-beta.1. Cron and Gateway chat turns could fail with prepared model runtime plugin generation was superseded for <agentDir> when a remote model catalog publication landed between run admission and runtime acquisition (for example, a catalog applied about 0.3s after Gateway startup). The Docker lane cron-mcp-cleanup fails this way.

Root cause: in src/agents/prepared-model-runtime-lease.ts, when the configured owner's plugin generation differs from the generation captured at admission, the run could only borrow the admitted snapshot, and only when preparedPluginGenerationSupportsSelections passed. A selection whose provider-owner plugin is force-activated per run (for example plugins.enabled: false with openai/gpt-5.6-luna) is not in the admitted generation's registry, so the borrow failed and the admitted turn threw outside the retry loop. In the real cron flow, the run's owner key is the configured owner's own key.

Why This Change Was Made

The change has three parts:

  1. Re-admission. When the admitted generation is a superseded configured generation and it can't serve the selection, the lease re-admits the run on the current configured generation. It swaps in configuredOwner.pluginGeneration and re-enters the admission loop. Acquisition happens before any run side effects (cron prepareAdmittedSession, Gateway chat admission), so this is equivalent to a fresh admission. A run admitted on the current configured generation would already derive that selection without a publication.
  2. Configured-generation record. "Configured generation" is a recorded fact, not an inference. publishPreparedPluginGeneration adds generations published by provenance === "configured" owners to configuredPreparedPluginGenerations, a WeakSet. Parent-derived and run-owned generations are never in it, so nested selected-parent confinement from bee48f7 is unchanged: an out-of-parent selection still throws Superseded, with or without a catalog publication.
  3. Unchanged fences. A stale configured owner, config/agent/dir drift, or a closed parent lease (the borrowed snapshot disappears) still throws Superseded. The re-admitted generation is added to the attempt-progress tuple. Post-loop assertAdmission still runs before any lease is returned. Historic work never publishes over the configured owner.

Gateway chat admission (src/gateway/agent-turn/agent-run-admission-phase.ts) uses the same acquireAgentRunPreparedModelRuntime lease, so it is covered too.

User Impact

Cron jobs and first chats admitted just before a remote catalog update now run instead of failing with a superseded-generation error. Nested work stays confined to its parent's plugin owners.

Evidence

Positive cases:

  • re-admits an uncovered selection on the configured generation after a catalog publication: admission on configured generation 200, catalog 300 publishes, then a run lease on the configured owner's own key with an owner plugin missing from the admitted registry. The lease is served on the current configured generation, and the published owner is unchanged. It fails on the base commit and on 216e4e4 with plugin generation was superseded, and passes now.
  • End-to-end local cron-mcp-cleanup repro (gated remote catalog server applying about 0.3s after cron.add) against pnpm build of 2a29f86:
    • client=0
    • gateway log: cron: job added at 05:06:06.896, remote model catalog applied at 05:06:07.204, and 0 supersed lines
    • client returned {"ok":true,"cron":{...,"status":"ok"},"subagent":{...}}

Negative cases:

  • New test keeps derived parents confined to their selections after a catalog publication: a derived parent (selected harness registry), then a catalog publication, then an out-of-parent selection under the open parent rejects with PreparedModelRuntimePublicationSupersededError.
  • Existing prepared-model-runtime.inbound-registry.test.ts nested confinement (isolates selected run owners..., lines 278-283): the other-runtime request and the request after the parent lease closes both reject.
  • Both negative tests fail on the previous head b3bf8e4 ("promise resolved instead of rejecting") and pass now.

Suites: node scripts/run-vitest.mjs on the remote-publication, inbound-registry, registry-borrow, owner-selection, gateway-leases, and native-picker-failures suites passes.

CI checks-node-changed-5 (scoped-refresh discovery-count): carries completed discovery across scoped hot reload without rediscovery (expected 2 calls, got 3) fails identically with this PR's two production files reverted to base 123d5a1. It is pre-existing and not caused by this PR.

Production LOC: prepared-model-runtime-lease.ts +23/-9 and prepared-model-runtime.plugin-lifetime.ts +8, versus base. The growth is the configured-generation record (a security boundary between configured and parent-derived authority) plus the re-admission branch. Tests: +89.

Update (6a2eddf)

  • Merged current main; the inherited prepared-model-runtime.scoped-refresh.test.ts discovery-count failure no longer reproduces (34/34 pass across scoped-refresh + remote-publication).
  • Replaced the options parameter reassignment (CI no-param-reassign lint failure) with a local admittedGeneration binding; behavior unchanged.
  • Revocation during re-admission: new regression rejects re-admission when the run is aborted while its selection resolves revokes the run (aborts its admission signal) inside selection-owner resolution, after the superseded generation was inspected. Acquisition rejects with Prepared model runtime lease admission aborted and returns no lease, so no provider or harness I/O can follow. Mechanism: every re-admission continue re-enters the loop at assertAdmission() (lifetime + abort), and both lease returns call assertAdmission() again; the re-admission branch itself never returns a lease.
  • Out-of-parent rejection: keeps derived parents confined to their selections after a catalog publication — the derived parent's generation is never in configuredPreparedPluginGenerations (only publishPreparedPluginGeneration for provenance === "configured" adds to it), so it throws PreparedModelRuntimePublicationSupersededError before any lease exists.
  • pnpm test src/agents/prepared-model-runtime.remote-publication.test.ts --maxWorkers=1: 14 passed, ~17s wall (new tests ~40ms each).

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

@RomneyDa
RomneyDa marked this pull request as ready for review October 10, 2026 11:12
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Oct 10, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 10, 2026
@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR re-admits uncovered runtime selections on the current configured generation after a catalog publication.

Example: A cron turn retains catalog generation 200, then generation 300 publishes before runtime acquisition.

  • Before: An uncovered provider selection fails with a superseded-generation error.
  • After: The turn acquires the current configured generation before execution.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, focused repair with credible runtime recovery evidence and no open code finding; authority-boundary validation remains incomplete.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Cron jobs and Gateway turns can fail before inference when a catalog update supersedes admission and the selected provider owner is absent from that generation.
Reason: The maintainer-authored repair restores a demonstrated execution path while retaining the existing selection and lifecycle boundaries.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep this PR open: it repairs a concrete catalog-publication race affecting cron and Gateway turns, has maintainer-approved direction, and introduces no newly identified code defect.

Priority: P1
Reviewed head: 2cd5505c8b58a3e4c315b544738aa8ca264194e7

Before merge

  • Add real behavior proof - Authority-chain proof required: the supplied built-Gateway cron output at 2a29f86 demonstrates allowed catalog-race recovery; current negative cases mock selection-owner resolution and observe lease rejection without provider or harness I/O traces. Preserve that valid positive evidence and add production-boundary traces for out-of-parent selection, closed-parent borrowing, and abort during re-admission, showing rejection before execution; redact IPs, API keys, phone numbers, and non-public endpoints. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve security review attention item - No reachable bypass was identified, but the changed execution-authority path still requires final-effect proof.
  • Resolve merge risk - Before merge, establish that configured-generation re-admission cannot grant execution outside a derived parent's selection or after its authority is revoked.

Findings

None.

Tests

  • Missing end-to-end proof: Supply production-owner traces for out-of-parent selection, closed-parent borrowing, and abort during re-admission that observe rejection before provider or harness I/O.
Agent review details

How this fits together

The prepared-runtime lease owner receives agent configuration, runtime selections, and an admitted generation, then returns a retained runtime snapshot to cron and Gateway execution.

flowchart TD
  A[Configuration and catalog] --> B[Configured runtime publication]
  B --> C[Run lease admission]
  D[Open parent lease] --> C
  C --> B
  C --> E[Retained runtime snapshot]
  E --> F[Provider or harness execution]
Loading

Technical review

Best possible solution:

Retain the focused lease-owner repair and establish confinement and cancellation through the production execution boundary.

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

Current main visibly rejects an uncovered selection when catalog publication supersedes its admitted generation; the PR supplies a failing-base regression account and successful built-Gateway recovery output, although this read-only review ran no target code.

Is this the best way to solve the issue?

The existing lease owner is the appropriate repair boundary, and recording configured publication prevents derived parents from inheriting the new re-admission path.

AGENTS.md: found and applied where relevant.

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

Merge-risk options

Maintainer options:

  1. Hold merge until authority evidence is supplied (recommended)
    Keep the repair pending while the PR owner supplies the production-boundary evidence described in realBehaviorProof.

Provenance checked

  • Superseded-generation borrowing changes intended behavior with a stated reason (79e6755: Prevent queued work from restoring retired configuration or credentials; permit historic reuse only through the exact open parent lease.)
  • Nested selection confinement keeps the original intent (bee48f7: Prepare selected runtime owners before admission and prevent nested work from acquiring owners outside its parent lease.)
  • Admission progress tracking keeps the original intent (8720fbf: Prevent admission from spinning without a changed publication fact.)
  • Plugin generation lifetime keeps the original intent (05a2844: Keep plugin resources retained through admitted work and cleanup while retired publications stop granting ordinary admission.)

Testing

Proof path: shipped entry point.

Security

Needs attention: No reachable bypass was identified, but the changed execution-authority path still requires final-effect proof.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 79e6755 adds src/agents/prepared-model-runtime-lease.ts:89 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 79e675521f7c; files: src/agents/prepared-model-runtime-lease.ts)

PR surface

Source +23, Tests +129. Total +152 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 43 20 +23
Tests 1 129 0 +129
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 172 20 +152

Review metrics

Metric Value Why it matters
Production versus test LOC Production +43/-20; tests +129/-0 Production growth records configured-generation provenance and carries the replacement through the existing admission loop; tests cover recovery, confinement, and abort.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The reported catalog race breaks admitted cron and Gateway turns before inference.
  • merge-risk: 🚨 security-boundary: The patch changes which configured plugin generation an admitted run may acquire; final-effect confinement and revocation evidence remains incomplete.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

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

  • Add final-effect proof for out-of-parent and closed-parent selections and abort during re-admission, showing rejection before provider or harness I/O.

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.

History

Review history (4 earlier review cycles)
  • reviewed 2026-10-10T11:19:07.618Z sha 216e4e4 :: needs real behavior proof before merge. :: [P1] Preserve the selection fence for already-derived parent leases
  • reviewed 2026-10-10T11:40:38.209Z sha b3bf8e4 :: needs real behavior proof before merge. :: [P1] Preserve selection confinement when re-admitting derived parents
  • reviewed 2026-10-10T12:11:19.724Z sha 2a29f86 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-10T17:53:27.361Z sha 6a2eddf :: needs real behavior proof before merge. :: none

Reviewed October 10, 2026, 2:01 PM ET / 18:01 UTC (Revision 5).

@RomneyDa RomneyDa changed the title fix(agents): keep admitted runs alive when a catalog publication supersedes their generation fix(agents): re-admit runs on the configured generation after a catalog publication Oct 10, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Oct 10, 2026
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Oct 10, 2026
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@RomneyDa
RomneyDa merged commit 171df4e into main Oct 10, 2026
115 checks passed
@RomneyDa
RomneyDa deleted the fix/superseded-generation-derived-owner branch October 10, 2026 18:07
@RomneyDa

Copy link
Copy Markdown
Member Author

Merged via squash.

RomneyDa added a commit that referenced this pull request Oct 10, 2026
…og 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 171df4e)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 11, 2026
…og publication (openclaw#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
RomneyDa added a commit that referenced this pull request Oct 11, 2026
…og 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 171df4e)
steipete added a commit that referenced this pull request Oct 11, 2026
## What Problem This Solves

Agent runtime bookkeeping repeatedly restarted otherwise valid work when configuration, plugin, or catalog metadata changed during an asynchronous operation. This maintainer-requested simplification removes that speculative retry machinery.

## User Impact

Normal model selection, tool execution, credential checks, FIFO scheduling, and shutdown settlement remain. A request racing a reload may fail visibly and be retried by the caller; passive metadata may remain at its captured version until the next refresh. No configuration, protocol, SDK, schema, durability, retention, or permission contract changes.

## Why This Change Was Made

Prepared runtime acquisition and remote catalog adoption now take one preparation path rather than repeatedly rebinding and rebuilding. Admission still handles the concrete drain, retirement, and failed-activation recovery stages. Cache publication keeps its final currentness check; tool and credential effects keep their authority checks. Steering and Tool Search retain their actual owner, FIFO, and settlement contracts without comparing unrelated metadata.

Production: **519 net lines removed**. Tests that exclusively required the removed synthetic interleavings were removed with them. Open-parent borrowing, pending-auth cancellation, explicit MCP acquisition config, and queued-tool implementation checks remain. No new lint suppressions, timeouts, retries, or skips were added.

Scope proof also caught two nearby correctness issues: an earlier MCP reload could overwrite a new caller's explicit configuration, and snapshot reconciliation could prepend a separator to a later text block. Both are fixed with their existing boundary tests. Bootstrap fixtures now test the no-clobber fallback already shipped by the pinned fs-safe version; no dependency or storage policy changed.

## Best-effort tradeoffs accepted

| Removed guard | Provenance and accepted result |
| --- | --- |
| Per-batch context projection cancellation | #119607 measured the value of cooperative yielding; its mid-batch cancellation callbacks were synthetic coverage. Yielding and the final publication check stay; obsolete pure computation may finish unused. |
| Mixed-version module/cache repair | #119607 seeded an old global singleton inside a synthetic process. Normal upgrades restart the process; unsupported mixed-version module replacement no longer repairs that marker. |
| Runtime acquisition retry/rebind loop | #128138/#127217 exercised forced reload timing. A racing request now returns a visible supersession error; the next request uses the current owner. The actual no-spin incident in #153313 remains addressed. |
| Configured-generation re-admission | 171df4e / #168410 adds re-admission for a gated Docker reproduction with a catalog publication 0.3s after admission, not a human-user incident. A superseded request now fails visibly. Parent confinement remains fail-closed, with its security test retained. The retry-only WeakSet and two retry-specific tests are removed. |
| Repeated passive owner selection | a718c1c / #162484 added recursion alongside the real self-drain fix; that incident did not require recursive reselection. The self-drain refusal stays. Reads use one captured owner or fail visibly, rather than recursively trying later publications. |
| Remote catalog config reread/per-attempt cancellation | #158000 used synthetic config/auth churn. Adoption reads once and prepares once; an overlapping change can defer adoption until the next normal catalog check. |
| Parent-generation cancellation subscriptions during adoption | 504d290 / #158000 used the same synthetic churn. Parent replacement may leave bounded preparation running until its final owner/config check rejects it. Shutdown cancellation, candidate-retirement aborts, cleanup, and the final serialized effect check remain. |
| Three-attempt catalog adoption settlement recovery | The same synthetic churn caused a second retry protocol around owner publication. One attempt remains, with one final checked atomic rows/pricing commit. |
| Duplicate early publication checks/error relabeling | Same-tick checks and concurrent-change relabeling did not guard an effect. The final effect check stays; failures retain their actual reason. |
| Auth-batch sibling retry after supersession | f3c52bd / #152467 used synthetic tests that superseded one owner during a sibling build. The operation now settles with its original error instead of selectively rebuilding siblings. Credential authority checks remain. |
| Post-await cache-stale generation check | No human incident supports fencing this metadata flag. A config/auth change during discovery can let the older load clear a reused owner's stale marker; discovery may remain stale until another explicit refresh/reload. This does not grant credentials or execution authority. |
| Passive harness catalog cancellation | #134524 fixed the actual availability report #134460; replacement/closure guards were additional synthetic hardening. Completed discovery rows are retained, and later discovery observes replacement. |
| Native binding clock-only rechecks after worker waits | #158396 used clock-jump fixtures. An expired but unreplaced exact row can finish its prepared bookkeeping mutation; CAS takeover detection and current mutation authority still gate commit. One exact, unexpired lease check gates protected callback entry, and live effect assertions remain. |
| Tool Search ancestor reentrancy tracking | #140767 covered synthetic nested control calls, not a reachable production control target. FIFO/exclusion and real implementation settlement remain. |
| Complete steering metadata fingerprint | #163195 recorded a real production ordering/ownership incident. Its owner, pending-row, result-authority, and lease checks stay; metadata-only edits no longer invalidate already-captured prompt bytes. |
| Repeated MCP acquisition/reload replay | #138694 used synthetic crossed-publication choreography. A new runtime catches up once; later reloads target the published owner. A racing creation can fail and reconnect on the next acquisition. |
| MCP tools/list invalidation generations and replay | #125541/#125564 describe isolated protocol stress fixtures. A notification inside tools/list no longer triggers immediate replay; the next notification or explicit refresh replaces the inventory. Normal exit/reconnect, bounds, validation, and cleanup remain. |
| Failed-start replay crossed by config publication | #158088's test forces a config publication into an in-flight failed initialization. That request may now report its first failure; ordinary backoff and explicit-refresh retry remain. |

## Evidence

Candidate head: `d72afea0c17a45c677977e23937049d7c7fc43ec` (tree `51daca08d7288e906188bc25ec3d1896bf841349`).

Final exact-head CI: [run 38132644989](https://github.com/openclaw/openclaw/actions/runs/38132644989) completed successfully; all 82 jobs terminal with no failed or cancelled jobs. Full head-bound check census also confirms the CI gate and applicable security checks passed. Earlier failed/cancelled attempts are described below, not represented as passing proof.

- Independent P2 reviews completed. The catalog-staleness, duplicate steering metadata fingerprint, and auth-sibling retry findings are explicitly accepted tradeoffs listed above; steering result facts and destination eligibility remain checked at their owners. The latest native-lease callback-entry finding was accepted and fixed with one live lease check instead of restoring per-write expiry callbacks. Its new fake-clock regression failed before the fix by entering the protected callback after expiry.
- Conflict-only integration kept main's three repaired test fixtures byte-for-byte. All **22 conflict tests** passed (cursor, sandbox, bootstrap publication, lint suppressions); affected root/tools test graphs, core types, typed lint and both cycle checks passed. Runtime and Madge cycles remain **0**.
- The native callback-entry fix passed fresh P2 review and **24 focused tests** (21 native binding tests plus 3 lint-suppression tests), wrapper 212.01s; native test project 164.77s including 113.11s compiled-worker preparation. The added fake-clock case performs no real wait; the existing native suite exercises authority and worker settlement. Final affected types and typed lint are checked before push.
- CI run `38125430266` found one owned stale expectation: the remote-catalog integration still forced config/auth replacement while pricing was paused and demanded the removed immediate retry. Only that scenario was removed; both schema variants retain normal publication, pinned pricing, input validation, worker recovery and disable coverage and pass locally (141.35s project), with gateway test types, typed lint, lint suppressions (3/3), and fresh P2 review passing.
- The other root failure, `checks-node-changed-compact-small-11`, independently reproduced on clean main `fd1fd2ce0ef8cb7e9c4074c8f855eff8992a54c2`: `embedded-agent-runner.prompt-cache.test.ts` responses and in-history both raised `SqliteTranscriptMutationConflictError` in the session actor append path (2 failed / 2 passed). Investigation found a cold actor snapshot prevented the existing implicit-watermark retry. Fixed directly on main as `e65bd3be4134f1453bb4ab26e68704c678086b58` and integrated here: all 4 prompt-cache cases and 35 session-manager siblings plus lint-suppressions pass, including explicit stale rewrite refusal. The repair passed types, typed lint and fresh P2 review.
- Follow-up CI `38127338915` reached one more synthetic-only case: compaction's `mutate=input` row changes an internal selection object after starting acquisition. Removed only that row/branch under the campaign rule; five remaining compaction cases pass, along with lint-suppressions, affected types, typed lint and fresh P2 review. Its provenance is `c131ec041e1` / #139429, not a human report of post-call input mutation. The final conflict repair keeps main's equivalent streaming/steering refactors, removes the obsolete retry predicate, and passes 49 owner tests plus lint-suppressions. Cancelled jobs are not counted as passing; final-head hosted CI remains the gate. No CI job was rerun.
- CI `38130432441` had one inherited fixture failure: three `sessions-mutations.catalog-queue` cases selected their configured default while expecting override fields, after #169030 intentionally made that selection a default reset. Integrated main's existing fixture-only correction `194a08e59632`, retaining all assertions. The corrected file passes all 14 cases on clean main under Node and Bun; the three affected cases also pass under Bun on this branch (249.87s project, mostly transformation). Exact-head hosted CI remains the final gate.
- Focused effects suites: **43 passed** across inbound-registry, remote-publication, hot-reload-dispatch and tool-search-scheduling. This includes cancellation, parent confinement, ordinary rollback/failed-activation recovery, and queued implementation replacement. Single-worker wrapper 752.15s including 142.017s compiled-worker preparation; infra 432.15s and agents-core 115.09s. Final restored remote-publication file: **7 passed**, including first reply crossing catalog adoption and exact derived-parent confinement; wrapper 372.77s (184.30s worker preparation; 131.87s Vitest). These loaded-host timings are not a performance claim.
- Integrated native-binding suites: **20 passed**, including exact token cleanup, successor protection, and revocation. The same command passed all **3 lint-suppression tests**. Single-worker wrapper 354.47s including 145.31s worker preparation.
- Current core types and native-binding test graph passed; runtime cycles **0**, Madge cycles **0**; changed-file typed lint passed. The full changed-check run reached an old-base UI duplicate-import error already fixed on main by `48588a65222`; that fix was integrated and the affected UI graph passed. Remaining type graphs and static guards were completed separately without changing baselines.
- Isolated Linux scope run and canonical remaining projects exercised **19,900 passing tests**. Eight failures were investigated: three pinned removed synthetic retry paths and were deleted; five exposed the correctness/fixture issues described above and were repaired with focused proof. Existing platform skips were unchanged. This is combined incremental proof, not a claim that one final-head all-scope invocation was green.
- Final repair suites: **71 passed** across passive runtime, SSE recovery, startup backoff, bootstrap, stream reconciliation/markup/phase coverage; **12 passed** across sandbox/cursor coverage, followed by **2 passed** for the real-append cursor fixture. Final MCP regression retained stdio-exit recovery and HTTP failure semantics; it passed 64 cases but hit two unchanged local child-start deadlines (1s/2s). Those initial-start paths passed on the isolated Linux run; no timeout, retry, or skip was changed to mask the local failures.
- Full-core Linux lint passed with 13 existing max-lines warnings, none in changed files. Deadcode identified and drove removal of the unused owner-publication helper. Remaining findings were in unmodified config/state/Gateway/UI files. A separate fresh current-main checkout (`f4d601a006`) passed production deadcode and failed full-tree deadcode only on the unrelated `readActiveGatewayLockPortMock` export. The PR does not change any deadcode baseline.
- Blacksmith Testbox did not admit a runner within 15 minutes; AWS quota pressure supplied an undersized instance, which was released. The authorized Hetzner fallback supplied the Linux proof above. All owned remote leases are stopped. Hosted CI on the exact final head remains the landing gate; no CI jobs were rerun.

<details>
<summary>Audit coverage ledger and retained boundaries</summary>

| Mechanism (base lines) | Scenario and provenance | Decision |
| --- | --- | --- |
| context-cache-projection.ts:145-213, context.ts:87-109,146-169 | Cancellation/replacement during pure batched metadata computation. bf7840f / #119607 fixed a measured multi-second RPC stall by yielding and atomic publication. Mid-batch authority callbacks were extra cancellation machinery; no effect occurs in projection. | REMOVE repeated projection/early checks; KEEP cooperative yields and the caller's check immediately before publication. |
| context-runtime-state.ts:33-38 | bf7840f / #119607 seeds an old global singleton and new cache module in a synthetic child process; no human report of mixed code versions within one live process. | REMOVE old-module/cache-pair normalization, its only reuse flag, and the synthetic migration test. Ordinary process startup and same-version bundled singleton sharing remain. |
| prepared-model-runtime-lease.ts:149-164 | 8720fbf / #153386. Human report #153313 by stackingrockss includes the deployed Docker version, profiler samples, and repeated boot-loop observations. Its infinite retry was caused by non-idempotent runtime selection normalization. | KEEP normalized owner selection and a visible error when a settled replacement never published; REMOVE the acquisition retry loop entirely, so it cannot spin. |
| prepared-model-catalog-worker.ts:71-220 | 349aef7 / #150354. Human report #149538 by 609NFT describes copied production fleet state, 632 agents, 504 failed health probes and growing RSS. #161738 by matthematics1137 reports 92 worker lifetimes, OOMs and 1.285 TB written. | KEEP one bounded shared worker, borrower cleanup, failure logging, and ordinary crash recovery. These are measured resource and real concurrency contracts, not permission to retain unrelated reload fences. |
| prepared-model-runtime.refresh-scope.ts:240 | d56279c / #151597 by obviyus describes a controlled worker crash and synthetic Gateway regression, not a human production report. Later #161738 independently establishes actual recurring worker failures. | KEEP source-bound failure reporting and bounded recovery to avoid reintroducing the observed restart/discovery amplification. The #151597 PR alone is not accepted incident evidence. |
| prepared-model-runtime.resources.ts:30-127 | 73b4086 / #143109 contains native regressions and synthetic compiled CLI/Gateway proof, no linked human incident. | KEEP physical resource claims until ordinary concurrent borrowers settle and shutdown joins their cleanup; these are required cleanup mechanics, not a blanket historical-incident exemption. Inspected the complete resource owner; no extra reload retry protocol lives here. |
| prepared-model-runtime.plugin-lifetime.ts:230-319 | 382c987 / #159448 links #157842 by highfly-hi: five-agent Linux deployment with catalog-worker heap increasing 70-80 MB per scheduled turn, watchdog restarts and before/after version evidence. | KEEP final registry-reference release, current execution authority, and ordinary borrowed-resource settlement. Retained memory claims are scoped to physical lifecycle, not all historical publication machinery. |
| prepared-model-runtime.lifecycle.ts:101-164 | a718c1c / #162484 by jalehman records actual lossless-claw maintenance calls stuck about 45 minutes during reload until restart. a3e4005 / #162301 explicitly says synthetic Gateway, no production deployment. | KEEP refusal of plugin work waiting on its own drain and process-close settlement. #162301 is synthetic evidence, not an independent incident exemption. |
| prepared-model-runtime-lease.ts acquisition loop and borrowed-generation branch | 79e6755 / #128138 and related #127217 describe synthetic QA-channel/config replacement tests; #127217 explicitly reports that its pre-fix real-Gateway run still delivered replies. Retained inbound-registry tests exposed ordinary nested selected-parent borrowing as a distinct contract. | REMOVE retry/rebind loop. KEEP exact open-parent borrowing and selection confinement; a reload during new acquisition may fail that request visibly. |
| prepared-model-runtime.published-owner.ts:91-203 | a718c1c / #162484 added retry/recursive rereads alongside the real plugin-drain repair. That incident justifies self-drain refusal and ordinary settlement, not recursive passive owner reselection. | REMOVE repeated rereads/retries; wait once, then project or activate once. Pure catalog-stale bookkeeping no longer revalidates generation after its await. |
| prepared-model-runtime.configured-refresh.ts remote catalog adoption | 504d290 / #158000 has explicitly synthetic config/auth churn and fixture-provider proof; no human incident cited for the reread loop, per-attempt controllers or three-attempt owner settlement recovery. | REMOVE those race-specific retries, plus early duplicate currentness checks/error relabeling. KEEP the final owner/authority check, atomic rows/pricing commit, current catalog ordering, and ordinary cancellation/disposal. |
| prepared-model-runtime.configured-refresh.ts:396-430 parent subscriptions | 504d290 / #158000; same synthetic churn proof. Parent-generation subscriptions duplicate the final owner/generation/config check. | REMOVE parent-generation early cancellation listeners. KEEP shutdown and candidate-retirement cancellation, bounded work, cleanup, and the final serialized effect check. |
| prepared-model-runtime.owner.ts:612-631 batch supersession retry | f3c52bd / #152467. Tests force one auth owner to supersede while a sibling is building. No independent human incident identified for sibling retry. | REMOVE retry of the surviving batch; retain source-bound credential/current-owner checks and report the original publication failure. |
| prepared-model-runtime.owner.ts:124-134 unused publication probe | dd2d66c / #130856 introduced a helper returning matching/pending publication facts for acquisition retries. Its callers are gone; full-repository search finds only the definition. | REMOVE the dead helper/export. Credential-refresh cancellation remains supported by the direct, abortable configured-owner wait and its unchanged regression tests. |
| sandbox/registry.kernel.ts:396,420; sandbox/registry.ts:295 | 2889a99 / #151172 is not treated as an incident report. Read-only admission accepts older schemas; tableExists consumes admitted schema.tables facts, not repeated SQL/format validation. | KEEP the existing absent-table empty/null contract. No runtime foreign-commit or repeated validation probe exists in these calls. |
| harness/native-session/binding-leases.ts | cfef174 / #158396 moved writes to workers; elapsed-time rechecks were covered by synthetic clock-jump tests. 283d5e6 / #164197 supplies native successor authority behavior, not a blanket exemption. | REMOVE prepared callback plumbing and post-worker wall-clock-only rechecks. KEEP exact-row CAS, token/phase/failure checks, current mutation authority, bounded acquisition, renewal, and write settlement. |
| harness/context-engine-logical-turn.ts | #143491/#140023 supply synthetic lifecycle tests, not qualifying human incident evidence. The owner actually holds resources used by outstanding context-engine work. | KEEP ordinary work completion and deferred disposal until implementation settlement; no extra synthetic reload retry was retained here. |
| harness/model-catalog.ts:168-177,242-284,353 | 6c44634 / #134524 repairs human availability report #134460. Passive replacement/closure branches were additional maintainer hardening and synthetic variants, not that report's failure. | REMOVE passive isCurrent callbacks and ambient registry replacement checks. KEEP exact owned registry/config, provider outcomes, discovery, selection and the actual availability repair. |
| auth-profiles/oauth-refresh-peers.ts | #166183/#167002/#166659 are not claimed as human incident evidence. Refresh credentials rotate/revoke and carry account identity; copied historical peers must not replay spent tokens or inherit another account. | KEEP these credential/identity effect boundaries and ordinary uncertain-write settlement. No auth-profile schema, secrets, permissions or durability changes. |
| worktrees lifecycle/removal | Audited run-lease-owner.ts, service-preparation.ts, eviction.runtime.ts and gc-removal.ts. They coordinate destructive removal of user artifacts with live checkout/source handles, exact refs and ordinary parallel sessions. No PR title is treated as incident evidence. | KEEP current-row removal/exclusive source checks and rollback/cleanup custody for writes and deletion. Removing them would risk user artifacts, independently prohibited by the data-loss boundary. |
| tool-search-scheduling.ts | 9b93fc8 / #140767 adds ancestry reentrancy and queued object/mode identity checks with automated interactive/headless regressions. Production catalogs exclude control tools; recursive calls using the same runtime were synthetic only. | REMOVE unreachable nested-call ancestry. KEEP one exact queued implementation/mode check at the effect, catalog-ID authorization, FIFO/exclusion, abort and implementation settlement. |
| agent-steering-queue.ts:194-263 | 3f761a8 / #163195 records Peter's actual three-day production errors. The incident justifies owner/FIFO repair, not a fingerprint of every result label/task/time/outcome/origin/transcript field. | REMOVE full payload fingerprints and deep-equality invalidation. KEEP run-owner identity, prepared result authority, current requester store, pending-row effect checks, FIFO, exact lease/status acknowledgment and release. |
| agent-bundle-mcp-manager.ts and manager-install.ts | 89c1a09 / #138694 reports synthetic fail-before/real-transport proof but no cited actual-use incident for repeated crossed-publication acquisition/reload. | REMOVE the acquisition retry/rebind loop and repeated reload replay. KEEP the runtime-key queue, ordinary cleanup, one postcreation config catchup, requester credentials/authorization and live tool effect checks. |
| agent-bundle-mcp-runtime.ts catalog generations | 1cf8ea4 / #125564 and follow-up 1d03e5d / #167642 have synthetic notifications/listing interleavings, not human reports for replaying tools/list during its own response. | REMOVE catalog invalidation generations, replay of a notification arriving inside tools/list, and the impossible repeated replacement-retirement loop. KEEP listing single-flight, caching, bounds, diagnostics, normal reconnect, one retry for an actually exited previously healthy server, and execution authority. |
| prepared-model-runtime-lease.ts / plugin-lifetime.ts configured-generation re-admission | 171df4e / #168410, landed during this lane, describes a gated Docker reproduction with catalog publication 0.3s after admission, not an actual human-user incident. | REMOVE configured-generation retry and its now-unused WeakSet plus the two retry-only tests. KEEP fail-closed superseded-generation rejection and the new derived-parent confinement security test. |

</details>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
…168981)

## What Problem This Solves

Agent runtime bookkeeping repeatedly restarted otherwise valid work when configuration, plugin, or catalog metadata changed during an asynchronous operation. This maintainer-requested simplification removes that speculative retry machinery.

## User Impact

Normal model selection, tool execution, credential checks, FIFO scheduling, and shutdown settlement remain. A request racing a reload may fail visibly and be retried by the caller; passive metadata may remain at its captured version until the next refresh. No configuration, protocol, SDK, schema, durability, retention, or permission contract changes.

## Why This Change Was Made

Prepared runtime acquisition and remote catalog adoption now take one preparation path rather than repeatedly rebinding and rebuilding. Admission still handles the concrete drain, retirement, and failed-activation recovery stages. Cache publication keeps its final currentness check; tool and credential effects keep their authority checks. Steering and Tool Search retain their actual owner, FIFO, and settlement contracts without comparing unrelated metadata.

Production: **519 net lines removed**. Tests that exclusively required the removed synthetic interleavings were removed with them. Open-parent borrowing, pending-auth cancellation, explicit MCP acquisition config, and queued-tool implementation checks remain. No new lint suppressions, timeouts, retries, or skips were added.

Scope proof also caught two nearby correctness issues: an earlier MCP reload could overwrite a new caller's explicit configuration, and snapshot reconciliation could prepend a separator to a later text block. Both are fixed with their existing boundary tests. Bootstrap fixtures now test the no-clobber fallback already shipped by the pinned fs-safe version; no dependency or storage policy changed.

## Best-effort tradeoffs accepted

| Removed guard | Provenance and accepted result |
| --- | --- |
| Per-batch context projection cancellation | openclaw#119607 measured the value of cooperative yielding; its mid-batch cancellation callbacks were synthetic coverage. Yielding and the final publication check stay; obsolete pure computation may finish unused. |
| Mixed-version module/cache repair | openclaw#119607 seeded an old global singleton inside a synthetic process. Normal upgrades restart the process; unsupported mixed-version module replacement no longer repairs that marker. |
| Runtime acquisition retry/rebind loop | openclaw#128138/openclaw#127217 exercised forced reload timing. A racing request now returns a visible supersession error; the next request uses the current owner. The actual no-spin incident in openclaw#153313 remains addressed. |
| Configured-generation re-admission | 8b13535 / openclaw#168410 adds re-admission for a gated Docker reproduction with a catalog publication 0.3s after admission, not a human-user incident. A superseded request now fails visibly. Parent confinement remains fail-closed, with its security test retained. The retry-only WeakSet and two retry-specific tests are removed. |
| Repeated passive owner selection | d92dc37 / openclaw#162484 added recursion alongside the real self-drain fix; that incident did not require recursive reselection. The self-drain refusal stays. Reads use one captured owner or fail visibly, rather than recursively trying later publications. |
| Remote catalog config reread/per-attempt cancellation | openclaw#158000 used synthetic config/auth churn. Adoption reads once and prepares once; an overlapping change can defer adoption until the next normal catalog check. |
| Parent-generation cancellation subscriptions during adoption | 27a0f6d / openclaw#158000 used the same synthetic churn. Parent replacement may leave bounded preparation running until its final owner/config check rejects it. Shutdown cancellation, candidate-retirement aborts, cleanup, and the final serialized effect check remain. |
| Three-attempt catalog adoption settlement recovery | The same synthetic churn caused a second retry protocol around owner publication. One attempt remains, with one final checked atomic rows/pricing commit. |
| Duplicate early publication checks/error relabeling | Same-tick checks and concurrent-change relabeling did not guard an effect. The final effect check stays; failures retain their actual reason. |
| Auth-batch sibling retry after supersession | 4616d20 / openclaw#152467 used synthetic tests that superseded one owner during a sibling build. The operation now settles with its original error instead of selectively rebuilding siblings. Credential authority checks remain. |
| Post-await cache-stale generation check | No human incident supports fencing this metadata flag. A config/auth change during discovery can let the older load clear a reused owner's stale marker; discovery may remain stale until another explicit refresh/reload. This does not grant credentials or execution authority. |
| Passive harness catalog cancellation | openclaw#134524 fixed the actual availability report openclaw#134460; replacement/closure guards were additional synthetic hardening. Completed discovery rows are retained, and later discovery observes replacement. |
| Native binding clock-only rechecks after worker waits | openclaw#158396 used clock-jump fixtures. An expired but unreplaced exact row can finish its prepared bookkeeping mutation; CAS takeover detection and current mutation authority still gate commit. One exact, unexpired lease check gates protected callback entry, and live effect assertions remain. |
| Tool Search ancestor reentrancy tracking | openclaw#140767 covered synthetic nested control calls, not a reachable production control target. FIFO/exclusion and real implementation settlement remain. |
| Complete steering metadata fingerprint | openclaw#163195 recorded a real production ordering/ownership incident. Its owner, pending-row, result-authority, and lease checks stay; metadata-only edits no longer invalidate already-captured prompt bytes. |
| Repeated MCP acquisition/reload replay | openclaw#138694 used synthetic crossed-publication choreography. A new runtime catches up once; later reloads target the published owner. A racing creation can fail and reconnect on the next acquisition. |
| MCP tools/list invalidation generations and replay | openclaw#125541/openclaw#125564 describe isolated protocol stress fixtures. A notification inside tools/list no longer triggers immediate replay; the next notification or explicit refresh replaces the inventory. Normal exit/reconnect, bounds, validation, and cleanup remain. |
| Failed-start replay crossed by config publication | openclaw#158088's test forces a config publication into an in-flight failed initialization. That request may now report its first failure; ordinary backoff and explicit-refresh retry remain. |

## Evidence

Candidate head: `d72afea0c17a45c677977e23937049d7c7fc43ec` (tree `51daca08d7288e906188bc25ec3d1896bf841349`).

Final exact-head CI: [run 38132644989](https://github.com/openclaw/openclaw/actions/runs/38132644989) completed successfully; all 82 jobs terminal with no failed or cancelled jobs. Full head-bound check census also confirms the CI gate and applicable security checks passed. Earlier failed/cancelled attempts are described below, not represented as passing proof.

- Independent P2 reviews completed. The catalog-staleness, duplicate steering metadata fingerprint, and auth-sibling retry findings are explicitly accepted tradeoffs listed above; steering result facts and destination eligibility remain checked at their owners. The latest native-lease callback-entry finding was accepted and fixed with one live lease check instead of restoring per-write expiry callbacks. Its new fake-clock regression failed before the fix by entering the protected callback after expiry.
- Conflict-only integration kept main's three repaired test fixtures byte-for-byte. All **22 conflict tests** passed (cursor, sandbox, bootstrap publication, lint suppressions); affected root/tools test graphs, core types, typed lint and both cycle checks passed. Runtime and Madge cycles remain **0**.
- The native callback-entry fix passed fresh P2 review and **24 focused tests** (21 native binding tests plus 3 lint-suppression tests), wrapper 212.01s; native test project 164.77s including 113.11s compiled-worker preparation. The added fake-clock case performs no real wait; the existing native suite exercises authority and worker settlement. Final affected types and typed lint are checked before push.
- CI run `38125430266` found one owned stale expectation: the remote-catalog integration still forced config/auth replacement while pricing was paused and demanded the removed immediate retry. Only that scenario was removed; both schema variants retain normal publication, pinned pricing, input validation, worker recovery and disable coverage and pass locally (141.35s project), with gateway test types, typed lint, lint suppressions (3/3), and fresh P2 review passing.
- The other root failure, `checks-node-changed-compact-small-11`, independently reproduced on clean main `8d45488ae2075bd14a50c881aff6e18c32182538`: `embedded-agent-runner.prompt-cache.test.ts` responses and in-history both raised `SqliteTranscriptMutationConflictError` in the session actor append path (2 failed / 2 passed). Investigation found a cold actor snapshot prevented the existing implicit-watermark retry. Fixed directly on main as `0fa340c21f484740ec7b4ed1169b7b02439aa970` and integrated here: all 4 prompt-cache cases and 35 session-manager siblings plus lint-suppressions pass, including explicit stale rewrite refusal. The repair passed types, typed lint and fresh P2 review.
- Follow-up CI `38127338915` reached one more synthetic-only case: compaction's `mutate=input` row changes an internal selection object after starting acquisition. Removed only that row/branch under the campaign rule; five remaining compaction cases pass, along with lint-suppressions, affected types, typed lint and fresh P2 review. Its provenance is `44d905388f9` / openclaw#139429, not a human report of post-call input mutation. The final conflict repair keeps main's equivalent streaming/steering refactors, removes the obsolete retry predicate, and passes 49 owner tests plus lint-suppressions. Cancelled jobs are not counted as passing; final-head hosted CI remains the gate. No CI job was rerun.
- CI `38130432441` had one inherited fixture failure: three `sessions-mutations.catalog-queue` cases selected their configured default while expecting override fields, after openclaw#169030 intentionally made that selection a default reset. Integrated main's existing fixture-only correction `a8ef16f77650`, retaining all assertions. The corrected file passes all 14 cases on clean main under Node and Bun; the three affected cases also pass under Bun on this branch (249.87s project, mostly transformation). Exact-head hosted CI remains the final gate.
- Focused effects suites: **43 passed** across inbound-registry, remote-publication, hot-reload-dispatch and tool-search-scheduling. This includes cancellation, parent confinement, ordinary rollback/failed-activation recovery, and queued implementation replacement. Single-worker wrapper 752.15s including 142.017s compiled-worker preparation; infra 432.15s and agents-core 115.09s. Final restored remote-publication file: **7 passed**, including first reply crossing catalog adoption and exact derived-parent confinement; wrapper 372.77s (184.30s worker preparation; 131.87s Vitest). These loaded-host timings are not a performance claim.
- Integrated native-binding suites: **20 passed**, including exact token cleanup, successor protection, and revocation. The same command passed all **3 lint-suppression tests**. Single-worker wrapper 354.47s including 145.31s worker preparation.
- Current core types and native-binding test graph passed; runtime cycles **0**, Madge cycles **0**; changed-file typed lint passed. The full changed-check run reached an old-base UI duplicate-import error already fixed on main by `ef175b247c9`; that fix was integrated and the affected UI graph passed. Remaining type graphs and static guards were completed separately without changing baselines.
- Isolated Linux scope run and canonical remaining projects exercised **19,900 passing tests**. Eight failures were investigated: three pinned removed synthetic retry paths and were deleted; five exposed the correctness/fixture issues described above and were repaired with focused proof. Existing platform skips were unchanged. This is combined incremental proof, not a claim that one final-head all-scope invocation was green.
- Final repair suites: **71 passed** across passive runtime, SSE recovery, startup backoff, bootstrap, stream reconciliation/markup/phase coverage; **12 passed** across sandbox/cursor coverage, followed by **2 passed** for the real-append cursor fixture. Final MCP regression retained stdio-exit recovery and HTTP failure semantics; it passed 64 cases but hit two unchanged local child-start deadlines (1s/2s). Those initial-start paths passed on the isolated Linux run; no timeout, retry, or skip was changed to mask the local failures.
- Full-core Linux lint passed with 13 existing max-lines warnings, none in changed files. Deadcode identified and drove removal of the unused owner-publication helper. Remaining findings were in unmodified config/state/Gateway/UI files. A separate fresh current-main checkout (`401216ac50`) passed production deadcode and failed full-tree deadcode only on the unrelated `readActiveGatewayLockPortMock` export. The PR does not change any deadcode baseline.
- Blacksmith Testbox did not admit a runner within 15 minutes; AWS quota pressure supplied an undersized instance, which was released. The authorized Hetzner fallback supplied the Linux proof above. All owned remote leases are stopped. Hosted CI on the exact final head remains the landing gate; no CI jobs were rerun.

<details>
<summary>Audit coverage ledger and retained boundaries</summary>

| Mechanism (base lines) | Scenario and provenance | Decision |
| --- | --- | --- |
| context-cache-projection.ts:145-213, context.ts:87-109,146-169 | Cancellation/replacement during pure batched metadata computation. 0dd154f / openclaw#119607 fixed a measured multi-second RPC stall by yielding and atomic publication. Mid-batch authority callbacks were extra cancellation machinery; no effect occurs in projection. | REMOVE repeated projection/early checks; KEEP cooperative yields and the caller's check immediately before publication. |
| context-runtime-state.ts:33-38 | 0dd154f / openclaw#119607 seeds an old global singleton and new cache module in a synthetic child process; no human report of mixed code versions within one live process. | REMOVE old-module/cache-pair normalization, its only reuse flag, and the synthetic migration test. Ordinary process startup and same-version bundled singleton sharing remain. |
| prepared-model-runtime-lease.ts:149-164 | 9505286 / openclaw#153386. Human report openclaw#153313 by stackingrockss includes the deployed Docker version, profiler samples, and repeated boot-loop observations. Its infinite retry was caused by non-idempotent runtime selection normalization. | KEEP normalized owner selection and a visible error when a settled replacement never published; REMOVE the acquisition retry loop entirely, so it cannot spin. |
| prepared-model-catalog-worker.ts:71-220 | 9d58cf2 / openclaw#150354. Human report openclaw#149538 by 609NFT describes copied production fleet state, 632 agents, 504 failed health probes and growing RSS. openclaw#161738 by matthematics1137 reports 92 worker lifetimes, OOMs and 1.285 TB written. | KEEP one bounded shared worker, borrower cleanup, failure logging, and ordinary crash recovery. These are measured resource and real concurrency contracts, not permission to retain unrelated reload fences. |
| prepared-model-runtime.refresh-scope.ts:240 | 3e7ca30 / openclaw#151597 by obviyus describes a controlled worker crash and synthetic Gateway regression, not a human production report. Later openclaw#161738 independently establishes actual recurring worker failures. | KEEP source-bound failure reporting and bounded recovery to avoid reintroducing the observed restart/discovery amplification. The openclaw#151597 PR alone is not accepted incident evidence. |
| prepared-model-runtime.resources.ts:30-127 | d70d026 / openclaw#143109 contains native regressions and synthetic compiled CLI/Gateway proof, no linked human incident. | KEEP physical resource claims until ordinary concurrent borrowers settle and shutdown joins their cleanup; these are required cleanup mechanics, not a blanket historical-incident exemption. Inspected the complete resource owner; no extra reload retry protocol lives here. |
| prepared-model-runtime.plugin-lifetime.ts:230-319 | 1233536 / openclaw#159448 links openclaw#157842 by highfly-hi: five-agent Linux deployment with catalog-worker heap increasing 70-80 MB per scheduled turn, watchdog restarts and before/after version evidence. | KEEP final registry-reference release, current execution authority, and ordinary borrowed-resource settlement. Retained memory claims are scoped to physical lifecycle, not all historical publication machinery. |
| prepared-model-runtime.lifecycle.ts:101-164 | d92dc37 / openclaw#162484 by jalehman records actual lossless-claw maintenance calls stuck about 45 minutes during reload until restart. 1f3038b / openclaw#162301 explicitly says synthetic Gateway, no production deployment. | KEEP refusal of plugin work waiting on its own drain and process-close settlement. openclaw#162301 is synthetic evidence, not an independent incident exemption. |
| prepared-model-runtime-lease.ts acquisition loop and borrowed-generation branch | 1977a39 / openclaw#128138 and related openclaw#127217 describe synthetic QA-channel/config replacement tests; openclaw#127217 explicitly reports that its pre-fix real-Gateway run still delivered replies. Retained inbound-registry tests exposed ordinary nested selected-parent borrowing as a distinct contract. | REMOVE retry/rebind loop. KEEP exact open-parent borrowing and selection confinement; a reload during new acquisition may fail that request visibly. |
| prepared-model-runtime.published-owner.ts:91-203 | d92dc37 / openclaw#162484 added retry/recursive rereads alongside the real plugin-drain repair. That incident justifies self-drain refusal and ordinary settlement, not recursive passive owner reselection. | REMOVE repeated rereads/retries; wait once, then project or activate once. Pure catalog-stale bookkeeping no longer revalidates generation after its await. |
| prepared-model-runtime.configured-refresh.ts remote catalog adoption | 27a0f6d / openclaw#158000 has explicitly synthetic config/auth churn and fixture-provider proof; no human incident cited for the reread loop, per-attempt controllers or three-attempt owner settlement recovery. | REMOVE those race-specific retries, plus early duplicate currentness checks/error relabeling. KEEP the final owner/authority check, atomic rows/pricing commit, current catalog ordering, and ordinary cancellation/disposal. |
| prepared-model-runtime.configured-refresh.ts:396-430 parent subscriptions | 27a0f6d / openclaw#158000; same synthetic churn proof. Parent-generation subscriptions duplicate the final owner/generation/config check. | REMOVE parent-generation early cancellation listeners. KEEP shutdown and candidate-retirement cancellation, bounded work, cleanup, and the final serialized effect check. |
| prepared-model-runtime.owner.ts:612-631 batch supersession retry | 4616d20 / openclaw#152467. Tests force one auth owner to supersede while a sibling is building. No independent human incident identified for sibling retry. | REMOVE retry of the surviving batch; retain source-bound credential/current-owner checks and report the original publication failure. |
| prepared-model-runtime.owner.ts:124-134 unused publication probe | e56f825 / openclaw#130856 introduced a helper returning matching/pending publication facts for acquisition retries. Its callers are gone; full-repository search finds only the definition. | REMOVE the dead helper/export. Credential-refresh cancellation remains supported by the direct, abortable configured-owner wait and its unchanged regression tests. |
| sandbox/registry.kernel.ts:396,420; sandbox/registry.ts:295 | 5c7e44c / openclaw#151172 is not treated as an incident report. Read-only admission accepts older schemas; tableExists consumes admitted schema.tables facts, not repeated SQL/format validation. | KEEP the existing absent-table empty/null contract. No runtime foreign-commit or repeated validation probe exists in these calls. |
| harness/native-session/binding-leases.ts | b272376 / openclaw#158396 moved writes to workers; elapsed-time rechecks were covered by synthetic clock-jump tests. ffd0759 / openclaw#164197 supplies native successor authority behavior, not a blanket exemption. | REMOVE prepared callback plumbing and post-worker wall-clock-only rechecks. KEEP exact-row CAS, token/phase/failure checks, current mutation authority, bounded acquisition, renewal, and write settlement. |
| harness/context-engine-logical-turn.ts | openclaw#143491/openclaw#140023 supply synthetic lifecycle tests, not qualifying human incident evidence. The owner actually holds resources used by outstanding context-engine work. | KEEP ordinary work completion and deferred disposal until implementation settlement; no extra synthetic reload retry was retained here. |
| harness/model-catalog.ts:168-177,242-284,353 | 01fd244 / openclaw#134524 repairs human availability report openclaw#134460. Passive replacement/closure branches were additional maintainer hardening and synthetic variants, not that report's failure. | REMOVE passive isCurrent callbacks and ambient registry replacement checks. KEEP exact owned registry/config, provider outcomes, discovery, selection and the actual availability repair. |
| auth-profiles/oauth-refresh-peers.ts | openclaw#166183/openclaw#167002/openclaw#166659 are not claimed as human incident evidence. Refresh credentials rotate/revoke and carry account identity; copied historical peers must not replay spent tokens or inherit another account. | KEEP these credential/identity effect boundaries and ordinary uncertain-write settlement. No auth-profile schema, secrets, permissions or durability changes. |
| worktrees lifecycle/removal | Audited run-lease-owner.ts, service-preparation.ts, eviction.runtime.ts and gc-removal.ts. They coordinate destructive removal of user artifacts with live checkout/source handles, exact refs and ordinary parallel sessions. No PR title is treated as incident evidence. | KEEP current-row removal/exclusive source checks and rollback/cleanup custody for writes and deletion. Removing them would risk user artifacts, independently prohibited by the data-loss boundary. |
| tool-search-scheduling.ts | 49f8d29 / openclaw#140767 adds ancestry reentrancy and queued object/mode identity checks with automated interactive/headless regressions. Production catalogs exclude control tools; recursive calls using the same runtime were synthetic only. | REMOVE unreachable nested-call ancestry. KEEP one exact queued implementation/mode check at the effect, catalog-ID authorization, FIFO/exclusion, abort and implementation settlement. |
| agent-steering-queue.ts:194-263 | 94acbe6 / openclaw#163195 records Peter's actual three-day production errors. The incident justifies owner/FIFO repair, not a fingerprint of every result label/task/time/outcome/origin/transcript field. | REMOVE full payload fingerprints and deep-equality invalidation. KEEP run-owner identity, prepared result authority, current requester store, pending-row effect checks, FIFO, exact lease/status acknowledgment and release. |
| agent-bundle-mcp-manager.ts and manager-install.ts | 1d60d3d / openclaw#138694 reports synthetic fail-before/real-transport proof but no cited actual-use incident for repeated crossed-publication acquisition/reload. | REMOVE the acquisition retry/rebind loop and repeated reload replay. KEEP the runtime-key queue, ordinary cleanup, one postcreation config catchup, requester credentials/authorization and live tool effect checks. |
| agent-bundle-mcp-runtime.ts catalog generations | 140dbbd / openclaw#125564 and follow-up 0818bcb / openclaw#167642 have synthetic notifications/listing interleavings, not human reports for replaying tools/list during its own response. | REMOVE catalog invalidation generations, replay of a notification arriving inside tools/list, and the impossible repeated replacement-retirement loop. KEEP listing single-flight, caching, bounds, diagnostics, normal reconnect, one retry for an actually exited previously healthy server, and execution authority. |
| prepared-model-runtime-lease.ts / plugin-lifetime.ts configured-generation re-admission | 8b13535 / openclaw#168410, landed during this lane, describes a gated Docker reproduction with catalog publication 0.3s after admission, not an actual human-user incident. | REMOVE configured-generation retry and its now-unused WeakSet plus the two retry-only tests. KEEP fail-closed superseded-generation rejection and the new derived-parent confinement security test. |

</details>
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…
RomneyDa added a commit that referenced this pull request Oct 17, 2026
…roof

The sessions_send visible-child proof timed out on every 2026.10.5
candidate: its synthetic provider picked the latest user item that lacked
the legacy <<<BEGIN_OPENCLAW_INTERNAL_CONTEXT>>> marker as the user prompt.

Since #168546 (backport 8d66b94), OpenAI-compatible Responses
endpoints, including mock-openai, keep runtime context in a user-role
"OpenClaw runtime context:" carrier after the user turn instead of a
developer message. The fixture then read that carrier as the prompt, never
saw the "send" prompt on turn 2, answered PARENT_READY again, and the test
waited for PARENT_DONE until timeout.

Captured provider requests: v2026.10.4 sends the turn-2 carrier with role
developer; the 10.5 tip sends it with role user. Reverting a293f2e
(#168410) left the failure unchanged.

Select the prompt with the shared qa-lab isInternalRuntimeContextCarrierText
helper, which already accepts current and legacy carrier shapes.
RomneyDa added a commit that referenced this pull request Oct 20, 2026
…roof

The sessions_send visible-child proof timed out on every 2026.10.5
candidate: its synthetic provider picked the latest user item that lacked
the legacy <<<BEGIN_OPENCLAW_INTERNAL_CONTEXT>>> marker as the user prompt.

Since #168546 (backport 8d66b94), OpenAI-compatible Responses
endpoints, including mock-openai, keep runtime context in a user-role
"OpenClaw runtime context:" carrier after the user turn instead of a
developer message. The fixture then read that carrier as the prompt, never
saw the "send" prompt on turn 2, answered PARENT_READY again, and the test
waited for PARENT_DONE until timeout.

Captured provider requests: v2026.10.4 sends the turn-2 carrier with role
developer; the 10.5 tip sends it with role user. Reverting a293f2e
(#168410) left the failure unchanged.

Select the prompt with the shared qa-lab isInternalRuntimeContextCarrierText
helper, which already accepts current and legacy carrier shapes.

(cherry picked from commit d3a06e7)
RomneyDa added a commit that referenced this pull request Oct 20, 2026
…7319)

* fix(test): treat the env-gated Agents API live proof as optional shard evidence

test/gateway-agentsapi.live.test.ts (new since 2026.10.4) skips its only case
unless OPENCLAW_LIVE_AGENTS_API=1, which the native live test-harness shard
never sets, so the shard's no-passing-assertions guard failed it on every
2026.10.5 candidate once the other harness tests went green. Register it in
the existing whole-file opt-in map like the other env-gated live proofs.

(cherry picked from commit 761ef64)

* fix(test): decode the Codex CLI JSON error after plugin uninstall

The live Codex npm plugin lane matched the expected post-uninstall error
against raw --json stdout, where quotes are escaped, so the correct
owner-plugin-not-activatable error never matched. Decode the canonical CLI
error message first, as the 2026.10.4 release line does (a9fd56d).

(cherry picked from commit e8772a9)

* fix(test): scope CLI announcement barrier to parent probe

(cherry picked from commit d5c0db7)
(cherry picked from commit a48d4a8)

* test(live): wait out the crash-loop breaker before the orphan settles

The native subagent restart live proof SIGKILLs the Gateway three times in
about two minutes. The third unclean boot trips the documented restart-loop
breaker (3 unclean boots within 5 minutes, #166238), which pauses restart
settlement, including interrupted subagent recovery (#166846), until the
unclean window drains. The orphan assertion added with the #169144 backport
only waited 30 seconds, so the nonannouncing child was still `running`.

Wait up to 360 seconds for the orphan settlement so the proof covers the
breaker pause and the automatic resume after its window. Assertions are
unchanged. 2026.10.4 passed because it predates the breaker pause, startup
subagent reconciliation, and this assertion.

Deterministic proof: the quiet-child e2e twin with SIGKILL restarts and an
exec-blocked child passes with one prior kill; with two warm-up kills it logs
"restart-loop breaker tripped" and the parent continuation never arrives
within 60 seconds; with a 400-second wait it settles and passes (338s).

(cherry picked from commit 1a4c2a0)

* test(qa-lab): skip user-role runtime carriers in visible-child send proof

The sessions_send visible-child proof timed out on every 2026.10.5
candidate: its synthetic provider picked the latest user item that lacked
the legacy <<<BEGIN_OPENCLAW_INTERNAL_CONTEXT>>> marker as the user prompt.

Since #168546 (backport 8d66b94), OpenAI-compatible Responses
endpoints, including mock-openai, keep runtime context in a user-role
"OpenClaw runtime context:" carrier after the user turn instead of a
developer message. The fixture then read that carrier as the prompt, never
saw the "send" prompt on turn 2, answered PARENT_READY again, and the test
waited for PARENT_DONE until timeout.

Captured provider requests: v2026.10.4 sends the turn-2 carrier with role
developer; the 10.5 tip sends it with role user. Reverting a293f2e
(#168410) left the failure unchanged.

Select the prompt with the shared qa-lab isInternalRuntimeContextCarrierText
helper, which already accepts current and legacy carrier shapes.

(cherry picked from commit d3a06e7)

* test(buzz): skip real reconnect backoff in cold-start recovery

(cherry picked from commit fa2049a)

* fix(release): let the Telegram release lane finish its 25 scenarios

The isolated Telegram candidate job hit its 60-minute limit at scenario 24/25
on every 2026.10.5 candidate (about 62 minutes needed at 102-108s per packaged
Gateway start). main carries the same Telegram scenario set and job, so
raise the job budget to 90 minutes; the calling release-checks job keeps its
210-minute bound.

Also carry the 2026.10.4 release-line fixture fix for
telegram-prepared-delivery-recovery (8b78670): keep the audit receipt in
the shared Gateway workspace and create it up front so the isolated SUT can
append without EACCES. main still writes it under the private tempRoot.

(cherry picked from commit 3cb49f0, adapted to main's runner anchor)

* test(gateway): probe startup readiness on fresh connections

The deferred-fleet startup test failed twice in 2026.10.5 FRV #12 with
`fetch failed` / `read ECONNRESET`. Its Gateway shares the test process's
event loop. A /healthz or /readyz probe could reuse a keep-alive socket
that Undici still treated as live; when the request was written and a
synchronous main-thread startup stall followed, the server's idle-timer
callback ran before the poll phase read the request and destroyed the
socket with the request unread, so the kernel reset the connection.

main still probes with default keep-alive fetches. Probe with
`Connection: close`, matching existing Gateway test probes. Assertions are
unchanged.

(cherry picked from commit e3c63f2, adapted to main's probe sites)

* test(live): expect review effort for Skill Workshop background reviews in the Ultra lane

Since #161057 the Skill Workshop counts iterations per session, so Ultra probe
sessions trigger a background review after idling. The review runs under its
own skill-workshop-review: run and does not inherit the session's thinking
level, so the lane's every-request-is-max assertion failed on 2026.10.5
whenever a review reached the provider.

On main, #173889 pins review runs to thinkLevel "low" (review-run.ts), which
the OpenAI stream wrapper sends as effort "low". Expect that effort for review
runs; Ultra runs and their sessions must still be max, and independent
heartbeats stay medium.

The live file is over the line cap, so the Ultra wire effort policy moves to
a sibling helper with its observation type, and the deterministic review
cases run in the normal helper suite.

(cherry picked from commit ca15213, adapted to main's review thinking level)

* test(release): forward-port 2026.10.4-line upgrade-survivor and runtime-smoke harness fixes

Release-line harness fixes that 2026.10.1-2026.10.5 carried but main never
received:

- cron-scheduled-authority: seed the cron authority specimen through the
  published baseline's own SQLite writer (seedPublishedCronJobs) instead of a
  raw cron/jobs.json that current candidates treat as a retired pre-July
  store; drop owner fields for pre-2026.7.1 baselines
  (usesCronOwnerAtBaseline). The dispatcher passes the package root to
  seedState, and the scenario now requires a published baseline.
- bundled plugin runtime smoke: join deferred read-only update discovery via
  update.status before the package-manager child watchdog. main still defers
  install discovery (`<manager> root -g`) until after ready, so it can race
  the watchdog's no-package-manager-children check.

Skips the codex npm plugin live source-reply grep from the release commit:
main already probes dynamic-tool-source-reply.ts and dynamic-tools.ts.

(cherry picked from commit fcdf0d1, codex grep hunk dropped; cron seed
test adapted to main's executable-mode fixture writes)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 21, 2026
…nclaw#177319)

* fix(test): treat the env-gated Agents API live proof as optional shard evidence

test/gateway-agentsapi.live.test.ts (new since 2026.10.4) skips its only case
unless OPENCLAW_LIVE_AGENTS_API=1, which the native live test-harness shard
never sets, so the shard's no-passing-assertions guard failed it on every
2026.10.5 candidate once the other harness tests went green. Register it in
the existing whole-file opt-in map like the other env-gated live proofs.

(cherry picked from commit 761ef64)

* fix(test): decode the Codex CLI JSON error after plugin uninstall

The live Codex npm plugin lane matched the expected post-uninstall error
against raw --json stdout, where quotes are escaped, so the correct
owner-plugin-not-activatable error never matched. Decode the canonical CLI
error message first, as the 2026.10.4 release line does (a9fd56d).

(cherry picked from commit e8772a9)

* fix(test): scope CLI announcement barrier to parent probe

(cherry picked from commit d5c0db7)
(cherry picked from commit a48d4a8)

* test(live): wait out the crash-loop breaker before the orphan settles

The native subagent restart live proof SIGKILLs the Gateway three times in
about two minutes. The third unclean boot trips the documented restart-loop
breaker (3 unclean boots within 5 minutes, openclaw#166238), which pauses restart
settlement, including interrupted subagent recovery (openclaw#166846), until the
unclean window drains. The orphan assertion added with the openclaw#169144 backport
only waited 30 seconds, so the nonannouncing child was still `running`.

Wait up to 360 seconds for the orphan settlement so the proof covers the
breaker pause and the automatic resume after its window. Assertions are
unchanged. 2026.10.4 passed because it predates the breaker pause, startup
subagent reconciliation, and this assertion.

Deterministic proof: the quiet-child e2e twin with SIGKILL restarts and an
exec-blocked child passes with one prior kill; with two warm-up kills it logs
"restart-loop breaker tripped" and the parent continuation never arrives
within 60 seconds; with a 400-second wait it settles and passes (338s).

(cherry picked from commit 1a4c2a0)

* test(qa-lab): skip user-role runtime carriers in visible-child send proof

The sessions_send visible-child proof timed out on every 2026.10.5
candidate: its synthetic provider picked the latest user item that lacked
the legacy <<<BEGIN_OPENCLAW_INTERNAL_CONTEXT>>> marker as the user prompt.

Since openclaw#168546 (backport 8d66b94), OpenAI-compatible Responses
endpoints, including mock-openai, keep runtime context in a user-role
"OpenClaw runtime context:" carrier after the user turn instead of a
developer message. The fixture then read that carrier as the prompt, never
saw the "send" prompt on turn 2, answered PARENT_READY again, and the test
waited for PARENT_DONE until timeout.

Captured provider requests: v2026.10.4 sends the turn-2 carrier with role
developer; the 10.5 tip sends it with role user. Reverting a293f2e
(openclaw#168410) left the failure unchanged.

Select the prompt with the shared qa-lab isInternalRuntimeContextCarrierText
helper, which already accepts current and legacy carrier shapes.

(cherry picked from commit d3a06e7)

* test(buzz): skip real reconnect backoff in cold-start recovery

(cherry picked from commit fa2049a)

* fix(release): let the Telegram release lane finish its 25 scenarios

The isolated Telegram candidate job hit its 60-minute limit at scenario 24/25
on every 2026.10.5 candidate (about 62 minutes needed at 102-108s per packaged
Gateway start). main carries the same Telegram scenario set and job, so
raise the job budget to 90 minutes; the calling release-checks job keeps its
210-minute bound.

Also carry the 2026.10.4 release-line fixture fix for
telegram-prepared-delivery-recovery (8b78670): keep the audit receipt in
the shared Gateway workspace and create it up front so the isolated SUT can
append without EACCES. main still writes it under the private tempRoot.

(cherry picked from commit 3cb49f0, adapted to main's runner anchor)

* test(gateway): probe startup readiness on fresh connections

The deferred-fleet startup test failed twice in 2026.10.5 FRV openclaw#12 with
`fetch failed` / `read ECONNRESET`. Its Gateway shares the test process's
event loop. A /healthz or /readyz probe could reuse a keep-alive socket
that Undici still treated as live; when the request was written and a
synchronous main-thread startup stall followed, the server's idle-timer
callback ran before the poll phase read the request and destroyed the
socket with the request unread, so the kernel reset the connection.

main still probes with default keep-alive fetches. Probe with
`Connection: close`, matching existing Gateway test probes. Assertions are
unchanged.

(cherry picked from commit e3c63f2, adapted to main's probe sites)

* test(live): expect review effort for Skill Workshop background reviews in the Ultra lane

Since openclaw#161057 the Skill Workshop counts iterations per session, so Ultra probe
sessions trigger a background review after idling. The review runs under its
own skill-workshop-review: run and does not inherit the session's thinking
level, so the lane's every-request-is-max assertion failed on 2026.10.5
whenever a review reached the provider.

On main, openclaw#173889 pins review runs to thinkLevel "low" (review-run.ts), which
the OpenAI stream wrapper sends as effort "low". Expect that effort for review
runs; Ultra runs and their sessions must still be max, and independent
heartbeats stay medium.

The live file is over the line cap, so the Ultra wire effort policy moves to
a sibling helper with its observation type, and the deterministic review
cases run in the normal helper suite.

(cherry picked from commit ca15213, adapted to main's review thinking level)

* test(release): forward-port 2026.10.4-line upgrade-survivor and runtime-smoke harness fixes

Release-line harness fixes that 2026.10.1-2026.10.5 carried but main never
received:

- cron-scheduled-authority: seed the cron authority specimen through the
  published baseline's own SQLite writer (seedPublishedCronJobs) instead of a
  raw cron/jobs.json that current candidates treat as a retired pre-July
  store; drop owner fields for pre-2026.7.1 baselines
  (usesCronOwnerAtBaseline). The dispatcher passes the package root to
  seedState, and the scenario now requires a published baseline.
- bundled plugin runtime smoke: join deferred read-only update discovery via
  update.status before the package-manager child watchdog. main still defers
  install discovery (`<manager> root -g`) until after ready, so it can race
  the watchdog's no-package-manager-children check.

Skips the codex npm plugin live source-reply grep from the release commit:
main already probes dynamic-tool-source-reply.ts and dynamic-tools.ts.

(cherry picked from commit fcdf0d1, codex grep hunk dropped; cron seed
test adapted to main's executable-mode fixture writes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant