Skip to content

fix(workboard): card is blocked while its run continues on a fallback model - #167745

Closed
skyzhao1223 wants to merge 4 commits into
openclaw:mainfrom
skyzhao1223:fix/workboard-attempt-level-agent-end-blocked-167574
Closed

skyzhao1223 wants to merge 4 commits into
openclaw:mainfrom
skyzhao1223:fix/workboard-attempt-level-agent-end-blocked-167574

Conversation

@skyzhao1223

@skyzhao1223 skyzhao1223 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Closes #167574

What Problem This Solves

Fixes: a Workboard card is moved running → blocked (with a false failed notification and a metadata.failureCount increment) when the first model candidate of its run fails while the same run continues on a configured fallback model.

User Impact

User impact: dispatched Workboard cards stay unblocked while a fallback candidate continues the run, so operators and orchestrators no longer react to a false blocked/failed signal for live work (the reporter saw 8 falsely blocked cards in one night, one needlessly reopened by an operator). Genuine run failures still reach blocked: the run-level subagent_ended hook writes it immediately, and the 60-second lifecycle sweep writes it from authoritative session state for links without a run-level terminal event — for those links the failure write can be delayed by up to one sweep interval. No schema, config, or notification-format changes.

Why This Change Was Made

agent_end fires from embedded attempt finalization per model candidate, so a success: false attempt event can precede the failover that continues the same run (same runId/sessionKey) — the issue's exact timeline (blocked written ~1.4 s before embedded_run_failover_decision). Workboard previously mapped every non-ok agent_end straight to blocked.

The event path now consults the authoritative overall-run outcome before either attempt-level terminal write: it reads the same sessions.list snapshot the lifecycle sweep uses, and while the linked session is still running/hasActiveRun the card stays running, leaving the settled transition to its run-level owners (subagent_ended, sweep). Both directions matter: a failed attempt can precede a fallback that continues the run, and a candidate-level success can precede the runner settling an overall error — the exhausted-chain case caught in review, where deferring only failures let a success attempt hook review the card and the true terminal blocked write was then (correctly) refused, stranding failed work in review. An absent session, unavailable Gateway, or failed read keeps the event's own outcome, so genuine results are never lost. subagent_ended (once per run, authoritative) and the sweep are unchanged; the liveness read runs only for agent_end events.

Per review, liveness matching preserves the established session-ownership rules (#125429): the event's exact session key is authoritative, and an agentless subagent:workboard-* card link borrows a suffix match only when the complete snapshot shows exactly one session with that suffix — a different agent's live session can never vouch for this event's terminal outcome. Manual states and the store's ordering guards are untouched; the veto only downgrades the event's observation before it reaches syncLifecycle.

Evidence

Unit boundary — regressions established before implementation (red first, green after):

  • attempt-level agent_end failure + session row proving the run alive → card stays running, no failureCount, no moved → blocked event (red on main: card becomes blocked)
  • agent_end failure after the run ended (session terminal) → blocked + failureCount: 1 immediately
  • liveness read failure → the event's own outcome preserved (blocked)
  • ownership regressions requested in review (red on this PR's first revision, green after): the event naming terminal agent:alpha:… while agent:beta:… runs the same suffix → alpha's failure still blocks; agentless link with an ambiguous suffix match → no veto
  • ordered exhaustion regression requested in review (red on the second revision, green after): failed attempt (run live) → stays running; candidate-level success hook (run live) → still running, no review; run-level subagent_ended(outcome: error) → blocked + failureCount: 1 — failed work settles blocked, never stranded in review
  • settled-run immediacy: agent_end success with an already-settled session snapshot → review immediately (no deferral once the run is over)
  • pnpm test extensions/workboard/src/lifecycle-sync.test.ts --maxWorkers=1 → 36/36 passed (33.8 s wall)

Runtime — discriminating RED/GREEN through the affected Codex primary-to-fallback path:
The issue's producer is reproduced without a Codex subscription: the real codex-cli 0.162.1 app-server with openai_base_url pointed at a local mock (the repo's own qa-lab Codex-mock recipe: OPENCLAW_CODEX_APP_SERVER_ARGS + staged model catalog). The worker agent's primary openai/qa-primary routes through the Codex harness and the mock rejects every /v1/responses call with HTTP 403 — the issue's exact trigger shape (reason=auth, 403). Fallback qamockf/qa-fallback is an ordinary embedded mock model that completes normally. Same isolated Gateway, config, mock, and workboard dispatch --admin flow in both runs; the repo dist was rebuilt once from origin/main and once from this PR's head — the workboard code is the only variable.

  • RED (workboard from origin/main, card ad79e589): moved running → blocked at 04:35:33.404; gateway logs embedded run failover decision: decision=fallback_model reason=auth attempt=1 from=openai/qa-primary rawError=unexpected status 403 at 12:35:33.491 — the false blocked lands 87 ms before the failover decision, the same ordering as the reporter's timeline (blocked 1.4 s before embedded_run_failover_decision). candidate_succeeded qamockf/qa-fallback follows at 12:35:34.143, yet the card stays blocked: blocked → review is not an allowed lifecycle transition, so only workboard_complete or an operator can free it — exactly the harm described in the issue.
  • GREEN (workboard from this PR's head, card 3827b7d9): same 4× 403 /v1/responses attempts → candidate_failed → candidate_succeeded; card goes running → review with no blocked transition, failureCount: undefined, notifications: [].
Annotated run transcripts (mock request log, gateway decision log, card events)
# RED — origin/main workboard (card ad79e589)
mock : 04:35:27.500Z responses model=qa-primary        (HTTP 403, x4 attempts through 04:35:33.361Z)
card : 04:35:18.565Z moved ready -> running
card : 04:35:33.404Z moved running -> blocked          <-- FALSE BLOCKED (run still alive)
gw   : 12:35:33.491 embedded run failover decision: runId=workboard:ad79e589-… stage=prompt decision=fallback_model reason=auth attempt=1 retry=0 rotations=0 from=openai/qa-primary rawError=unexpected status 403 Forbidden: QA injected: codex primary candidate forbidden, url: http://127.0.0.1:45999/v1/responses
gw   : 12:35:33.501 model fallback decision: decision=candidate_failed requested=openai/qa-primary candidate=openai/qa-primary reason=auth next=qamockf/qa-fallback
mock : 04:35:34.097Z chat/completions model=qa-fallback (served OK)
gw   : 12:35:34.143 model fallback decision: decision=candidate_succeeded requested=openai/qa-primary candidate=qamockf/qa-fallback
card : status still blocked 90s+ after candidate_succeeded (no allowed blocked->review transition)

# GREEN — PR head 3fd17d70 workboard (card 3827b7d9)
mock : 04:10:40.820Z–04:10:46.253Z responses model=qa-primary (HTTP 403, x4)
card : 04:10:31.889Z moved ready -> running
gw   : 12:10:46.347 embedded run failover decision: … decision=fallback_model reason=auth attempt=1 from=openai/qa-primary rawError=403 …/v1/responses
gw   : 12:10:46.361 model fallback decision: decision=candidate_failed … next=qamockf/qa-fallback
mock : 04:10:47.104Z chat/completions model=qa-fallback (served OK)
gw   : 12:10:47.171 model fallback decision: decision=candidate_succeeded candidate=qamockf/qa-fallback
card : 04:10:47.151Z moved running -> review
card : final: status review | failureCount undefined | notifications [] | no blocked event

Environment: macOS arm64, Node 24.21.0, openclaw 2026.9.9 source checkout; isolated state dir; gateway loopback:45998 token auth, Control UI off; agents.defaults.model: { primary: openai/qa-primary (agentRuntime codex), fallbacks: [qamockf/qa-fallback] }.

Runtime — exhausted-fallback control on the final head (1d39c9d8), the scenario review flagged:
Same Codex-mock rig with both candidates rejecting (codex primary 401 on /v1/responses, embedded fallback 401 on /v1/chat/completions): gateway logs candidate_failed openai/qa-primary next=qamockf/qa-fallback (13:19:57.192) then candidate_failed qamockf/qa-fallback next=none (13:19:57.948); card 0895f7ae moves running → blocked (05:19:58.152Z) with failureCount: 1 — the genuinely terminal run settles blocked, not review. The success-path control on the same head (card d64e49de): 401 primary → candidate_succeeded fallback → running → review written after settlement (05:22:18.213Z vs candidate_succeeded 13:22:18.143), failureCount: undefined, notifications: [], no blocked transition.

Runtime — embedded-path clean fallback completion (acceptance scenario):
With an ordinary openai-completions mock primary rejecting every completion (HTTP 400) and a healthy fallback, a Gateway-dispatched card on this PR's head completes through candidate_failed → candidate_succeeded with no blocked transition, no failed notification, and no failureCount increment (card f33b8283: created → ready → running → review, failureCount: undefined, notifications: []). A separate run where the codex transport itself dies at launch (run genuinely terminal, no fallback) correctly produced blocked + failureCount: 1 — the veto does not over-suppress real terminal failures (card f867b84f).

Gates (final head 1d39c9d8): pnpm test extensions/workboard --maxWorkers=1 → 406/406 passed (28 files); pnpm check:changed → passed (lint 0/0, dead-export scans 0, plugin-sdk boundary dts, typecheck, import cycles 0); pnpm build → passed; git diff --check → clean. The checks-fast-baseline-ratchets red on the first revision was inherited main baseline drift (session-accessor.sqlite-read.ts assertion count, fixed on main by cff1f4fc); the rebase onto 3223e13a cleared it.

Remaining honest note: the Codex-path runs drive the real codex-cli app-server against a mock provider (no live ChatGPT subscription involved); they reproduce the issue's producer path — attempt-level failure surfacing through the Codex harness while the embedded failover continues the same run — at the same harness boundary the reporter's logs show. On the pure embedded path, candidate errors are absorbed by the failover/retry state machine before attempt finalization (agent_end carries success: true there), which matches @obviyus's earlier non-Codex runtime finding. On main that success hook also writes an early running → review while the run is still retrying; on this PR's head that write is deferred to settlement like every other attempt-level terminal (visible in the d64e49de timing above: review lands after candidate_succeeded, not before the failover decision).

@clawsweeper

clawsweeper Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

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

View the workflow run.

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 9, 2026
@clawsweeper

clawsweeper Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

Workboard defers attempt-level card completion while the linked run remains active and carries automation nudges into later settlement.

Example: A Workboard worker's primary model returns HTTP 403 and its configured fallback succeeds.

  • Before: The card becomes blocked during fallback and records a false failure.
  • After: The card stays running until settlement, then enters review without a false failure.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Strong runtime evidence supports the central fallback repair, but two automation defects block merge and the newest settlement path lacks runtime coverage.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Recovering workers appear blocked and emit false failures while fallback work continues.
Reason: Overall-run settlement restores established card behavior without adding a product surface.

Merge readiness

⛔ Blocked before merge - 3 items remain

This PR addresses a reproduced fallback-run bug, but two automation defects remain in the settlement handling; the open replacement is not yet safely landable.

Priority: P1
Reviewed head: 27ed41a10059ebe7e1b79e06d1e18ab396a7ae35

Before merge

  • Add real behavior proof - Built-Gateway logs at 1d39c9d prove real Codex-primary fallback success and exhaustion through shipped dispatch commands, but the new 27ed41a sweep-to-automation path has only callback-test evidence; provide a redacted Gateway trace exercising deferred session-only automation and cron-origin exclusion, removing 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.
  • Defer automation nudges for failed attempts too (P2) - A failed primary attempt with a live fallback is changed to a running observation, but this condition excludes only successful attempts from onMatched. For a board with attached automation, the failed attempt therefore runs that automation against a still-running card and starts its 60-second debounce. If fallback settles within that window, the real completion nudge is suppressed, so the automation can miss the completed work until its normal schedule. Exclude every deferred attempt from the immediate nudge and carry both terminal outcomes into settlement-triggered automation.
  • Preserve cron-origin identity in sweep settlement nudges (P2) - The new sweep callback passes only cards, so automationNudge.nudge receives no sessionKey and its cron-origin exclusion cannot fire. A supported card linked to agent:main:cron:job-categorize-planning:run:run-1 on a board attached to that job will request the same automation when the sweep observes done, although the event path deliberately suppresses that request. Preserve each matched session key through settlement and exclude cron-origin entries before combining board nudges, including mixed cron and ordinary-session batches.

Findings

  • [P2] Defer automation nudges for failed attempts too — extensions/workboard/src/lifecycle-sync.ts:196-198
  • [P2] Preserve cron-origin identity in sweep settlement nudges — extensions/workboard/src/lifecycle-sync.ts:606-608

Tests

  • Low-value test extensions/workboard/src/lifecycle-sync.attempt-deferral.test.ts: The two new automation tests assert mocked onMatched/onSettled callback payloads rather than real automation admission; replace those callback-only assertions with coverage using the existing nudge owner so debounce and cron-origin behavior are exercised.
  • Missing end-to-end proof: The latest settlement-callback change lacks a shipped-Gateway trace showing session-only settlement nudging attached automation after completion while cron-origin settlement remains excluded.
Agent review details

How this fits together

The Gateway-side Workboard plugin consumes agent hooks and session snapshots, updates stored cards, and requests attached board automations through its service owner.

flowchart TD
  A[Attempt completion hook] --> B[Session liveness lookup]
  B --> C[Workboard lifecycle owner]
  D[Run completion hook] --> C
  E[Periodic session sweep] --> C
  C --> F[Stored card]
  C --> G[Automation nudge owner]
  F --> H[Workboard dashboard]
Loading

Technical review

Best possible solution:

Keep overall-run settlement while dispatching attached automation only after authoritative terminal settlement and preserving cron-origin exclusion.

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

Current-main source directly maps attempt outcomes to terminal card states, and supplied built-Gateway comparisons reproduce successful and exhausted fallback chains; this review ran no target code.

Is this the best way to solve the issue?

Session liveness is a useful settlement boundary, but both provisional outcomes must defer automation and sweep callbacks must retain the matched session identity.

Full review comments:

  • [P2] Defer automation nudges for failed attempts too — extensions/workboard/src/lifecycle-sync.ts:196-198
    A failed primary attempt with a live fallback is changed to a running observation, but this condition excludes only successful attempts from onMatched. For a board with attached automation, the failed attempt therefore runs that automation against a still-running card and starts its 60-second debounce. If fallback settles within that window, the real completion nudge is suppressed, so the automation can miss the completed work until its normal schedule. Exclude every deferred attempt from the immediate nudge and carry both terminal outcomes into settlement-triggered automation.
    Confidence: 0.99
  • [P2] Preserve cron-origin identity in sweep settlement nudges — extensions/workboard/src/lifecycle-sync.ts:606-608
    The new sweep callback passes only cards, so automationNudge.nudge receives no sessionKey and its cron-origin exclusion cannot fire. A supported card linked to agent:main:cron:job-categorize-planning:run:run-1 on a board attached to that job will request the same automation when the sweep observes done, although the event path deliberately suppresses that request. Preserve each matched session key through settlement and exclude cron-origin entries before combining board nudges, including mixed cron and ordinary-session batches.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Attempt-terminal card interpretation changes intended behavior with a stated reason (d0b1b6d: Gateway-owned hooks and recovery sweeps synchronize linked cards even when the dashboard is closed.)
  • Completion-triggered automation keeps the original intent (2b55b55: Linked session completion requests attached automation without waiting for its schedule, with cron-origin exclusion preventing self-triggering.)
  • Service-owned automation admission keeps the original intent (094f165: Terminal processing must survive completed-worker caller closure through active service authority while stale caller authority remains rejected.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test extensions/workboard/src/lifecycle-sync.attempt-deferral.test.ts extensions/workboard/src/lifecycle-sync.test.ts extensions/workboard/src/lifecycle-sync.restart.test.ts --maxWorkers=1
  • pnpm test test/plugins/workboard-automation-authority.test.ts --maxWorkers=1
  • pnpm check:changed
  • git diff --check

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 2b55b55 adds extensions/workboard/src/lifecycle-sync.ts:43 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2b55b55b7245; files: extensions/workboard/src/lifecycle-sync.ts)

PR surface

Source +123, Tests +377. Total +500 across 6 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 3 147 24 +123
Tests 3 396 19 +377
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 543 43 +500

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #167574
Summary: The report and competing fixes concern model-attempt outcomes being mistaken for overall-run outcomes; no replacement is currently proven safe to land.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.
  • remove proof: sufficient: Current real behavior proof status is insufficient, not sufficient.
  • remove status: ⏳ waiting on author: Current PR status label is status: 📣 needs proof.

Label justifications:

  • P1: The reported official-release failure sends false blocked and failed signals during active fallback work, prompting intervention against workers that are still running.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

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 (7 earlier review cycles)
  • reviewed 2026-10-09T09:24:39.743Z sha 516840995d95100a71e592cd3a4dd199b7d35a31 :: needs real behavior proof before merge. :: [P2] [P2] Match liveness to the event's exact session owner
  • reviewed 2026-10-09T09:58:20.993Z sha 3fd17d7 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-09T10:44:53.702Z sha 3fd17d7 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-10T04:07:33.049Z sha 3fd17d7 :: needs changes before merge. :: [P1] Defer successful attempt hooks until the overall run settles
  • reviewed 2026-10-10T04:47:19.240Z sha 3fd17d7 :: needs changes before merge. :: [P1] Defer successful attempt hooks until the overall run settles
  • reviewed 2026-10-10T05:22:53.052Z sha 1d39c9d :: needs real behavior proof before merge. :: [P2] Nudge attached automation after deferred card settlement | [P2] Skip session discovery when no cards match the hook
  • reviewed 2026-10-10T05:42:05.018Z sha 1d39c9d :: needs changes before merge. :: [P2] Nudge attached automation after deferred card settlement | [P2] Skip session discovery when no cards match the hook

Reviewed October 10, 2026, 2:21 AM ET / 06:21 UTC (Revision 8).

@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. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Oct 9, 2026
@skyzhao1223
skyzhao1223 force-pushed the fix/workboard-attempt-level-agent-end-blocked-167574 branch from 39dfc5c to 23b1057 Compare October 9, 2026 09:48
… model

agent_end fires per model-candidate attempt finalization, so a failed
first candidate mapped straight to blocked even while the embedded runner
continued the same run on a configured fallback. The card spent the rest
of the run falsely blocked, emitted a failed notification for live work,
and incremented metadata.failureCount.

Consult the authoritative session snapshot before a terminal failed write
from the event path: a linked session that still has an active run keeps
the card running and leaves the terminal transition to its run-level
owners (subagent_ended and the lifecycle sweep). An absent session,
unavailable Gateway, or failed read keeps the event's own outcome so
genuine failures are never lost. subagent_ended and success paths are
unchanged.
…owner

Review found that an agentless card link could borrow a suffix match from
a different agent's live session, rewriting a genuine terminal failure as
running. Preserve the sweep's session-ownership rules: the event's exact
session key is authoritative, and an agentless subagent:workboard-* link
uses a suffix match only when the complete snapshot shows exactly one
session with that suffix. Drop the success-path reader assertion flagged
as low-value coverage.
@skyzhao1223
skyzhao1223 force-pushed the fix/workboard-attempt-level-agent-end-blocked-167574 branch from 23b1057 to 3fd17d7 Compare October 9, 2026 09:52
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Oct 9, 2026
@skyzhao1223

Copy link
Copy Markdown
Contributor Author

Updated per the ClawSweeper review — @clawsweeper re-review when ready.

  • Ownership matching (P2 finding): the liveness veto now prefers the event's exact session key and lets an agentless subagent:workboard-* link borrow a suffix match only when the complete snapshot shows exactly one session with that suffix, preserving the fix(workboard): stop lifecycle sync errors with multiple agents #125429 ownership rules. Both requested regressions were verified red on the previous revision (51684099) and green after the fix.
  • Low-value test removed as flagged (does not read lifecycle sessions for a successful agent_end).
  • Real behavior proof added: isolated-Gateway workboard dispatch --admin run against a build of this PR's head, with a mock openai-completions primary that rejects every completion (HTTP 400) and a healthy fallback — the card completes through candidate_failed → candidate_succeeded with no blocked transition, no failed notification, and no failureCount increment (logs and final card state in the PR body). The Codex-harness producer itself could not be driven live (no subscription); the embedded runtime absorbs candidate errors before attempt finalization, so the discriminating red/green remains at the event boundary — details and the honest gap statement are in the Evidence section.
  • The first revision's checks-fast-baseline-ratchets red was inherited main baseline drift (fixed upstream by cff1f4fc); cleared by the rebase onto 3223e13a.

@obviyus

obviyus commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

I reproduced the reported Codex path and compared both contributor heads through built Gateways, rather than replaying lifecycle hooks. Thanks @skyzhao1223 and @ericcurtin for the fixes, and @asikorskiy for the detailed report.

Setup: isolated Linux ARM64 / Node 24.21.0; real Codex app-server 0.160.0 using its configured native Responses provider against a local synthetic HTTP endpoint. The primary returns HTTP 401; the configured embedded fallback either calls workboard_complete successfully or also returns HTTP 401. Cards are created and dispatched with the shipped workboard create and workboard dispatch --admin CLI. No hook outcomes or session snapshots were injected.

Built source Primary fails, fallback succeeds Both candidates fail
main ec37e1b6e6407745752d93c3dafb13eb33c938e6 ready → running → blocked → done blocked
This PR 3fd17d70739c6522db485b8e668d19bfc1d443fd ready → running → done; no blocked event review, while execution/attempt is blocked
#167746 ab7a769a9d92d73328cf4592929fa37cb7c5348a ready → running → done; no blocked event review, while execution/attempt is blocked

Baseline successful-fallback timeline (UTC): the card moved to blocked at 02:11:09.658, the native attempt's fallback_model decision was logged at 02:11:09.898, the fallback completed the card at 02:11:14.969, and candidate_succeeded was logged at 02:11:17.614. The same card/session/run continued throughout. Both PRs eliminate that intermediate block; their completed cards have no failureCount and only a completed notification.

However, the genuine-failure control is not preserved. On this head the failed card moved running → review at 02:32:01.788; its execution subsequently became blocked with failureCount 1, but the card remained review through several lifecycle-sweep intervals. #167746 behaves the same way. Both candidates' failed HTTP requests and fallback exhaustion are present in the Gateway trace.

The remaining path is the successful agent_end interpretation: the embedded candidate can finish its attempt with success: true before the outer fallback runner settles the assistant error. Both proposals still treat that attempt hook as authoritative success and move the card into review. The store then correctly preserves review against automatic lifecycle status changes; weakening that manual-state protection would be the wrong repair.

For comparison, I built a local version on the same main SHA that derives both terminal outcomes from the existing matching session state and defers while that run is active. The identical two scenarios then produced running → done without an intermediate block, and running → blocked after genuine failure (failureCount 1). This comparison is not a published third PR.

Focused checks on the exact contributor heads passed:

Neither current head meets the genuine-terminal-failure acceptance case, so I have not pushed or selected a landing candidate.

@clawsweeper re-review the exact current head 3fd17d70739c6522db485b8e668d19bfc1d443fd, including the exhausted-run regression above.

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 10, 2026
@skyzhao1223

Copy link
Copy Markdown
Contributor Author

Added the missing real-behavior proof — @clawsweeper re-review when ready.

The last remaining item asked for a Gateway dispatch through the affected Codex primary-to-fallback path. That run is now in the PR body, as a discriminating RED/GREEN pair with the workboard code as the only variable:

  • The producer is reproduced with the real codex-cli 0.162.1 app-server pointed at a local mock via OPENCLAW_CODEX_APP_SERVER_ARGS (the repo's own qa-lab Codex-mock recipe), rejecting every /v1/responses call with HTTP 403 — the issue's exact trigger shape (reason=auth).
  • RED (dist rebuilt from origin/main): card ad79e589 moves running → blocked 87 ms before the gateway's fallback_model failover decision, then candidate_succeeded on the fallback — but the card stays blocked, since blocked → review is not an allowed transition. Same ordering as the reporter's timeline.
  • GREEN (dist rebuilt from this PR's head): card 3827b7d9 runs the same 4× 403 → fallback-success flow and finishes running → review with no blocked transition, failureCount: undefined, notifications: [].
  • Also included: an embedded-path acceptance run (400-rejecting primary, healthy fallback → clean completion, no false signals), and a genuinely-terminal run (codex transport dead at launch) that still correctly blocks the card — the veto does not over-suppress real failures.

Annotated transcripts (mock request log, gateway decision log, card events, environment) are in the Evidence section's details block. No code changes since the previous revision (3fd17d70).

@obviyus

obviyus commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

Thanks @skyzhao1223. The fork rejected maintainer pushes over both SSH and HTTPS despite allowing edits, so the repair continues in #168215. Your commits and authorship are preserved unchanged, with credit in the PR body; my follow-up adds the overall-run guard proven by the native Gateway tests. This PR will be closed as superseded only after #168215 lands.

…e run is live

Review found an exhausted-fallback regression in the failure-only veto: a
candidate-level success hook can fire before the runner settles the
overall error, reviewing the card so the later terminal failure cannot
block it, and failed work stays in review across sweeps. Consult the
authoritative session snapshot for both attempt-level terminal
directions: while the linked run is active the card stays running and
its run-level owners (subagent_ended, lifecycle sweep) write the settled
outcome. Settled runs keep immediate writes. Adds the ordered exhaustion
regression and a settled-success immediacy case.
@skyzhao1223

Copy link
Copy Markdown
Contributor Author

Fixed the P1 finding and re-proved both directions at runtime — @clawsweeper re-review when ready. New head 1d39c9d8.

  • Both attempt-level terminals now defer while the run is live (extensions/workboard/src/lifecycle-sync.ts): the liveness veto covers succeeded observations too, so a candidate-level success hook can no longer review a card whose runner is about to settle an overall error. Run-level owners (subagent_ended, sweep) write the settled outcome; settled snapshots keep immediate writes; missing/failed reads keep the event's own outcome.
  • Ordered exhaustion regression added (red on 3fd17d70, green after): failed attempt (live) → running; success attempt (live) → running; subagent_ended(error) → blocked + failureCount: 1. Plus a settled-success immediacy case.
  • Runtime control on the new head, same Codex-mock rig as before: double-401 exhaustion (card 0895f7ae) settles running → blocked, failureCount: 1 — matching the baseline terminal behavior review asked to preserve; single-failure fallback (card d64e49de) settles running → review after candidate_succeeded, no blocked, no failureCount, no notifications. Transcripts in the PR body.
  • Gates on the new head: 36/36 focused (33.8 s wall), 406/406 full workboard suite, pnpm check:changed, pnpm build, git diff --check all pass.

Manual-state protection is untouched: the deferral only downgrades the attempt-level observation before syncLifecycle; the store's transition and ordering guards are unchanged.

@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. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Oct 10, 2026
Review found two defects in the attempt-level deferral: unrelated
successful agent_end hooks with no matching card still acquired a
configured-agent sessions.list discovery read, and a deferred completion
nudged attached automation immediately even though the card settles
later - for non-subagent sessions nothing re-nudged after the sweep
settled it. Gate the liveness read on a nonempty matching-card set,
withhold the nudge for deferred completions, and report sweep-settled
completions through the service's new onSettled handler into the same
debounced automation owner. Extract the deferral regressions into a
sibling test module to respect the file line cap.
@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 10, 2026
obviyus added a commit that referenced this pull request Oct 10, 2026
…ettles (#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]>
@obviyus

obviyus commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

Superseded by #168215 (9f7cb66), which landed the fix for #167574 with your work credited. Thank you!

@obviyus obviyus closed this Oct 10, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 11, 2026
…ettles (openclaw#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 openclaw#167745 by @skyzhao1223 (fork rejected maintainer pushes); related openclaw#167746 by @ericcurtin. Fixes openclaw#167574.

Co-authored-by: skyzhao1223 <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
RomneyDa pushed a commit that referenced this pull request Oct 12, 2026
…ettles (#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 9f7cb66)
tomorrowflow added a commit to tomorrowflow/openclaw that referenced this pull request Oct 13, 2026
* test(doctor): expect migrated Claude CLI wildcard routing

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

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

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

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

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

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

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

* style(vllm): use boolean reasoning guards

---------

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

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

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

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

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

* fix: send thinking controls to custom reasoning models

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

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

* docs: clarify custom model effort admission and clamping

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

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

* docs(changelog): carry interim 2026.10.5 notes

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

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

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

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

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

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

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

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

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

---------

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

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

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

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

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

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

(cherry picked from commit bc8f693df3aee184c65626f7e9c9c58889c51a8b)

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

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

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

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

(cherry picked from commit 5033097b75dd6a8582a07a6b22969a75d750d8f7)

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

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

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

(cherry picked from commit fc7c5047e59a7d7d4ae37b0f8991786d2def1b76)

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

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

(cherry picked from commit dfdda05fe3c5d2e71c916f8662996f6ccec8d1e1)

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

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

(cherry picked from commit 9250ad1213ef21cfb569bbe1598c2663324cf9c2)

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

(cherry picked from commit 5c7d73950d93896b51b99cbf6cc0ce8149f1577a)

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

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

(cherry picked from commit c44c2e51ad3fdeaa84a0aa35a36c4f83a116c746, pnpm hunks only)

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

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

This reverts commit 5a680062cdb3554b52e3eee5499e24bf8c0a3850.

(cherry picked from commit 4578c1dde1cb8b7217709845d091176e1d2cccc5)

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

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

(cherry picked from commit efa552b9cef854d4f0b74eb8119ae9035f4fb79b)

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

(cherry picked from commit 0a55cbe057e0e0f4d7a2013e01e925b0fcfbca93)

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

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

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

(cherry picked from commit 9fc63cc93f65fd27bf390cc9a77ffb5f0bc57cf9)

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

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

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

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

(cherry picked from commit 5c6b01a42fa76b4555f475278c554dbc6984e82d)

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

(cherry picked from commit 21490fb9dc601f5eb9b398ee1b2bbfc6768aacfb)

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

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

(cherry picked from commit d719f09ad46f2bbe07a97aa9c50845e672fefc40)

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

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

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

(cherry picked from commit 281379b0111a2c7c18afff10d00845614f7325cf)

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

(cherry picked from commit b43da95af1513b59c19df2c3390c78fc9909e29e)

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

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

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

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

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

(cherry picked from commit 587a19170f3c333ad94507212e1ea18ec7c52d18)

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

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

(cherry picked from commit fdb06ff5ca8cb1fad79f16e0b976996503345116)

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

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

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

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

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

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

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

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

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

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

(cherry picked from commit 171df4e1c5a08e1da631c4fff50c420db2bb6f84)

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

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

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

* test(gateway): drop default deferred type argument

(cherry picked from commit 4e3707f634c9f2176ed2d18034c8389484e4ae25)

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

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

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

(cherry picked from commit 8076cd878f22bf41cf104feaf7fa8be037bc7029)

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

(cherry picked from commit 53d2109ebfce9e2612115315d8b814cbcef6266d)

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

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

(cherry picked from commit c6d71fae0ed1c0f7968c8d05c410345246af235b)

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

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

(cherry picked from commit 217d8bfb7cfa06a5a6c7d3381f92cbae7b269eac)

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

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

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

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

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

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

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

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

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

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

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

(cherry picked from commit 951dffef48a9f5458984d87890c42cf8ae203ab7)

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

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

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

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

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

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

(cherry picked from commit a216ad8eea6a15fee9341f7bdf2f51e9012ec441)

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

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

(cherry picked from commit 34e71463b60e42ab073f576502e3daf996009dfa)

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

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

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

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

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

(cherry picked from commit 504885e7b765c7f99182e152cbe95d8e922cc958)

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

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

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

(cherry picked from commit 68127439e6c989a585f35c0e3ac8d767d758bd09)

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

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

(cherry picked from commit 032a58bf34d643d59482656bfe0005c27d5c1e17)

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

(cherry picked from commit db8dbef60ed6c03b4fb9e0bee1f820a1815b988b)

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

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

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

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

(cherry picked from commit c44c2e51ad3fdeaa84a0aa35a36c4f83a116c746)

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

Worked on by:
- @obviyus

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

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

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

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

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

* fix(update): clarify completed receipt recovery checks

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

(cherry picked from commit eae2e5421daa5b0647126830917df8772ab35f70)

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

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

Related: #168456
Related: #168509

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

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

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

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

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

Closes #157814.

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

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

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

(cherry picked from commit 9a62c5b5cd2eb98a47e7091dfa1484cfe8dd7809)

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

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

(cherry picked from commit c96fac1cc6a48f7249ac21575a73e025bfcc3e51)

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

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

(cherry picked from commit 054004acbc73fc814882cd696afc851eb4c251dc)

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

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

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

Fixes #154180.

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

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

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

(cherry picked from commit 3e832726ad2a19e1a19d07651e7817a6dd8aa2b9)

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

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

(cherry picked from commit ff6f58a8c32b6daa4bf1cf5f60b3493ae96d1764)

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

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

(cherry picked from commit d29e2d5be0f618c13417d74fa48216384ea3bb74)

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

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

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

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

(cherry picked from commit cb1b6cdb9c74cd17b92b141a55c3f4e448ca5aba)

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

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

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

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

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

## What Problem This Solves

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

## User Impact

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

## Why This Change Was Made

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

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

## Evidence

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

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

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

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

### Generation-authority proof

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

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

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

### Simplification size

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

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

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

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

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

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

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

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

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

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

(cherry picked from commit 0b0c2f216658ba62557fe4dbd444a6ebeb4b0f7c)

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

* fix: recover catalog config after failed native ESM refresh

* fix: provide catalog regression response timeout

(cherry picked from commit d0df645f66013c79290904ac9c4e69f9749b94fd)

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

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

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

(cherry picked from commit a81bb54f094f0bb5df760b4fe7e100c791c757d1)

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

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

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

Extracted from #169295.

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

(cherry picked from commit 7187a9afa71af15eb5f7889f6af47faed021097a)

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

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

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

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

Fixes #169134
Supersedes #169137, thanks @Oldrich333

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

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

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

* test(gateway): remove unused pairing publication import

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

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

---------

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

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

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

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

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

Worked on by:
- @steipete

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

---------

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

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

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

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

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

(cherry picked from commit 2d991c67599c2adc4dc5deaee940d27e3c15cf07)

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

* fix(doctor): preserve blocked local plugin configuration

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

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

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

Worked on by:
- @obviyus

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

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

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

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

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

Worked on by:
- @obviyus

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

---------

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

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

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

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

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

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

(cherry picked from commit 77bbc865a05bb38e4284e651ddf229d8ac10a53c)

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

## What Problem This Solves

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

## User Impact

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

## Why This Change Was Made

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

## Evidence

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

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

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

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

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

Worked on by:
- @steipete

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

* fix: preserve internal media task delivery routes

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

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

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

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

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

---------

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

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

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

(cherry picked from commit addfa4853e2f61dd1398d8e0dbe6f5776a6e5ae6)

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

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

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

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

* fix(recovery): preserve terminal completion claims

* fix(recovery): keep deferred turns pending

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

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

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

* test(reply): await collected drain settlement

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

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

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

---------

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

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

## What Problem This Solves

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

## User Impact

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

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

## Why This Change Was Made

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

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

## Evidence

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

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

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

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

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

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

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

Closes #151055

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

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

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

* chore: retrigger CI against an updated merge base

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

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

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

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

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

* chore: prune stale max-lines allowance

* test(memory): identify bundled reload fixture ownership

---------

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

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

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

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

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

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

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

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

(cherry picked from commit 757d73980426df41869314a063b17fc847b36511)

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

* fix: prevent session admission stack overflows in large fleets

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

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

* fix: include acquisition helper in maintainer wrapper

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

(cherry picked from commit 38fee354e63626edea4ce6f620461acc15d571f4)

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

## What Problem This Solves

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

## User Impact

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

## Why This Change Was Made

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

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

No config, schema, or protocol changes.

## Evidence

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

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

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

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

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

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

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

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

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

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

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

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

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

Worked on by:
- @steipete

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

* test: isolate memory maintenance fixture contracts

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

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

* test: align CI fixtures with current lifecycle contracts

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

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

* fix: preserve dispatched user projections across model fallback

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

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

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

Worked on by:
- @steipete

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

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

Worked on by:
- @steipete

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

---------

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

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

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

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

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

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

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

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

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

* style(vllm): use boolean reasoning guards

---------

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

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

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

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

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

* fix: send thinking controls to custom reasoning models

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

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

* docs: clarify custom model effort admission and clamping

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

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

* docs(changelog): carry interim 2026.10.5 notes

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

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

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

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

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

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

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

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

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

---------

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

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

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

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

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

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

(cherry picked from commit bc8f693df3aee184c65626f7e9c9c58889c51a8b)

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

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

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

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

(cherry picked from commit 5033097b75dd6a8582a07a6b22969a75d750d8f7)

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

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

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

(cherry picked from commit fc7c5047e59a7d7d4ae37b0f8991786d2def1b76)

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

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

(cherry picked from commit dfdda05fe3c5d2e71c916f8662996f6ccec8d1e1)

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

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

(cherry picked from commit 9250ad1213ef21cfb569bbe1598c2663324cf9c2)

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

(cherry picked from commit 5c7d73950d93896b51b99cbf6cc0ce8149f1577a)

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

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

(cherry picked from commit c44c2e51ad3fdeaa84a0aa35a36c4f83a116c746, pnpm hunks only)

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

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

This reverts commit 5a680062cdb3554b52e3eee5499e24bf8c0a3850.

(cherry picked from commit 4578c1dde1cb8b7217709845d091176e1d2cccc5)

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

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

(cherry picked from commit efa552b9cef854d4f0b74eb8119ae9035f4fb79b)

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

(cherry picked from commit 0a55cbe057e0e0f4d7a2013e01e925b0fcfbca93)

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

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

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

(cherry picked from commit 9fc63cc93f65fd27bf390cc9a77ffb5f0bc57cf9)

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

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

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

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

(cherry picked from commit 5c6b01a42fa76b4555f475278c554dbc6984e82d)

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

(cherry picked from commit 21490fb9dc601f5eb9b398ee1b2bbfc6768aacfb)

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

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

(cherry picked from commit d719f09ad46f2bbe07a97aa9c50845e672fefc40)

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

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

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

(cherry picked from commit 281379b0111a2c7c18afff10d00845614f7325cf)

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

(cherry picked from commit b43da95af1513b59c19df2c3390c78fc9909e29e)

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

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

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

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

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

(cherry picked from commit 587a19170f3c333ad94507212e1ea18ec7c52d18)

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

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

(cherry picked from commit fdb06ff5ca8cb1fad79f16e0b976996503345116)

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

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

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

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

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

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

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

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

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

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

(cherry picked from commit 171df4e1c5a08e1da631c4fff50c420db2bb6f84)

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

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

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

* test(gateway): drop default deferred type argument

(cherry picked from commit 4e3707f634c9f2176ed2d18034c8389484e4ae25)

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

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

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

(cherry picked from commit 8076cd878f22bf41cf104feaf7fa8be037bc7029)

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

(cherry picked from commit 53d2109ebfce9e2612115315d8b814cbcef6266d)

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

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

(cherry picked from commit c6d71fae0ed1c0f7968c8d05c410345246af235b)

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

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

(cherry picked from commit 217d8bfb7cfa06a5a6c7d3381f92cbae7b269eac)

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

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

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

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

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

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

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

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

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

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

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

(cherry picked from commit 951dffef48a9f5458984d87890c42cf8ae203ab7)

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

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

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

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

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

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

(cherry picked from commit a216ad8eea6a15fee9341f7bdf2f51e9012ec441)

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

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

(cherry picked from commit 34e71463b60e42ab073f576502e3daf996009dfa)

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

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

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

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

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

(cherry picked from commit 504885e7b765c7f99182e152cbe95d8e922cc958)

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

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

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

(cherry picked from commit 68127439e6c989a585f35c0e3ac8d767d758bd09)

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

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

(cherry picked from commit 032a58bf34d643d59482656bfe0005c27d5c1e17)

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

(cherry picked from commit db8dbef60ed6c03b4fb9e0bee1f820a1815b988b)

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

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

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

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

(cherry picked from commit c44c2e51ad3fdeaa84a0aa35a36c4f83a116c746)

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

Worked on by:
- @obviyus

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

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

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

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

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

* fix(update): clarify completed receipt recovery checks

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

(cherry picked from commit eae2e5421daa5b0647126830917df8772ab35f70)

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

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

Related: #168456
Related: #168509

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

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

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

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

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

Closes #157814.

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

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

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

(cherry picked from commit 9a62c5b5cd2eb98a47e7091dfa1484cfe8dd7809)

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

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

(cherry picked from commit c96fac1cc6a48f7249ac21575a73e025bfcc3e51)

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

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

(cherry picked from commit 054004acbc73fc814882cd696afc851eb4c251dc)

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

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

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

Fixes #154180.

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

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

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

(cherry picked from commit 3e832726ad2a19e1a19d07651e7817a6dd8aa2b9)

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

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

(cherry picked from commit ff6f58a8c32b6daa4bf1cf5f60b3493ae96d1764)

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

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

(cherry picked from commit d29e2d5be0f618c13417d74fa48216384ea3bb74)

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

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

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

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

(cherry picked from commit cb1b6cdb9c74cd17b92b141a55c3f4e448ca5aba)

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

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

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

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

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

## What Problem This Solves

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

## User Impact

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

## Why This Change Was Made

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

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

## Evidence

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

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

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

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

### Generation-authority proof

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

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

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

### Simplification size

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

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

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

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

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

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

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

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

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

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

(cherry picked from commit 0b0c2f216658ba62557fe4dbd444a6ebeb4b0f7c)

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

* fix: recover catalog config after failed native ESM refresh

* fix: provide catalog regression response timeout

(cherry picked from commit d0df645f66013c79290904ac9c4e69f9749b94fd)

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

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

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

(cherry picked from commit a81bb54f094f0bb5df760b4fe7e100c791c757d1)

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

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

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

Extracted from #169295.

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

(cherry picked from commit 7187a9afa71af15eb5f7889f6af47faed021097a)

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

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

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

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

Fixes #169134
Supersedes #169137, thanks @Oldrich333

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

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

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

* test(gateway): remove unused pairing publication import

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

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

---------

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

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

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

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

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

Worked on by:
- @steipete

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

---------

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

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

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

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

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

(cherry picked from commit 2d991c67599c2adc4dc5deaee940d27e3c15cf07)

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

* fix(doctor): preserve blocked local plugin configuration

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

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

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

Worked on by:
- @obviyus

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

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

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

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

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

Worked on by:
- @obviyus

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

---------

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

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

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

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

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

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

(cherry picked from commit 77bbc865a05bb38e4284e651ddf229d8ac10a53c)

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

## What Problem This Solves

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

## User Impact

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

## Why This Change Was Made

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

## Evidence

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

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

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

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

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

Worked on by:
- @steipete

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

* fix: preserve internal media task delivery routes

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

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

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

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

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

---------

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

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

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

(cherry picked from commit addfa4853e2f61dd1398d8e0dbe6f5776a6e5ae6)

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

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

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

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

* fix(recovery): preserve terminal completion claims

* fix(recovery): keep deferred turns pending

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

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

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

* test(reply): await collected drain settlement

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

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

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

---------

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

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

## What Problem This Solves

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

## User Impact

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

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

## Why This Change Was Made

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

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

## Evidence

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

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

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

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

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

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

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

Closes #151055

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

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

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

* chore: retrigger CI against an updated merge base

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

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

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

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

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

* chore: prune stale max-lines allowance

* test(memory): identify bundled reload fixture ownership

---------

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

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

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

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

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

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

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

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

(cherry picked from commit 757d73980426df41869314a063b17fc847b36511)

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

* fix: prevent session admission stack overflows in large fleets

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

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

* fix: include acquisition helper in maintainer wrapper

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

(cherry picked from commit 38fee354e63626edea4ce6f620461acc15d571f4)

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

## What Problem This Solves

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

## User Impact

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

## Why This Change Was Made

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

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

No config, schema, or protocol changes.

## Evidence

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

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

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

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

Labels

P1 High-priority user-facing bug, regression, or broken workflow. plugin: workboard rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: L 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.

Workboard: card is moved to blocked when the first model candidate fails, although the same run continues and completes on the fallback model

2 participants