refactor(chat): route browser chat through one runtime (P3 Slice-Zero Task 5) #1172

Merged
mos-dt-0 merged 5 commits from feat/p3-slice0-task5-chat-runtime-router-shaggy into next 2026-08-12 20:11:13 +00:00
Collaborator

P3 Slice-Zero Task 5 — route ALL browser chat through a single ChatRuntimeRouter, with a
server→client chat:send-capability handshake, so there is one send path instead of parallel
runtime-specific ones.

Do not merge from this PR

scrappy retains the exact-head / current-next CI and merge gate and is the merge authority.
This PR exists for the record and for that gate — not as an invitation to merge.

Also held, unchanged by this PR: stage, and apps/web/src/spa/pages/chat.tsx.

Exact head

  • Branch: feat/p3-slice0-task5-chat-runtime-router-shaggy
  • Head: 9f586c7e8330ddc2700ab31b2048cf0f413fe87a (frozen — 5 commits)
  • Base: next @ 6a8ce6670209e4279280d7b3106b842cd068ebbb
  • Committed pathset: exactly 33 paths, the agreed fence. No 34th path.

Provenance — this branch supersedes a retired head

Three of the five commits on the original branch were authored Jason Woltje <[email protected]> although I wrote all five. Root cause was a git-identity split between
the host shell and the mosaic-dev distrobox home — the same shared-credential attribution defect
class already logged on this board. The provenance record was false, so the owner directed a
re-author onto a fresh branch.

Every commit here is authored and committed shaggy <[email protected]>, and this
branch was pushed with that account's own token rather than an inherited askpass.

The content is unchanged, and that is mechanically verifiable rather than asserted:

retired this branch
633acd2d bd69eca5 tree-identical
472dcee7 f4e7a4dd tree-identical
694f1a41 034bac0b tree-identical
33ca4b2a 26e472f9 tree-identical
b21c84f2 9f586c7e tree-identical

Every pair matches at the tree-object level, not merely at the endpoint, so per-commit review and
bisect see byte-for-byte what the retired branch showed at the same step. Endpoint tree object:
9dba40b08d2d596073291987bd239eb8727da131. git diff b21c84f2 9f586c7e is empty.

Retired head b21c84f2 and its PR #1171 are closed. The original branch is untouched at that
SHA.

Verification

Authored under a DO-178B-style split — author ≠ verifier ≠ reviewer ≠ merge gate. I authored;
scrappy independently verified and reviewed. His fresh exact-SHA gate on this head:

  • clean isolated migrated-DB gate: Types 77, Gateway 826 (16 skipped), Web 199
  • all typechecks, lints, builds green
  • focused specs 88/88
  • independent provenance/security review: APPROVE

The three residuals from the prior review round were closed red-first — each new test was shown
failing against the pre-fix source before the fix was applied:

  1. admitBrowserConversation now requires a non-null created record whose id/userId match, so
    the mint path no longer admits on an ignored create() result. Nullish and throwing mints both
    fail closed with zero side effects.
  2. Discord ingress reconciles on both record.id and record.name before the replay claim is
    consumed, and the session returned by createSession() is validated on identity — not only a
    pre-existing session. An identity mismatch refuses before any prompt/persist/ack.
  3. The REST turn timeout is now observed concurrently with the pending prompt (Promise.all),
    closing an unhandled-rejection window and a prompt that could hang past any timeout.

One honest note carried forward from that round: of the six new cases, five failed against the
pre-fix source and one (the throwing-mint axis) passed on both, because the pre-existing try/catch
already covered it. It is included for completeness, not claimed as red.

Findings #4 (latent turn-send lock) and #5 (legacy-continuity restoration) remain owner-deferred
per Jason's canonicalized backlog. Finding #2 remains closed.

P3 Slice-Zero **Task 5** — route ALL browser chat through a single `ChatRuntimeRouter`, with a server→client `chat:send-capability` handshake, so there is one send path instead of parallel runtime-specific ones. ## ⛔ Do not merge from this PR `scrappy` retains the exact-head / current-`next` CI and merge gate and is the merge authority. This PR exists for the record and for that gate — not as an invitation to merge. Also held, unchanged by this PR: `stage`, and `apps/web/src/spa/pages/chat.tsx`. ## Exact head - Branch: `feat/p3-slice0-task5-chat-runtime-router-shaggy` - Head: `9f586c7e8330ddc2700ab31b2048cf0f413fe87a` (frozen — 5 commits) - Base: `next` @ `6a8ce6670209e4279280d7b3106b842cd068ebbb` - Committed pathset: exactly **33** paths, the agreed fence. No 34th path. ## Provenance — this branch supersedes a retired head Three of the five commits on the original branch were authored `Jason Woltje <[email protected]>` although I wrote all five. Root cause was a git-identity split between the host shell and the `mosaic-dev` distrobox home — the same shared-credential attribution defect class already logged on this board. The provenance record was false, so the owner directed a re-author onto a fresh branch. Every commit here is authored **and** committed `shaggy <[email protected]>`, and this branch was pushed with that account's own token rather than an inherited askpass. The content is unchanged, and that is mechanically verifiable rather than asserted: | retired | this branch | | |---|---|---| | `633acd2d` | `bd69eca5` | tree-identical | | `472dcee7` | `f4e7a4dd` | tree-identical | | `694f1a41` | `034bac0b` | tree-identical | | `33ca4b2a` | `26e472f9` | tree-identical | | `b21c84f2` | `9f586c7e` | tree-identical | Every pair matches at the tree-object level, not merely at the endpoint, so per-commit review and bisect see byte-for-byte what the retired branch showed at the same step. Endpoint tree object: `9dba40b08d2d596073291987bd239eb8727da131`. `git diff b21c84f2 9f586c7e` is empty. Retired head `b21c84f2` and its PR **#1171** are closed. The original branch is untouched at that SHA. ## Verification Authored under a DO-178B-style split — author ≠ verifier ≠ reviewer ≠ merge gate. I authored; `scrappy` independently verified and reviewed. His fresh exact-SHA gate on this head: - clean isolated migrated-DB gate: Types 77, Gateway 826 (16 skipped), Web 199 - all typechecks, lints, builds green - focused specs 88/88 - independent provenance/security review: APPROVE The three residuals from the prior review round were closed **red-first** — each new test was shown failing against the pre-fix source before the fix was applied: 1. `admitBrowserConversation` now requires a non-null created record whose `id`/`userId` match, so the mint path no longer admits on an ignored `create()` result. Nullish and throwing mints both fail closed with zero side effects. 2. Discord ingress reconciles on **both** `record.id` and `record.name` before the replay claim is consumed, and the session returned by `createSession()` is validated on identity — not only a pre-existing session. An identity mismatch refuses before any prompt/persist/ack. 3. The REST turn timeout is now observed concurrently with the pending prompt (`Promise.all`), closing an unhandled-rejection window and a prompt that could hang past any timeout. One honest note carried forward from that round: of the six new cases, five failed against the pre-fix source and one (the throwing-mint axis) passed on both, because the pre-existing `try/catch` already covered it. It is included for completeness, not claimed as red. Findings #4 (latent turn-send lock) and #5 (legacy-continuity restoration) remain **owner-deferred** per Jason's canonicalized backlog. Finding #2 remains closed.
shaggy added 5 commits 2026-08-12 19:57:15 +00:00
mos-dt-0 merged commit 216cd72226 into next 2026-08-12 20:11:13 +00:00
Sign in to join this conversation.