Skip to content

fix(agents): keep sessions running when transcript updates fail - #174947

Merged
steipete merged 2 commits into
mainfrom
upd/upd-l1663
Oct 17, 2026
Merged

steipete merged 2 commits into
mainfrom
upd/upd-l1663

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Fixes #173350.

Supersedes #173387, thanks @D41910.

What Problem This Solves

Fixes a saved agent message being followed by an unhandled rejection when its live transcript update cannot be published.

User Impact

The saved append remains successful. Publication failure produces a warning identifying the saved session/message and explaining how to refresh the transcript. Message content and raw error text stay out of the warning. Failed notifications are not automatically replayed.

Why This Change Was Made

Both append adapters share the same post-commit guard. Handle rejection there, preserving the committed owner, append receipt, and publication authority checks. Making the append fail after commit would misrepresent the saved result; changing global rejection policy would hide unrelated failures.

Production: +12 / −14 (net −2). The small warning handler is offset by simplifying two transformer wrappers and removing a redundant comparison of a value with the property it was just assigned from. Tests: +53. Documentation: +2. No new configuration, dependencies, or schema changes.

Evidence

  • On unchanged main 58fb58883a67b3cdc74a62ad3d164619ec434531, both new synchronous/asynchronous regression cases fail because the rejected publication reaches unhandledRejection: 2 failed, 18 skipped. Test time was approximately 1.36s; total wrapper time 123.63s, including 86.26s of worker preparation.
  • The repaired transcript-events file passes 20/20 cases in 13.7s of reported test time; the new sync/async cases take 594ms / 749ms. The regression uses real SQLite appends and reloads, replacing only the post-commit publisher with a plain rejecting closure. It checks the absence of unhandled rejection, a recovery warning without private content/error text, retained saved messages, and a subsequent successful append.
  • A fresh Node process exercised the actual guard, incognito storage owner, publisher, and global rejection handler without mocking the publisher. A post-commit callback revoked the caller's authority. Main returned an append receipt and emitted [openclaw] Unhandled promise rejection; the repaired process logged the warning, reopened the saved message under renewed authority, completed another append, and exited 0 with LIVE_PROOF_PASS. This is real owner-boundary execution; it does not claim a full Gateway daemon or model-provider round trip.
  • Core and agent/session test typechecks, targeted oxlint, oxfmt, git diff --check, and madge passed (0 import cycles). Independent Codex autoreview: scoped-clean, no actionable P0–P2 findings.
  • The final check:changed --dry-run source scanner exited with SIGILL. Per the campaign's local gate budget, the full changed check/slow SQLite inventory was not run; the targeted gates above supply local proof and PR CI remains the broad gate.

All 48 importer files passed: 678 tests passed, 3 existing skips, across 8 Vitest shards in 1342.10s total wrapper time. The exact files came from the rg command below and all 48 appeared in the completed run. CI seconds are pending.

Pre-existing timing follow-up: src/cron/isolated-agent/run.terminal-error-identity.test.ts / retains distinct provider failures from sequential invocations took 34.942s. Its first real cron invocation lazy-loads the executor inside the case (run.ts:262), creates a real SQLite transcript, and executes two sequential invocations; the following warm case took 2.404s. This points to cold source/runtime preparation rather than an explicit sleep, but the exact split was not profiled. The unchanged file passed both tests in 105.90s wall time (57% transform, 36% tests). No timeout, retry, assertion, or skip was changed.

Local proof commands and fresh-process output

All runtime commands used HOME="$PWD/.artifacts/l1663/home" and OPENCLAW_STATE_DIR="$PWD/.artifacts/l1663/state"; no operator Gateway or state was accessed.

node scripts/run-vitest.mjs src/agents/session-tool-result-guard.transcript-events.test.ts --maxWorkers=1 -t 'preserves saved messages and records publication failure'
rg -l 'session-tool-result-guard' --glob '*.test.ts' src extensions packages test > .artifacts/l1663/sibling-tests.txt
OPENCLAW_NODE_TEST_PLAN_CONTINUE_ON_FAILURE=1 node scripts/run-vitest.mjs $(cat .artifacts/l1663/sibling-tests.txt) --maxWorkers=1
node scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/l1663/core.tsbuildinfo
node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.agents-sessions.json --incremental
node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/agents/session-tool-result-guard.ts src/agents/session-tool-result-guard.transcript-events.test.ts
node --import ./scripts/tsx.mjs scripts/check-madge-import-cycles.ts
node_modules/.bin/oxfmt --check src/agents/session-tool-result-guard.ts src/agents/session-tool-result-guard.transcript-events.test.ts docs/concepts/messages.md
node --import ./scripts/tsx.mjs .artifacts/l1663/live.ts

The local fresh-process probe creates an incognito session through acquireSessionActorStorage, installs installSessionToolResultGuard, and revokes its selected authority in onMessagePersisted. Its real assertCurrent then throws during publication. It restores authority only to read back the committed message and demonstrate continued operation.

APPEND_RECEIPT 165edd51-fbf2-40b0-8d42-2fca723d3849 notification count 0
WARNING Transcript update publication failed after append; reload the session to refresh its transcript.
RECOVERED_SAVED_MESSAGE 165edd51-fbf2-40b0-8d42-2fca723d3849
CONTINUED_APPEND 217ab5db-0a20-4452-9f7b-2c029048f87b
LIVE_PROOF_PASS

@clawsweeper

clawsweeper Bot commented Oct 17, 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.

@steipete
steipete marked this pull request as ready for review October 17, 2026 01:44
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T02:02:39.506951Z a7270c5 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: S labels Oct 17, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 17, 2026
steipete and others added 2 commits October 16, 2026 18:56
Keep committed append receipts successful when live transcript publication
rejects. Record a content-free warning with the session and message IDs
and recovery guidance for both append adapters.

Fixes #173350. Supersedes #173387.

Co-authored-by: D41910 <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added the cli CLI command changes label Oct 17, 2026
@steipete
steipete merged commit 4513e9e into main Oct 17, 2026
126 checks passed
@steipete
steipete deleted the upd/upd-l1663 branch October 17, 2026 02:27
obviyus added a commit that referenced this pull request Oct 17, 2026
## What Problem This Solves

Fixes: every Claude CLI turn fails when Claude Code advertises its default native `AskUserQuestion` tool.

Related: #174740.

## User Impact

Claude CLI conversations can complete normally without disabling native questions. No configuration changes or migrations are required. Published OpenClaw 2026.10.4 is unaffected by this regression: its default-native flow passes with Claude Code 2.1.300.

## Why This Change Was Made

`extensions/anthropic/cli-backend.ts` intentionally projects `AskUserQuestion` to `ask_user` so the native question follows OpenClaw's mediated question policy. That mapping was introduced in #174740. `ask_user` is already a canonical core tool, but `src/agents/tools/cron-tool-creator-cap.ts:35-44` omitted it from the closed native capability vocabulary. Capturing the native tool surface consequently threw before the model could reply, even when no automation was requested.

Accept `ask_user` at the existing core capture owner. Keep the Anthropic projection, exact-name validation, and rejection of raw `AskUserQuestion` unchanged. The existing scheduled-runtime question restrictions remain in force. Codex's native question bridge does not project its raw `request_user_input` name into this capability list and needs no change.

The production fix adds one vocabulary entry; the owner regression adds a native question capture case and keeps raw harness names rejected. Documentation identifies the canonical capability. No new abstraction, state, schema, protocol, dependency, or configuration key.

## Evidence

Real Claude Code **2.1.300**, isolated Gateway state, loopback-only synthetic Messages endpoint, no real provider credentials. The same retained chat.send → agent.wait harness, native tool settings, turn sequence, and per-turn health checks are used before and after; only checkout identity and evidence labels change.

| Cell | Before: `25933024a1e197fa1a503e84b573a47203fc674f` | After: `60740eb61b81eb529cee4d2c170dadec4f1990bc` |
| --- | --- | --- |
| Default native tools, including AskUserQuestion | 5/5 turns fail with non-canonical `ask_user` | Two independent runs, each 9/9 status=ok with visible `TRI138010_OK`; initial and per-turn health pass |
| Deny only AskUserQuestion relative to native cell | 9/9 pass | 9/9 status=ok with visible `TRI138010_OK`; initial and per-turn health pass |

Early candidate launches failed initial health before any model turn during shared-host saturation. After the host quieted, a readiness-only probe and both remaining acceptance cells passed. No timeout or assertion was changed.

Current PR head `95bb0f90d37f02f4c604957778e49394b65c14b6` includes only the fix above plus merges from main through `4513e9e09633a740f58b4ccf8802597968868c47`. The cron capture implementation, its regression test, the Anthropic native projection, and this documentation change are unchanged from the E2E-proven commit (empty targeted diff).

Published **2026.10.4** (`OpenClaw 2026.10.4 (383c124)` from npm): 9/9 default-native turns pass, with `AskUserQuestion` confirmed in native initialization and health after each turn. This is a post-release main regression, not a 2026.10.4 backport.

- Owner regression fails before with the reported `ask_user` error; all **18 tests pass** after. Vitest duration 1.79s; wrapper 4.92s.
- Changed-file oxfmt, TypeScript oxlint, and diff whitespace checks pass.
- Candidate production build passes; declaration generation was skipped for runtime proof.
- [Current-head CI](https://github.com/openclaw/openclaw/actions/runs/38995082420) is green. [ClawSweeper](#174951 (comment)) reports `ready` on `95bb0f90d37f02f4c604957778e49394b65c14b6`, with no findings. Earlier CI hit an inherited main `mock-exports` failure; main repair #174947 is included.

## Merge Danger

Two-way door: reverting restores the previous vocabulary check without a migration. Blast radius is native capability capture for CLI-backed turns; an incorrect entry could affect captured automation tool restrictions. Raw native tool names remain rejected and this change does not make question tools available to scheduled sessions that otherwise disallow them.

Co-authored-by: Ayaan Zaidi <[email protected]>
obviyus added a commit that referenced this pull request Oct 17, 2026
…9353)

Related: #158070, #171668

## What Problem This Solves

Fixes automatic post-turn compaction failing after a target session replies to `sessions_send` with `timeoutSeconds: 0` and the source turn has already completed.

## User Impact

Delegated target sessions compact after delivery instead of retaining an overfull context. No configuration, stored-row schema, or protocol changes are introduced.

## Why This Change Was Made

Extends @ethanhawkes-gif's fix at the existing session-maintenance owner rather than retaining a separate scheduling wrapper. The owner drops the launching turn's Gateway caller and operator-tool scopes, using the same isolation primitives as #171668. Both direct-chat and delegated maintenance then use the target's existing maintenance ownership, lifecycle checks, writer admission, session revision checks, cancellation, and pre-effect authorization. No source grants are copied or new ambient grants created.

The original 597-line integration fixture is replaced with focused tests in the existing owner/admission suites. Its old negative fixture supplied an empty Gateway context, which made every case fail the Gateway fence irrespective of the intended invalidation; the replacement includes a functioning Gateway resolver and a matched successful control. The complete delta against merged main is production +9/-2 and tests +151/-3 across three files.

## Evidence

Frozen main: `25933024a1e197fa1a503e84b573a47203fc674f`.
Current head: `4fd16c989c99be3d10aefaf81965df8a6cc89482`. Runtime proof and focused tests: `459b3ce72bc2b2c8f4939efe39c260af13164916`. The initial merge used main `51ea9e50ecb`; the later CI-repair merge includes main `4513e9e09633a740f58b4ccf8802597968868c47`. Targeted diffs show the maintenance owner, scheduler, and reply-maintenance adapter are byte-for-byte unchanged from the E2E head. Tests are unchanged from `60c83362dbc`, which only removed an unused excess `sessionId` property from a test's `SessionAccessScope`.

| Cell | Observed on frozen main | Candidate |
| --- | --- | --- |
| Real source chat → `sessions_send(timeoutSeconds: 0)` → target reply, repeat 1 | Both replies delivered; optional maintenance failed with `agent tool caller authority is no longer active`; zero compaction provider calls | Both replies delivered; two compaction provider calls; durable compactionCount 1; tokens 125000 → 62206 |
| Same delegated flow, repeat 2 | Same failure; target retained 125000 tokens and compactionCount 0; health passed | Same successful compaction; durable compactionCount 1; tokens 125000 → 62206; health passed |
| Direct-chat control, two repeats | Both compacted; compactionCount 1, tokens 60050 → 43996, two compaction provider calls each | Both compacted; compactionCount 1, tokens 60050 → 44113; two compaction provider calls each; health passed |
| Manual `sessions.compact` control | Succeeded; tokens 125050 → 6664, compactionCount 1 | Reports `Already compacted`, since automatic maintenance already succeeded |

Observed security cells through a real isolated Gateway, loopback provider, and diagnostic plugin:

| Boundary | Observed result |
| --- | --- |
| Source tool grants | Actual source `cron.list` succeeds. The identical call from target maintenance fails with `trusted agent runtime identity required for this gateway call`; target compaction still succeeds with two provider calls and one durable compaction. |
| Target reset before maintenance | Reset completes before releasing the held target response. Zero maintenance provider calls; zero new compaction entries/windows/count. |
| Target deletion before maintenance | After the endpoint's explicit changed-owner refusal, one fresh deletion request succeeds with `deleted: true`. Target row absent; zero maintenance provider calls or compaction persistence. |
| Foreground preemption | Foreground arrival cancels held maintenance. Before allowing the successor to proceed, SQLite still has compactionCount 0 and no compaction entries/windows; stale summary is never persisted. The foreground reply then completes, and its fresh maintenance may compact normally. |

Lifecycle-generation and Gateway-instance retirement are separately covered before admission and after awaited flush in the focused admission tests. Failed/aborted foreground settlement and actual cancellation cleanup retain their existing owner tests. No invalidation case relies solely on a matching session ID.

Install/build succeeded once. Formatting and focused lint passed. Owner tests: 19 passed, 11.64 s one-file wall time (Vitest 6.62 s). Admission/authority-loss tests: 8 passed, 91.46 s wall time (Vitest 81.50 s, including 48 s cold worker preparation). Existing scheduler test: 1 passed, 63.30 s wall time. Initial copied-install dependency failures were resolved by the install. The identical delegated/direct baseline harnesses changed only the candidate path, evidence destination, and recorded SHA. The negative fixture's first startup attempt matched the wrong readiness log text; the Gateway had become ready, and correcting the event match did not change any timeout or product behavior.

Hosted CI on `459b3ce` found the test-only excess-property error fixed by `60c83362dbc`, plus an inherited `checks-fast-baseline-ratchets` mock-exports error. Main fixed that ratchet in #174947; this head includes that repair through the main merge, without an independent fixture workaround. [Exact-head CI](https://github.com/openclaw/openclaw/actions/runs/38995088011) is green. [ClawSweeper's exact-head review](#159353 (comment)) is `ready`, with no findings or remaining proof blockers. No merge has been performed.

**Merge danger:** two-way door; reverting restores the previous ownership behavior without a migration. The security-boundary blast radius is optional session maintenance across direct and delegated agent turns. An incorrect scope transition could deny valid maintenance or retain source privileges; the allowed/revoked final-effect cells above protect that boundary.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…ad of dropping it (openclaw#174947)

The session tool-result guard's shared append path discarded the post-commit transcript publication promise, so a publication failure became a process-level unhandled rejection and the update was silently dropped. The guard now catches the rejection and records a content-free warning that identifies the saved session and message, while preserving the successful append receipt. Production net -2 LOC. Also repairs the mock-exports ratchet red on main (native update maintenance fixture now spreads the real database-context module; baseline shrunk by one). Supersedes openclaw#173387, thanks @D41910.

Fixes openclaw#173350

Co-authored-by: D41910 <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…4951)

## What Problem This Solves

Fixes: every Claude CLI turn fails when Claude Code advertises its default native `AskUserQuestion` tool.

Related: openclaw#174740.

## User Impact

Claude CLI conversations can complete normally without disabling native questions. No configuration changes or migrations are required. Published OpenClaw 2026.10.4 is unaffected by this regression: its default-native flow passes with Claude Code 2.1.300.

## Why This Change Was Made

`extensions/anthropic/cli-backend.ts` intentionally projects `AskUserQuestion` to `ask_user` so the native question follows OpenClaw's mediated question policy. That mapping was introduced in openclaw#174740. `ask_user` is already a canonical core tool, but `src/agents/tools/cron-tool-creator-cap.ts:35-44` omitted it from the closed native capability vocabulary. Capturing the native tool surface consequently threw before the model could reply, even when no automation was requested.

Accept `ask_user` at the existing core capture owner. Keep the Anthropic projection, exact-name validation, and rejection of raw `AskUserQuestion` unchanged. The existing scheduled-runtime question restrictions remain in force. Codex's native question bridge does not project its raw `request_user_input` name into this capability list and needs no change.

The production fix adds one vocabulary entry; the owner regression adds a native question capture case and keeps raw harness names rejected. Documentation identifies the canonical capability. No new abstraction, state, schema, protocol, dependency, or configuration key.

## Evidence

Real Claude Code **2.1.300**, isolated Gateway state, loopback-only synthetic Messages endpoint, no real provider credentials. The same retained chat.send → agent.wait harness, native tool settings, turn sequence, and per-turn health checks are used before and after; only checkout identity and evidence labels change.

| Cell | Before: `964a9ea2957cdb7a6566daf3d927691ad06a8557` | After: `60740eb61b81eb529cee4d2c170dadec4f1990bc` |
| --- | --- | --- |
| Default native tools, including AskUserQuestion | 5/5 turns fail with non-canonical `ask_user` | Two independent runs, each 9/9 status=ok with visible `TRI138010_OK`; initial and per-turn health pass |
| Deny only AskUserQuestion relative to native cell | 9/9 pass | 9/9 status=ok with visible `TRI138010_OK`; initial and per-turn health pass |

Early candidate launches failed initial health before any model turn during shared-host saturation. After the host quieted, a readiness-only probe and both remaining acceptance cells passed. No timeout or assertion was changed.

Current PR head `95bb0f90d37f02f4c604957778e49394b65c14b6` includes only the fix above plus merges from main through `01edef4f3f37deb66bf4e448ac2ff30f8b644771`. The cron capture implementation, its regression test, the Anthropic native projection, and this documentation change are unchanged from the E2E-proven commit (empty targeted diff).

Published **2026.10.4** (`OpenClaw 2026.10.4 (383c124)` from npm): 9/9 default-native turns pass, with `AskUserQuestion` confirmed in native initialization and health after each turn. This is a post-release main regression, not a 2026.10.4 backport.

- Owner regression fails before with the reported `ask_user` error; all **18 tests pass** after. Vitest duration 1.79s; wrapper 4.92s.
- Changed-file oxfmt, TypeScript oxlint, and diff whitespace checks pass.
- Candidate production build passes; declaration generation was skipped for runtime proof.
- [Current-head CI](https://github.com/openclaw/openclaw/actions/runs/38995082420) is green. [ClawSweeper](openclaw#174951 (comment)) reports `ready` on `95bb0f90d37f02f4c604957778e49394b65c14b6`, with no findings. Earlier CI hit an inherited main `mock-exports` failure; main repair openclaw#174947 is included.

## Merge Danger

Two-way door: reverting restores the previous vocabulary check without a migration. Blast radius is native capability capture for CLI-backed turns; an incorrect entry could affect captured automation tool restrictions. Raw native tool names remain rejected and this change does not make question tools available to scheduled sessions that otherwise disallow them.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…nclaw#159353)

Related: openclaw#158070, openclaw#171668

## What Problem This Solves

Fixes automatic post-turn compaction failing after a target session replies to `sessions_send` with `timeoutSeconds: 0` and the source turn has already completed.

## User Impact

Delegated target sessions compact after delivery instead of retaining an overfull context. No configuration, stored-row schema, or protocol changes are introduced.

## Why This Change Was Made

Extends @ethanhawkes-gif's fix at the existing session-maintenance owner rather than retaining a separate scheduling wrapper. The owner drops the launching turn's Gateway caller and operator-tool scopes, using the same isolation primitives as openclaw#171668. Both direct-chat and delegated maintenance then use the target's existing maintenance ownership, lifecycle checks, writer admission, session revision checks, cancellation, and pre-effect authorization. No source grants are copied or new ambient grants created.

The original 597-line integration fixture is replaced with focused tests in the existing owner/admission suites. Its old negative fixture supplied an empty Gateway context, which made every case fail the Gateway fence irrespective of the intended invalidation; the replacement includes a functioning Gateway resolver and a matched successful control. The complete delta against merged main is production +9/-2 and tests +151/-3 across three files.

## Evidence

Frozen main: `964a9ea2957cdb7a6566daf3d927691ad06a8557`.
Current head: `4fd16c989c99be3d10aefaf81965df8a6cc89482`. Runtime proof and focused tests: `459b3ce72bc2b2c8f4939efe39c260af13164916`. The initial merge used main `8f3292fff6a`; the later CI-repair merge includes main `01edef4f3f37deb66bf4e448ac2ff30f8b644771`. Targeted diffs show the maintenance owner, scheduler, and reply-maintenance adapter are byte-for-byte unchanged from the E2E head. Tests are unchanged from `60c83362dbc`, which only removed an unused excess `sessionId` property from a test's `SessionAccessScope`.

| Cell | Observed on frozen main | Candidate |
| --- | --- | --- |
| Real source chat → `sessions_send(timeoutSeconds: 0)` → target reply, repeat 1 | Both replies delivered; optional maintenance failed with `agent tool caller authority is no longer active`; zero compaction provider calls | Both replies delivered; two compaction provider calls; durable compactionCount 1; tokens 125000 → 62206 |
| Same delegated flow, repeat 2 | Same failure; target retained 125000 tokens and compactionCount 0; health passed | Same successful compaction; durable compactionCount 1; tokens 125000 → 62206; health passed |
| Direct-chat control, two repeats | Both compacted; compactionCount 1, tokens 60050 → 43996, two compaction provider calls each | Both compacted; compactionCount 1, tokens 60050 → 44113; two compaction provider calls each; health passed |
| Manual `sessions.compact` control | Succeeded; tokens 125050 → 6664, compactionCount 1 | Reports `Already compacted`, since automatic maintenance already succeeded |

Observed security cells through a real isolated Gateway, loopback provider, and diagnostic plugin:

| Boundary | Observed result |
| --- | --- |
| Source tool grants | Actual source `cron.list` succeeds. The identical call from target maintenance fails with `trusted agent runtime identity required for this gateway call`; target compaction still succeeds with two provider calls and one durable compaction. |
| Target reset before maintenance | Reset completes before releasing the held target response. Zero maintenance provider calls; zero new compaction entries/windows/count. |
| Target deletion before maintenance | After the endpoint's explicit changed-owner refusal, one fresh deletion request succeeds with `deleted: true`. Target row absent; zero maintenance provider calls or compaction persistence. |
| Foreground preemption | Foreground arrival cancels held maintenance. Before allowing the successor to proceed, SQLite still has compactionCount 0 and no compaction entries/windows; stale summary is never persisted. The foreground reply then completes, and its fresh maintenance may compact normally. |

Lifecycle-generation and Gateway-instance retirement are separately covered before admission and after awaited flush in the focused admission tests. Failed/aborted foreground settlement and actual cancellation cleanup retain their existing owner tests. No invalidation case relies solely on a matching session ID.

Install/build succeeded once. Formatting and focused lint passed. Owner tests: 19 passed, 11.64 s one-file wall time (Vitest 6.62 s). Admission/authority-loss tests: 8 passed, 91.46 s wall time (Vitest 81.50 s, including 48 s cold worker preparation). Existing scheduler test: 1 passed, 63.30 s wall time. Initial copied-install dependency failures were resolved by the install. The identical delegated/direct baseline harnesses changed only the candidate path, evidence destination, and recorded SHA. The negative fixture's first startup attempt matched the wrong readiness log text; the Gateway had become ready, and correcting the event match did not change any timeout or product behavior.

Hosted CI on `459b3ce` found the test-only excess-property error fixed by `60c83362dbc`, plus an inherited `checks-fast-baseline-ratchets` mock-exports error. Main fixed that ratchet in openclaw#174947; this head includes that repair through the main merge, without an independent fixture workaround. [Exact-head CI](https://github.com/openclaw/openclaw/actions/runs/38995088011) is green. [ClawSweeper's exact-head review](openclaw#159353 (comment)) is `ready`, with no findings or remaining proof blockers. No merge has been performed.

**Merge danger:** two-way door; reverting restores the previous ownership behavior without a migration. The security-boundary blast radius is optional session maintenance across direct and delegated agent turns. An incorrect scope transition could deny valid maintenance or retain source privileges; the allowed/revoked final-effect cells above protect that boundary.

Co-authored-by: Ayaan Zaidi <[email protected]>
wheakerd pushed a commit to wheakerd/clawdbot that referenced this pull request Oct 22, 2026
…4951)

## What Problem This Solves

Fixes: every Claude CLI turn fails when Claude Code advertises its default native `AskUserQuestion` tool.

Related: openclaw#174740.

## User Impact

Claude CLI conversations can complete normally without disabling native questions. No configuration changes or migrations are required. Published OpenClaw 2026.10.4 is unaffected by this regression: its default-native flow passes with Claude Code 2.1.300.

## Why This Change Was Made

`extensions/anthropic/cli-backend.ts` intentionally projects `AskUserQuestion` to `ask_user` so the native question follows OpenClaw's mediated question policy. That mapping was introduced in openclaw#174740. `ask_user` is already a canonical core tool, but `src/agents/tools/cron-tool-creator-cap.ts:35-44` omitted it from the closed native capability vocabulary. Capturing the native tool surface consequently threw before the model could reply, even when no automation was requested.

Accept `ask_user` at the existing core capture owner. Keep the Anthropic projection, exact-name validation, and rejection of raw `AskUserQuestion` unchanged. The existing scheduled-runtime question restrictions remain in force. Codex's native question bridge does not project its raw `request_user_input` name into this capability list and needs no change.

The production fix adds one vocabulary entry; the owner regression adds a native question capture case and keeps raw harness names rejected. Documentation identifies the canonical capability. No new abstraction, state, schema, protocol, dependency, or configuration key.

## Evidence

Real Claude Code **2.1.300**, isolated Gateway state, loopback-only synthetic Messages endpoint, no real provider credentials. The same retained chat.send → agent.wait harness, native tool settings, turn sequence, and per-turn health checks are used before and after; only checkout identity and evidence labels change.

| Cell | Before: `25933024a1e197fa1a503e84b573a47203fc674f` | After: `60740eb61b81eb529cee4d2c170dadec4f1990bc` |
| --- | --- | --- |
| Default native tools, including AskUserQuestion | 5/5 turns fail with non-canonical `ask_user` | Two independent runs, each 9/9 status=ok with visible `TRI138010_OK`; initial and per-turn health pass |
| Deny only AskUserQuestion relative to native cell | 9/9 pass | 9/9 status=ok with visible `TRI138010_OK`; initial and per-turn health pass |

Early candidate launches failed initial health before any model turn during shared-host saturation. After the host quieted, a readiness-only probe and both remaining acceptance cells passed. No timeout or assertion was changed.

Current PR head `95bb0f90d37f02f4c604957778e49394b65c14b6` includes only the fix above plus merges from main through `4513e9e09633a740f58b4ccf8802597968868c47`. The cron capture implementation, its regression test, the Anthropic native projection, and this documentation change are unchanged from the E2E-proven commit (empty targeted diff).

Published **2026.10.4** (`OpenClaw 2026.10.4 (383c124)` from npm): 9/9 default-native turns pass, with `AskUserQuestion` confirmed in native initialization and health after each turn. This is a post-release main regression, not a 2026.10.4 backport.

- Owner regression fails before with the reported `ask_user` error; all **18 tests pass** after. Vitest duration 1.79s; wrapper 4.92s.
- Changed-file oxfmt, TypeScript oxlint, and diff whitespace checks pass.
- Candidate production build passes; declaration generation was skipped for runtime proof.
- [Current-head CI](https://github.com/openclaw/openclaw/actions/runs/38995082420) is green. [ClawSweeper](openclaw#174951 (comment)) reports `ready` on `95bb0f90d37f02f4c604957778e49394b65c14b6`, with no findings. Earlier CI hit an inherited main `mock-exports` failure; main repair openclaw#174947 is included.

## Merge Danger

Two-way door: reverting restores the previous vocabulary check without a migration. Blast radius is native capability capture for CLI-backed turns; an incorrect entry could affect captured automation tool restrictions. Raw native tool names remain rejected and this change does not make question tools available to scheduled sessions that otherwise disallow them.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit 27f8c47)
Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. cli CLI command changes docs Improvements or additions to documentation size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Fire-and-forget transcript publication in the session tool-result guard produces process-level unhandled rejections and silently drops updates

1 participant