Skip to content

refactor(gateway): interrupt at admission; sessions.steer delegates to chat.send - #126291

Merged
steipete merged 2 commits into
mainfrom
steipete/redirect-interrupt-admission
Aug 19, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/redirect-interrupt-admission

Conversation

@steipete

@steipete steipete commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The repo shipped two structurally different hard-interrupt boundaries for one intent: sessions.steer's private abort/wait/dispatch machine (used only by Control UI /redirect) and chat.send queueMode: "interrupt" handled late at reply admission. Late interruption ran after unrelated context work; the private machine duplicated idempotency/inflight/abort policy and aborted by session key.

Why This Change Was Made

Interruption now happens at the session-work admission owner via the captured-operation primitive (exact-instance abort per #125763; successor-safe), shared by gateway and channel-originated interrupts. When no reply-registry operation was captured, the new admission runs the lifecycle owner's interruptSessionWorkAdmissions fallback inside its own admission context, interrupting worker/plugin-style predecessors without aborting itself; captured registry operations never fall through to a raw session-key abort. sessions.steer (shipped RPC since v2026.4.1, <=2026.7 descriptor) keeps validation, sharing/access semantics, and byte-compatible response shape as a thin deprecated adapter; its beginSessionSteerInflight machine is deleted. /redirect rides canonical chat.send (UI and gateway co-ship). Compaction's hard-interrupt helper is extracted unchanged to session-run-interruption.ts.

User Impact

/redirect behavior is unchanged from the operator's chair (mocked-UI E2E video and screenshots below). Reply-backed interrupts abort only the captured run, so a queued interrupt cannot kill its successor; non-reply worker/plugin placements are interrupted through the admission lifecycle owner before the replacement turn dispatches.

Evidence

Production +389/-454 (net -65), tests +259/-270 (net -11). Auto-reply 211, gateway 71, UI 329 + E2E 7 green; check-changed, build, and Codex autoreview clean. The direct non-registry Gateway regression failed pre-fix with zero interrupts and now passes; the captured-operation successor-safety regression remains green.

redirect-interrupt.mp4

Initial Control UI state

Redirect command entered

Redirected run state

@clawsweeper

clawsweeper Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: XL maintainer Maintainer-authored PR labels Aug 19, 2026
@steipete
steipete marked this pull request as ready for review August 19, 2026 10:18
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 19, 2026
@clawsweeper

clawsweeper Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 19, 2026, 7:28 AM ET / 11:28 UTC.

ClawSweeper review

What this changes

The PR routes session interruption through chat.send interrupt mode, keeps sessions.steer as a deprecated compatibility adapter, and moves the Control UI redirect command onto that canonical path.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

The patch correctly centralizes interruption at Gateway admission while retaining the deprecated RPC adapter. It should remain open for normal exact-head validation before merge.

Priority: P1
Reviewed head: 6961f2e19b5ca1423c1293d8857be4ff9321169b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has a coherent owner-boundary design and targeted regression coverage; exact-head checks remain the merge gate.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is not subject to the external-contributor real-behavior-proof gate.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is not subject to the external-contributor real-behavior-proof gate.
Evidence reviewed 6 items Canonical interrupt owner: Interrupt admission captures an exact reply target under its writer barrier, then interrupts that target or competing lifecycle admissions before dispatching the replacement turn.
Legacy RPC compatibility: sessions.steer validates established session-send input then dispatches canonical chat.send with interrupt mode; the protocol documentation and descriptor retain it as a deprecated alias.
Embedded-only fallback traced: The apparent no-store fallback cannot occur on production paths: ordinary initialization supplies a store path, and the fast path resolves one directly while not loading the embedded runtime.
Findings None None.
Security None None.

Live Verification

Command: pnpm test src/gateway/server.chat.gateway-server-chat.test.ts

Result: FAIL (partial) — step 2 expect_output passed: expected terminal output was not visible within 30 seconds: "passed"

pnpm test src/gateway/server.chat.gateway-server-chat.test.ts
runner@runnervmzvulz:/tmp/clawsweeper-live-proof-126291-748Mh2/target$ pnpm test src/gateway/server.chat.gateway-server-chat.test.ts
$ node --import tsx scripts/test-projects.mts src/gateway/server.chat.gateway-server-chat.test.ts
pnpm test src/gateway/server.chat.gateway-server-chat.test.ts
[test] starting test/vitest/vitest.gateway.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-126291-748Mh2/target

[vitest] still running with no output for 30000ms (test/vitest/vitest.gateway.config.ts).










































Assertions:

  • FAIL expect_output: passed

How this fits together

Gateway message admission decides whether a message begins immediately, queues, or interrupts work in a session. It coordinates reply operations, embedded agent runs, and lifecycle admissions so a replacement request waits for the exact prior owner before starting.

flowchart LR
  A[Client message request] --> B[Gateway admission]
  B --> C{Interrupt mode}
  C -->|No| D[Queue or start turn]
  C -->|Yes| E[Capture active owner]
  E --> F[Stop exact work]
  F --> D
  D --> G[Session and UI response]
Loading

Before merge

  • Resolve merge risk (P1) - The public sessions.steer alias now shares chat.send admission semantics, so exact-head compatibility checks should complete before merge.
  • Complete next step (P2) - Wait for exact-head CI; no repair is indicated and this maintainer-authored PR remains in normal review.
Agent review details

Security

None.

PR surface

Source -65, Tests -11, Docs 0. Total -76 across 25 files.

View PR surface stats
Area Files Added Removed Net
Source 16 389 454 -65
Tests 8 259 270 -11
Docs 1 2 2 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 25 650 726 -76

Review metrics

Metric Value Why it matters
Production and test delta production +378/-454, tests +259/-270, docs +2/-2 The refactor removes the standalone steering state machine while adding focused boundary coverage, producing a net production reduction.
Compatibility surface 1 deprecated RPC retained, 1 UI command migrated Existing RPC clients keep a supported adapter while the UI uses the canonical send interface.

Stored data model

Persistent data-model change detected: serialized state: src/gateway/server-methods/session-run-interruption.ts, serialized state: src/gateway/server-methods/sessions-compaction-checkpoints.ts, serialized state: src/gateway/server-methods/sessions-messaging.ts, serialized state: src/gateway/server-methods/sessions.send-followup-status.test.ts, serialized state: ui/src/lib/sessions/index.ts, serialized state: ui/src/lib/sessions/session-capability.ts, and 5 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Complete compatibility validation (recommended)
    Wait for exact-head Gateway and UI checks that exercise the deprecated RPC and canonical interrupt admission before merging.

Technical review

Best possible solution:

Land after exact-head checks confirm the retained sessions.steer contract and canonical interrupt ordering.

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

Yes, source-reproducible: focused tests define active reply, embedded-only, idle, and idempotent interruption scenarios, but none were run in this read-only review.

Is this the best way to solve the issue?

Yes: Gateway admission is the correct canonical owner boundary, and the adapter preserves the public legacy RPC instead of retaining duplicate interruption machines.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 4af09d4961c9.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is not subject to the external-contributor real-behavior-proof gate.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: This changes the active-session replacement path, where a regression can interrupt the wrong turn or leave a requested replacement waiting.
  • merge-risk: 🚨 compatibility: Existing clients may call the public sessions.steer RPC, which now delegates to chat.send interrupt mode.
  • merge-risk: 🚨 session-state: The patch changes ordering among a session's prior turn, pending queues, and its replacement message.
  • merge-risk: 🚨 availability: Incorrect interruption or drain behavior could stall replacement agent work until timeout.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is not subject to the external-contributor real-behavior-proof gate.

Evidence

Acceptance criteria:

  • [P1] Run focused Gateway interruption tests in a writable validation checkout.
  • [P1] Confirm exact-head CI covers the retained sessions.steer adapter and UI redirect path.

What I checked:

Likely related people:

  • steipete: Authored the current interruption refactor and its non-reply correction; history shows sustained work on this Gateway steering surface. (role: recent area contributor; confidence: high; commits: 4478d54ca2ba, 6961f2e19b5c, fa9626c4e100; files: src/gateway/server-methods/chat-send-admission.ts, src/gateway/server-methods/sessions-messaging.ts)
  • Jason (Json): History identifies prior work extending steering across agent harnesses. (role: adjacent owner; confidence: medium; commits: 6d2ba0d5622f; files: src/gateway/server-methods/chat-send-admission.ts)

Rank-up moves

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

  • Wait for pending exact-head checks to finish successfully.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-19T10:24:28.736Z sha 37a764d :: found issues before merge. :: [P1] Interrupt non-registry session admissions
  • reviewed 2026-08-19T11:13:30.632Z sha 110dc645209476937b48278b64fe972952046c78 :: found issues before merge. :: [P1] Restore Codex descendant containment | [P2] Remove the unrelated Peekaboo revision update

@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 19, 2026
…o chat.send

chat.send queueMode interrupt now aborts the captured current operation
at the session-work admission owner (exact-instance abort, never a
same-key successor) and dispatches the new turn after the abort
settles; channel-originated interrupts share the same primitive.
sessions.steer keeps its validation, sharing/access checks, and
response shape but becomes a thin deprecated adapter over that path -
its private inflight/retry and hard-abort machine is deleted. The
Control UI /redirect command rides canonical chat.send. Compaction's
use of the old hard-interrupt helper moves unchanged to
session-run-interruption.ts.
@steipete
steipete force-pushed the steipete/redirect-interrupt-admission branch from 110dc64 to 6961f2e Compare August 19, 2026 11:20
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed 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. labels Aug 19, 2026
@steipete
steipete merged commit a7f9a7f into main Aug 19, 2026
241 checks passed
@steipete
steipete deleted the steipete/redirect-interrupt-admission branch August 19, 2026 11:37
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 20, 2026
…o chat.send (openclaw#126291)

* refactor(gateway): interrupt at admission; sessions.steer delegates to chat.send

chat.send queueMode interrupt now aborts the captured current operation
at the session-work admission owner (exact-instance abort, never a
same-key successor) and dispatches the new turn after the abort
settles; channel-originated interrupts share the same primitive.
sessions.steer keeps its validation, sharing/access checks, and
response shape but becomes a thin deprecated adapter over that path -
its private inflight/retry and hard-abort machine is deleted. The
Control UI /redirect command rides canonical chat.send. Compaction's
use of the old hard-interrupt helper moves unchanged to
session-run-interruption.ts.

* fix(gateway): interrupt non-reply admissions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant