Skip to content

fix: preserve chat inputs and steering across restarts - #176587

Merged
steipete merged 26 commits into
mainfrom
steipete/team-inputresume
Oct 19, 2026
Merged

steipete merged 26 commits into
mainfrom
steipete/team-inputresume

Conversation

@steipete

@steipete steipete commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes accepted chat inputs and acknowledged agent guidance being lost when the Gateway restarts.

User Impact

Eligible interrupted chat.send inputs resume on the server in acceptance order within each session, including CLI and native clients without a browser outbox. The original submission ID and durable receipt deduplicate retries during and after recovery. sessions_send steering and guidance to an owned child acknowledge only after transcript persistence; a target without durable steering uses the existing queued delivery path.

Automatic recovery requires the original session, current operator authority, and an input accepted within 24 hours. Cancelled inputs and reset, archived, or replaced sessions never resume. Inputs that cannot resume retain the existing interrupted notice with copy/resend guidance. The browser reconciles server custody instead of independently resending accepted inputs and retains its payload until consumption. Fresh chat and browser-local commands wait behind startup recovery.

No new table, configuration option, Doctor migration, retry scheduler, or bundle budget. Behavior and limits are documented in docs/gateway/restart-recovery.md and the outbox documentation.

Why This Change Was Made

The pending-input writer persists before ACK, but startup recovery selected only peer-delivery rows. SIGKILL residue was reconciled only on a history read. session-send-recovery now discovers and reconciles both input kinds using its existing FIFO and bounded attempts. chat-input-recovery is its lazy replay helper: it restores the recorded operator and re-enters ordinary chat admission with the original agent, approved input, request options, and receipt identity. The existing authority owners revalidate session access and operator authority at effect.

Cold-process instrumentation exposed two producer defects. SIGTERM mailbox cleanup supplied a generic cancellation error, terminally cancelling accepted peer inputs; src/sessions/session-controller.mailbox-cleanup.ts:220 now supplies the existing typed restart reason. After SIGKILL, future queued peers eagerly claimed foreground recovery and blocked earlier inputs; src/gateway/agent-turn/agent-session-persist.ts:365 leaves those claims to the selected-command owner.

Review exposed a separate ordering defect: selected peer replay enters direct agent admission and could claim foreground before the interrupted main predecessor. src/gateway/session-send-recovery.ts:160 now asks the existing exact main-turn recovery owner to start or settle that predecessor first. Paused, failed, or deferred recovery retains the peers. Ordinary chat already uses its selected-claim predecessor handoff. Transient exhaustion stops that session's sweep; other sessions continue. No second execution owner or retry loop is introduced.

src/agents/tools/sessions-send-tool.delivery.ts:265 waits for the receiver's transcript commit. Unsupported capability falls back before injection; an indeterminate consumed result never replays. Recovery preserves original-agent selection, trusted external provenance, requester/personal context, participant attribution, and the Control UI reconnect marker.

Accepted limits: the age limit is checked at selection; existing bounded attempts may finish later. Live connection capabilities are not durable authority: recovered ordinary chat has no inline/device UI tools or task-suggestion delivery. Explicit per-run client tool bindings, process-local provider-review acknowledgments, expired inputs, and inputs without saved authority remain interrupted. Incognito remains ephemeral. Provider-review continuations need refreshed findings and acknowledgment. Independent authorized reset remains a cancellation action; browser-local FIFO does not prohibit another client from resetting a session.

Size and ownership: simplification removed duplicate policy/authority wrappers, browser replay state, and the proposed Retry/Discard path. Whole PR against integrated base 9f7a75d39082: production +763/−385 = +378, tests/support +2322/−433 = +1889, docs +80/−27 = +53. The discovery owner grows by 57 net lines. This is smaller than the original +552 production delta, but does not meet the requested well-under-half target. Remaining growth stores admission evidence, explicitly serializes replay options, and restores verified requester context; those contracts cannot safely use a broad request spread. The peer repair adds 23 production lines and reuses the existing main-turn owner.

Evidence

Candidate: 1d913b5e9f9d8c28def12f9cebbbba31a10b1314, integrated with 9f7a75d39082, including #176770's peer-source restoration and #177214's existing X-fixture waiter fix.

Authority at effect: chat-input-recovery.authority.test.ts uses existing operator-run-authority fixtures, a real Gateway, synthetic HTTP provider, and the real write tool. Between capture and startup it narrows a role, revokes a paired device, and removes membership in another owner's session. All three retain interrupted receipts with zero model calls or tool writes. Unchanged authority performs one write-tool round trip, consumes the original receipt, and preserves requester profile, personal USER.md, and participant attribution. The wire probe also proves startup rejects a fresh successor with retryable UNAVAILABLE, then admits it exactly once after recovery.

Predecessor and peer ordering: on 7b987c3, the strengthened real-Gateway fixture reproduced the review defect: the peer ran without the interrupted predecessor. With this repair, both steer and followup must observe predecessor → peer → chat at lifecycle and provider boundaries, consume each pending receipt once, and preserve the revocation controls. A separate owner case proves paused/deferred recovery makes no peer or chat dispatch. The synthetic provider classifies the current user input after stripping runtime context; a quoted historical interrupted-input notice is not an active request.

Final secretless AWS proof, provider aws, lease cbx_a167098374aa: all four changed files SHA256-verified atop pinned 7b987c3, matching committed candidate bytes. 46/46 passed across three files: authority/order modes 22.770 s / 7.225 s, paused-owner case 3.430 s, stable upgrade 1.150 s; Vitest 94.99 s, test wrapper 101.17 s. No instance role, Tailscale, or credential hydration. Core and Gateway test types, targeted typed lint, format, one-page MDX and whitespace checks pass. The unmodified repository pre-commit hook also passed against the committed four-file diff in an isolated index. The lease is released.

Latest-stable upgrade: npm latest was rechecked October 19 as 2026.10.5, tag commit 1b58cb9a1b4f4353e1add63c8506db4d890962e8. session-send-recovery.upgrade.test.ts uses the captured release's row shape and message format, independently of this branch's writer. Queued, interrupted, and cancelled rows have fresh acceptance times. Actual startup discovery converts queued to interrupted before any history read, preserves message bytes and cancellation, and exposes the existing visible outcome with zero replay calls. Stable did not save per-input operator authority, so these chat inputs require manual resend. No Doctor migration is needed or invoked; the table schema is unchanged. This is captured-row upgrade proof, not an installed-package upgrade campaign.

Cold restarts: secretless AWS Crabbox built 82fbfa596fbc after verifying all 57,777 source hashes. Real Gateway processes, sockets, SQLite, transcripts, and signals; synthetic model provider. SIGTERM passed in 75.497 s, SIGKILL in 46.580 s. Both proved five interleaved peer/chat pairs in FIFO order, one provider delivery each, same-ID retries during and after consumption, durable steering, cancellation/reset/archive/revocation exclusions, and another restart without duplicates. Seven focused owner files passed 108/108. Later repairs have their own focused proof and final-head CI; these cold timings are evidence for that earlier head. The lease is released.

Team evidence: the audit recorded 40 stops, 22 KILL exits, and 61 starts; these are lifecycle counts, not lost-input counts. Sanitized journal: L975984 SIGTERM at 2026-10-15T06:57:03.519Z; L976005 reached the 20,000 ms drain timeout with queue=62, pendingReplies=17, embeddedRuns=31, admissions=115; L976201 active drain settled; L976387 admission close took 4,531 ms; L976432 shutdown deadline reached; L976437 exited with status 9/KILL.

UI and attribution: matched same-host comparison: chat 1,489,890 → 1,489,839 bytes (−51) with 25 requests unchanged; New −6 bytes, 20 requests unchanged. Recovery decisions stay behind the existing lazy receipts boundary. All 83 focused UI tests, UI types, lint/format, and i18n passed; later repairs do not change UI source. No cap was raised. The cancellation test passed clean main af1e1fe8 first, then the branch, all nine cases under Bun; the previous failed-versus-settled result did not reproduce and is not claimed inherited or fixed. A prior Bun menu failure was reproduced on clean main f2f019d60638 with the same assertion and unchanged menu source.

Other focused proof: integrated recovery, authority/startup, stable-row upgrade, steering, and announcement cases passed 93/93. Chat-turn tests 23/23, prompt-prefix stability 5/5, prompt snapshot generation without a generated diff, and replay-option round-trip 9/9 passed. Core and affected Agent/Gateway type graphs, typed lint, format, whitespace, changed-page MDX, and line-cap checks passed. Prior CI fixture failures were repaired without raised timeouts, weaker assertions, skips, or new production retry loops.

Focused commands
pnpm test src/gateway/chat-input-recovery.authority.test.ts src/gateway/session-send-recovery.test.ts src/gateway/session-send-recovery.upgrade.test.ts --maxWorkers=1
pnpm test src/gateway/server-methods/chat-send-user-turn.test.ts src/agents/openclaw-tools.sessions-steering.test.ts --maxWorkers=1
pnpm test src/agents/agent-tools.prefix-stability.test.ts --maxWorkers=1
pnpm prompt:snapshots:gen
node scripts/run-tsgo.mjs -p tsconfig.core.json
node scripts/run-tsgo-core-test-shards.mjs --ci-graphs-json '["core-test-agents-root","core-test-agents-tools","core-test-gateway-other","core-test-gateway-methods"]'
node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json <changed-files>
node scripts/run-format.mts --check <changed-files>
node scripts/check-docs-mdx.mjs docs/gateway/restart-recovery.md

No local full suite or CI rerun for green.

Review and CI: full committed-branch Codex autoreview at 1d913b5e9f9d8c28def12f9cebbbba31a10b1314 is scoped-clean through P2, zero findings, with successful final source verification. Exact-head CI run 39259580936 completed successfully: 97/97 jobs complete, zero failures. No CI reruns or additional pushes were needed for this head. The peer-order review thread is resolved; there were no unresolved review threads at final verification. No merge requested or performed.

Synthetic Control UI proof

Before: the interrupted notice promised automatic resumption without a server replay owner.

Before: interrupted saved input

After: server recovery owns the input; unrecovered inputs retain copy/resend guidance. Passive reconciliation sends no chat.send request.

After: interrupted input with copy and resend guidance

@clawsweeper

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 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-19T13:26:04.898050Z 1d913b5 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 app: web-ui App: web-ui gateway Gateway runtime agents Agent runtime and tooling size: XL labels Oct 18, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 340c5e66b3

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/src/pages/chat/chat-send-actions.ts Resolved
@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 18, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f14b6db5f0

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/gateway/chat-input-recovery.ts Resolved
@clawsweeper clawsweeper Bot added clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 18, 2026
@clawsweeper

clawsweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR recovers accepted chat inputs after Gateway restarts and waits for durable transcript persistence before acknowledging steering.

Example: A Gateway accepts CHAT_UPDATE_1, then receives SIGKILL before processing it.

  • Before: The accepted input can remain interrupted until a browser returns.
  • After: Startup recovery re-admits the original input under current authority and deduplicates retries.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful recovery repair with substantial production-path evidence and no verified source defect; the newly failed exact-head authority check limits validation confidence.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (logs): Supplied cold-process Gateway evidence exercises accepted chat and peer inputs over real sockets and SQLite across SIGTERM/SIGKILL, including FIFO and deduplication; the real-Gateway authority harness covers allowed write effects and denied role/device/membership cases, and inspected screenshots cover the notice change.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Messages already accepted by the Gateway and acknowledged agent guidance can remain unprocessed after a restart.
Reason: The maintainer-approved direction addresses reported restart failures and preserves existing owners, cancellation boundaries and visible interrupted outcomes.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: this PR addresses a real recovery gap and resolves the prior findings, but its current-head authority regression now fails in CI and needs diagnosis.

Priority: P1
Reviewed head: 3743db6a0a8d163c17c941b4da72550c9322e2be

Before merge

  • Complete next step - Inspect the failed recovery-authority job's detailed logs and diagnose CLIENT_TIMEOUT at chat-input-recovery.authority.test.ts:273, preserving the startup rejection and zero-I/O assertions.

Findings

None.

Agent review details

How this fits together

Gateway chat admission persists accepted inputs in SQLite; startup recovery restores eligible requests through normal authorization and session execution while the browser reconciles receipts.

flowchart TD
A[Chat clients] --> B[Gateway admission]
B --> C[SQLite pending inputs]
C --> D[Startup recovery]
D --> E[Current operator and session authority]
E --> F[Session controller]
F --> G[Transcript and model execution]
C --> H[Browser receipt reconciliation]
Loading

Technical review

Best possible solution:

Retain the shared recovery owner and authority-backed replay, then resolve the current-head validation failure before landing.

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

Current main visibly excludes ordinary chat inputs from startup replay; the supplied cold-process SIGTERM/SIGKILL scenarios exercise the repaired path, and this review ran no target code.

Is this the best way to solve the issue?

The change uses the existing pending-input, authorization and session-controller owners, removes browser replay competition, and preserves documented exclusions without another queue or schema.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Browser outbox recovery changes intended behavior with a stated reason (1594ebf: Earlier recovery retained browser payloads and re-admitted matching interrupted inputs after reconnect.)
  • Selected-session targeting keeps the original intent (d84a910: The Gateway owns steer-versus-start decisions while the browser keeps one generic durable outbox.)
  • Peer recovery and requester authority keeps the original intent (fix(sessions): preserve requester identity at execution admission #157806: Queued and recovered executions retain authenticated requester identity while current revocation and owner checks remain authoritative.)
  • Steering acknowledgment changes intended behavior with a stated reason (unknown: The base explicitly acknowledged volatile queue admission; the PR changes that contract to persistence because accepted guidance was lost on restart. Local blob-dependent blame could not complete.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

Metric Value Why it matters
Production versus regression coverage Production and runner wiring +740/−385; tests/support +2,097/−433. Growth covers durable admission evidence, explicit replay options and distinct restart, revocation, ordering and upgrade failures while reusing existing persistence and recovery owners.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: Accepted user input and acknowledged guidance can be stranded across real Gateway restarts.
  • merge-risk: 🚨 compatibility: Steering acknowledgments now require persistence, unsupported durable steering becomes a queued turn, and browser recovery yields to server custody; these behavior changes have recorded maintainer acceptance.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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 execution lanes are retired.

History

Review history (6 earlier review cycles)
  • reviewed 2026-10-18T23:24:46.478Z sha f14b6db :: needs real behavior proof before merge. :: [P1] Preserve sender-specific tool restrictions during replay | [P1] Retain trusted external provenance in recovered requests | [P2] Allow explicit retries of same-lifecycle interrupted inputs | [P2] Update steering consumers to exercise durable admission | [P2] Complete the withdrawal fixture's persisted session target
  • reviewed 2026-10-19T05:47:23.068Z sha 0c7c80c :: needs real behavior proof before merge. :: [P2] Exclude provider-review continuations from automatic replay
  • reviewed 2026-10-19T06:05:10.318Z sha a5ff5af :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-19T07:01:13.744Z sha f5a44ed :: needs changes before merge. :: [P2] Preserve client-dependent capabilities during chat recovery | [P2] Recheck input expiry immediately before replay
  • reviewed 2026-10-19T07:10:18.544Z sha f5a44ed :: needs changes before merge. :: [P2] Preserve the client capability contract during replay | [P2] Recheck the recovery deadline immediately before re-admission
  • reviewed 2026-10-19T09:19:27.090Z sha 2293330 :: needs changes before merge. :: [P2] Preserve reconnect-resume semantics in saved replay requests | [P2] Adapt existing chat proof callers to deferred send readiness

Reviewed October 19, 2026, 8:07 AM ET / 12:07 UTC (Revision 7).

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 1d913b5e9f9d8c28def12f9cebbbba31a10b1314
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/server-methods/request-authorization.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server/ws-connection/connect-session.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 950e5f7af7

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/gateway/chat-input-recovery.ts Resolved
@openclaw-barnacle openclaw-barnacle Bot reopened this Oct 19, 2026
@steipete
steipete force-pushed the steipete/team-inputresume branch from 950e5f7 to 82fbfa5 Compare October 19, 2026 04:57
steipete added a commit that referenced this pull request Oct 19, 2026
Authenticated backend and shared-token connections now share the durable
Gateway owner after #176587. Verify that identity, exercise cross-device
replacement, and retain the real revoked-retry and zero-effect assertions.
Distinct-profile exclusion remains covered by the setup-auth retry suite.

Expect fresh chat to remain unavailable while the fixture deliberately
holds startup recovery. Join the existing subagent recovery owner before
asserting successful chat admission; retain database readiness and refusal
coverage without retries or timeout changes.

Refs: #176587
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 20, 2026
* fix: resume interrupted inputs after gateway restart

Recover accepted chat inputs through the existing startup pending-input owner with original receipt identity, FIFO order, current authority checks, and a 24-hour limit. Require transcript durability before acknowledging sessions_send steering; unsupported durable steering uses the existing queued delivery path. Keep browser reconciliation and explicit retry/discard aligned with server ownership.

* fix: retain durable identity for recovered chat inputs

Keep authenticated CLI input recovery independent of presence, allow matching interrupted retries, and make steering fixtures honor transcript commit before acknowledgment. Extract recovery metadata construction to preserve the import boundary.

* test: share ephemeral owner admission coverage

* fix: preserve trusted source context during chat recovery

* test: align recovery fixtures with admission lifetimes

* test: preserve authenticated retry and exact withdrawal coverage

* test: verify persisted steering provenance in raw child sessions

* fix(gateway): resume queued inputs across cold restarts

* fix: preserve requester contracts in restart recovery

* fix: retain the admitted agent when resuming chat inputs

* test: prepare requester authority for durable steer fallback

* fix: align interrupted input recovery with admission contracts

* fix: exclude process-bound review continuations from replay

* test: prove chat replay revocation and stable upgrades

* docs: clarify interrupted chat recovery limits

* fix: preserve recovery order for local chat commands

* fix: preserve chat replay order after transient exhaustion

* fix(gateway): fence fresh chat during startup recovery

* fix(gateway): preserve reconnect resume during input recovery

* test: prove explicit steer input resumes without an active turn

* test: complete peer recovery runtime fixtures

* fix(gateway): preserve requester context during chat replay

* fix(gateway): preserve mixed input order after retry exhaustion

* test(gateway): observe startup refusal before client retries

* test(gateway): prove predecessor order during chat recovery

* fix(gateway): recover interrupted turns before queued peers
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 20, 2026
Authenticated backend and shared-token connections now share the durable
Gateway owner after openclaw#176587. Verify that identity, exercise cross-device
replacement, and retain the real revoked-retry and zero-effect assertions.
Distinct-profile exclusion remains covered by the setup-auth retry suite.

Expect fresh chat to remain unavailable while the fixture deliberately
holds startup recovery. Join the existing subagent recovery owner before
asserting successful chat admission; retain database readiness and refusal
coverage without retries or timeout changes.

Refs: openclaw#176587
roboclaw-bot added a commit to Marvinthebored/openclaw that referenced this pull request Oct 20, 2026
Only human turns receive personal-library authoring, so completion and
other internal turns published a different skill_workshop definition and
broke the native prompt cache for profiled users. Since openclaw#176587 this also
affects token-authenticated clients.

CLI turns without authoring now reuse the session's last human shape with
an expired grant, as goal continuation already does. The definition stays
identical and every call, including Workshop calls through the
workspace-default wrapper, is refused, so no sandboxed internal turn gains
Workshop access.

Co-authored-by: VACInc <[email protected]>
VACInc added a commit that referenced this pull request Oct 20, 2026
)

* fix(claude-cli): stop cache-prefix churn after child completion

Ordinary local claude-cli turns now use the same exact OpenClaw-mediated
tool projection as verified child completions, so a completion no longer
swaps the tools-first cached prefix of a running native session.

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

* test(claude-cli): expect the mediated surface on ordinary turns

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

* test(claude-cli): select native tools in the workspace-only override case

Managed Claude turns are mediated by default, so the agent workspace-only override is
covered on the explicit native-selection path that still exposes native file tools.

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

* fix(claude-cli): serve configured MCP servers through the loopback bridge

Exclusive CLI runs omit native MCP servers because the CLI would call them
outside OpenClaw's per-turn caps. Managed local Claude turns are now all
exclusive, so configured mcp.servers disappeared from ordinary turns.

Materialize the session's configured MCP tools for the run and serve them
through the loopback grant. They pass the same Gateway policy pipeline and
exact grant allowlist as other tools, so ordinary and completion turns list
one catalog while each turn's cap still decides what is listed and callable.

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

* fix(claude-cli): ignore request echoes when checking for orphaned tool calls

Claude Code logs api-request-blob records that repeat already answered
tool calls under role=assistant. Counting them made a finished turn look
orphaned until the final reply was written, so a completion that resumed
the parent right after a spawn reset its native session. Only user and
assistant conversation records now count.

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

* fix(claude-cli): keep skill_workshop stable on internal turns

Only human turns receive personal-library authoring, so completion and
other internal turns published a different skill_workshop definition and
broke the native prompt cache for profiled users. Since #176587 this also
affects token-authenticated clients.

CLI turns without authoring now reuse the session's last human shape with
an expired grant, as goal continuation already does. The definition stays
identical and every call, including Workshop calls through the
workspace-default wrapper, is refused, so no sandboxed internal turn gains
Workshop access.

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

* fix(skill-workshop): keep workspace Workshop on internal CLI turns

The stable skill_workshop shape for internal turns refused every call,
including workspace Workshop calls that an unsandboxed no-grant turn may
make on main. Pass the run's sandbox state to the workspace-default
wrapper so the expired grant refuses only personal-library calls and
sandboxed workspace calls.

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

* fix(mcp): recheck loopback grant at configured-server I/O

The loopback handler checked grant and completion lineage before
executing a tool, but a configured MCP tool could still reach its server
after that check, for example after waiting for a session reconnection.
Carry the caller's check into MCP tools/call so it runs immediately
before server I/O.

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

* fix(mcp): serve configured server instructions through the loopback

Managed Claude turns used to connect configured MCP servers natively and
received each server's initialize instructions. The bridge kept the tools
but dropped the instructions. Capture them in the session MCP catalog and
return them from the loopback initialize reply, ordered by server name,
for servers that still have a listed tool. Catalog capture follows the
approach proposed in #174396.

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

* fix(mcp): guard every bridged request and serve server instructions whole

Resource reads, prompt fetches and paginated lists now recheck the loopback
caller's grant and completion lineage at the request boundary, as tool calls
already did. Configured server instructions are no longer capped at 1,200
characters. A Gateway loopback test revokes a real grant or reassigns a real
completion lineage during a server-driven catalog refresh.

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

* test(gateway): prove Workshop shape and refusal on completion turns

Through the real loopback, a completion turn after a human turn lists the
same skill_workshop definition, refuses personal-library calls without
reaching the human grant, and keeps unsandboxed workspace calls.

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

* test(gateway): prove sandboxed completions cannot write through Workshop

Sandboxed completion turns, with or without skill_workshop admitted by the
sandbox tool policy, list the same Workshop surface as the human turn and
refuse a workspace create before any file changes. The Gateway authority
file runs in the database-worker project, which owns the main-thread
shared-state broker. Drops the mock-sequenced revocation case now covered
by real grant and lineage owners.

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

* test(cli-runner): drop Workshop helper cases covered by the Gateway suite

Definition parity, personal refusal and workspace access are now proven
through the real loopback; keep session isolation and latest-shape cases.

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

* test(gateway): wait for list_changed delivery instead of sleeping

The probe follows each tools/list_changed with a ping on the same SSE
stream; the client handles stream messages in order, so its ping reply
proves the notification was consumed before the next call.

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

---------

Co-authored-by: Marvinthebored <[email protected]>
Co-authored-by: VACInc <[email protected]>
Co-authored-by: roboclaw-bot <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 21, 2026
…claw#172026)

* fix(claude-cli): stop cache-prefix churn after child completion

Ordinary local claude-cli turns now use the same exact OpenClaw-mediated
tool projection as verified child completions, so a completion no longer
swaps the tools-first cached prefix of a running native session.

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

* test(claude-cli): expect the mediated surface on ordinary turns

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

* test(claude-cli): select native tools in the workspace-only override case

Managed Claude turns are mediated by default, so the agent workspace-only override is
covered on the explicit native-selection path that still exposes native file tools.

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

* fix(claude-cli): serve configured MCP servers through the loopback bridge

Exclusive CLI runs omit native MCP servers because the CLI would call them
outside OpenClaw's per-turn caps. Managed local Claude turns are now all
exclusive, so configured mcp.servers disappeared from ordinary turns.

Materialize the session's configured MCP tools for the run and serve them
through the loopback grant. They pass the same Gateway policy pipeline and
exact grant allowlist as other tools, so ordinary and completion turns list
one catalog while each turn's cap still decides what is listed and callable.

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

* fix(claude-cli): ignore request echoes when checking for orphaned tool calls

Claude Code logs api-request-blob records that repeat already answered
tool calls under role=assistant. Counting them made a finished turn look
orphaned until the final reply was written, so a completion that resumed
the parent right after a spawn reset its native session. Only user and
assistant conversation records now count.

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

* fix(claude-cli): keep skill_workshop stable on internal turns

Only human turns receive personal-library authoring, so completion and
other internal turns published a different skill_workshop definition and
broke the native prompt cache for profiled users. Since openclaw#176587 this also
affects token-authenticated clients.

CLI turns without authoring now reuse the session's last human shape with
an expired grant, as goal continuation already does. The definition stays
identical and every call, including Workshop calls through the
workspace-default wrapper, is refused, so no sandboxed internal turn gains
Workshop access.

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

* fix(skill-workshop): keep workspace Workshop on internal CLI turns

The stable skill_workshop shape for internal turns refused every call,
including workspace Workshop calls that an unsandboxed no-grant turn may
make on main. Pass the run's sandbox state to the workspace-default
wrapper so the expired grant refuses only personal-library calls and
sandboxed workspace calls.

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

* fix(mcp): recheck loopback grant at configured-server I/O

The loopback handler checked grant and completion lineage before
executing a tool, but a configured MCP tool could still reach its server
after that check, for example after waiting for a session reconnection.
Carry the caller's check into MCP tools/call so it runs immediately
before server I/O.

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

* fix(mcp): serve configured server instructions through the loopback

Managed Claude turns used to connect configured MCP servers natively and
received each server's initialize instructions. The bridge kept the tools
but dropped the instructions. Capture them in the session MCP catalog and
return them from the loopback initialize reply, ordered by server name,
for servers that still have a listed tool. Catalog capture follows the
approach proposed in openclaw#174396.

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

* fix(mcp): guard every bridged request and serve server instructions whole

Resource reads, prompt fetches and paginated lists now recheck the loopback
caller's grant and completion lineage at the request boundary, as tool calls
already did. Configured server instructions are no longer capped at 1,200
characters. A Gateway loopback test revokes a real grant or reassigns a real
completion lineage during a server-driven catalog refresh.

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

* test(gateway): prove Workshop shape and refusal on completion turns

Through the real loopback, a completion turn after a human turn lists the
same skill_workshop definition, refuses personal-library calls without
reaching the human grant, and keeps unsandboxed workspace calls.

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

* test(gateway): prove sandboxed completions cannot write through Workshop

Sandboxed completion turns, with or without skill_workshop admitted by the
sandbox tool policy, list the same Workshop surface as the human turn and
refuse a workspace create before any file changes. The Gateway authority
file runs in the database-worker project, which owns the main-thread
shared-state broker. Drops the mock-sequenced revocation case now covered
by real grant and lineage owners.

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

* test(cli-runner): drop Workshop helper cases covered by the Gateway suite

Definition parity, personal refusal and workspace access are now proven
through the real loopback; keep session isolation and latest-shape cases.

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

* test(gateway): wait for list_changed delivery instead of sleeping

The probe follows each tools/list_changed with a ping on the same SSE
stream; the client handles stream messages in order, so its ping reply
proves the notification was consumed before the next call.

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

---------

Co-authored-by: Marvinthebored <[email protected]>
Co-authored-by: VACInc <[email protected]>
Co-authored-by: roboclaw-bot <[email protected]>
RomneyDa added a commit that referenced this pull request Oct 22, 2026
)

* fix(claude-cli): stop cache-prefix churn after child completion

Ordinary local claude-cli turns now use the same exact OpenClaw-mediated
tool projection as verified child completions, so a completion no longer
swaps the tools-first cached prefix of a running native session.

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

* test(claude-cli): expect the mediated surface on ordinary turns

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

* test(claude-cli): select native tools in the workspace-only override case

Managed Claude turns are mediated by default, so the agent workspace-only override is
covered on the explicit native-selection path that still exposes native file tools.

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

* fix(claude-cli): serve configured MCP servers through the loopback bridge

Exclusive CLI runs omit native MCP servers because the CLI would call them
outside OpenClaw's per-turn caps. Managed local Claude turns are now all
exclusive, so configured mcp.servers disappeared from ordinary turns.

Materialize the session's configured MCP tools for the run and serve them
through the loopback grant. They pass the same Gateway policy pipeline and
exact grant allowlist as other tools, so ordinary and completion turns list
one catalog while each turn's cap still decides what is listed and callable.

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

* fix(claude-cli): ignore request echoes when checking for orphaned tool calls

Claude Code logs api-request-blob records that repeat already answered
tool calls under role=assistant. Counting them made a finished turn look
orphaned until the final reply was written, so a completion that resumed
the parent right after a spawn reset its native session. Only user and
assistant conversation records now count.

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

* fix(claude-cli): keep skill_workshop stable on internal turns

Only human turns receive personal-library authoring, so completion and
other internal turns published a different skill_workshop definition and
broke the native prompt cache for profiled users. Since #176587 this also
affects token-authenticated clients.

CLI turns without authoring now reuse the session's last human shape with
an expired grant, as goal continuation already does. The definition stays
identical and every call, including Workshop calls through the
workspace-default wrapper, is refused, so no sandboxed internal turn gains
Workshop access.

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

* fix(skill-workshop): keep workspace Workshop on internal CLI turns

The stable skill_workshop shape for internal turns refused every call,
including workspace Workshop calls that an unsandboxed no-grant turn may
make on main. Pass the run's sandbox state to the workspace-default
wrapper so the expired grant refuses only personal-library calls and
sandboxed workspace calls.

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

* fix(mcp): recheck loopback grant at configured-server I/O

The loopback handler checked grant and completion lineage before
executing a tool, but a configured MCP tool could still reach its server
after that check, for example after waiting for a session reconnection.
Carry the caller's check into MCP tools/call so it runs immediately
before server I/O.

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

* fix(mcp): serve configured server instructions through the loopback

Managed Claude turns used to connect configured MCP servers natively and
received each server's initialize instructions. The bridge kept the tools
but dropped the instructions. Capture them in the session MCP catalog and
return them from the loopback initialize reply, ordered by server name,
for servers that still have a listed tool. Catalog capture follows the
approach proposed in #174396.

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

* fix(mcp): guard every bridged request and serve server instructions whole

Resource reads, prompt fetches and paginated lists now recheck the loopback
caller's grant and completion lineage at the request boundary, as tool calls
already did. Configured server instructions are no longer capped at 1,200
characters. A Gateway loopback test revokes a real grant or reassigns a real
completion lineage during a server-driven catalog refresh.

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

* test(gateway): prove Workshop shape and refusal on completion turns

Through the real loopback, a completion turn after a human turn lists the
same skill_workshop definition, refuses personal-library calls without
reaching the human grant, and keeps unsandboxed workspace calls.

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

* test(gateway): prove sandboxed completions cannot write through Workshop

Sandboxed completion turns, with or without skill_workshop admitted by the
sandbox tool policy, list the same Workshop surface as the human turn and
refuse a workspace create before any file changes. The Gateway authority
file runs in the database-worker project, which owns the main-thread
shared-state broker. Drops the mock-sequenced revocation case now covered
by real grant and lineage owners.

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

* test(cli-runner): drop Workshop helper cases covered by the Gateway suite

Definition parity, personal refusal and workspace access are now proven
through the real loopback; keep session isolation and latest-shape cases.

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

* test(gateway): wait for list_changed delivery instead of sleeping

The probe follows each tools/list_changed with a ping on the same SSE
stream; the client handles stream messages in order, so its ping reply
proves the notification was consumed before the next call.

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

---------

Co-authored-by: Marvinthebored <[email protected]>
Co-authored-by: VACInc <[email protected]>
Co-authored-by: roboclaw-bot <[email protected]>
(cherry picked from commit 77d9f42)
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 app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. security-sensitive-changed size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant