Skip to content

refactor(gateway): extract chat dispatch errors - #106743

Merged
steipete merged 1 commit into
mainfrom
codex/refactor-chat-send-dispatch-errors
Jul 13, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/refactor-chat-send-dispatch-errors

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

chat.send still owned dispatch rejection and cleanup inline: restart-safe terminalization, queued-followup success projection, error dedupe/broadcast, deferred lifecycle persistence, user-turn fallback persistence, root reservation, and admitted-run cleanup. This ordering-sensitive phase was mixed into the happy-path dispatch chain.

Advances #106555.

Why This Change Was Made

  • Move dispatch rejection and final cleanup into chat-send-dispatch-errors.ts.
  • Keep pending lifecycle-error state private to the controller.
  • Preserve queued-followup success semantics and restart-safe terminalization precedence.
  • Preserve root reservation before cleanup and deferred lifecycle/user-turn persistence ordering.
  • Add focused coverage for the late queued-followup failure path.

This reduces chat.ts from 1,858 to 1,701 lines. The extracted production module is 214 lines.

User Impact

No intended behavior change. Dispatch failures retain existing retry, dedupe, error broadcast, queued-followup, lifecycle persistence, and cleanup behavior.

Evidence

  • Testbox tbx_01kxedpaq8pcfkkv9bmj8eyx33: 2 files, 144 tests passed.
  • Same Testbox: corepack pnpm tsgo:core passed after removing the stale rawSessionKey destructure surfaced by the first typecheck.
  • Fresh autoreview clean, no accepted/actionable findings; correctness 0.98.
  • git diff --check origin/main...HEAD passed after rebasing onto current origin/main.
  • Hosted CI intentionally not awaited per maintainer direction.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime labels Jul 13, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for head 71b324be7cef44e00c238f7f5d23edb0dbf8c9de:

  • Testbox tbx_01kxedpaq8pcfkkv9bmj8eyx33: corepack pnpm test src/gateway/server-methods/chat-send-dispatch-errors.test.ts src/gateway/server-methods/chat.directive-tags.test.ts — 2 files, 144 tests passed.
  • Same Testbox: corepack pnpm tsgo:core passed after the first run identified the stale moved destructure.
  • Fresh autoreview clean; no accepted/actionable findings; correctness 0.98.
  • git diff --check origin/main...HEAD passed after rebasing onto current origin/main.

Known proof gap: hosted CI intentionally not awaited per maintainer direction.

@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Jul 13, 2026
@steipete
steipete merged commit ad1c0ed into main Jul 13, 2026
75 of 79 checks passed
@steipete
steipete deleted the codex/refactor-chat-send-dispatch-errors branch July 13, 2026 19:10
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 14, 2026
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 gateway Gateway runtime maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant