Repository navigation
Description
Parent: #8147
Summary
Move web chat onto the queues' interactive lane, with the gate bypassed, so web chat gets the same durability, dedupe and per-conversation ordering without added latency.
Problem
Web chat is the one inbound path a user is actively waiting on, and it is still outside the pipeline: a crash mid-turn loses the message, and double-submits are deduped only ad hoc.
Solution
- Ingest web chat as
instantcadence in theinteractivelane, gate and salience bypassed (the user is always addressing the agent). Delivercalls the existing web chat start/steer path.- Do this last, after the channel migrations have proven the delivery path.
Acceptance criteria
- Latency — added time-to-turn-start from the queue hop is measured and stays within a small fixed bound (state the number in the PR).
- Durable — a message sent just before a core restart is delivered after it, once.
- Double-submit deduped — the same client message id twice produces one turn.
- Ordering — messages within one thread are delivered in order, one turn in flight.
- Diff coverage ≥ 80% — the implementing PR meets the changed-lines coverage gate (Vitest + cargo-llvm-cov, enforced by
.github/workflows/ci-fast.yml).
Related
Part of #8147. Builds on #8136 (inbound domain, tinyeventqueues v0.1.2) and tinyhumansai/tinyeventqueues#6.
Audit findings (2026-10-20)
- Entry path: RPC
channel.web_chat→handle_chat(web_chat/schemas.rs:158) →channel_web_chat(ops/channel_ops.rs:248-306) →start_chat(ops/start_chat.rs:141). - Request id:
request_idis a freshUuid(start_chat.rs:225). - No client message id reaches the core.
- The app sends
client_id(socket),thread_id,message, model, locale,queue_modeandreasoning_effort(app/src/services/chatService.ts:1681-1692). - The frontend persists the user message itself (
ChatRuntimeProvider.tsx:634-651), and itsThreadMessage.idis the natural dedupe key. The app has to start sending it.
- The app sends
- Queue modes (
start_chat.rs:356-361):steer/followup/collectpush into the running turn'sRunQueue(L389-419);paralleluses its own lane;- the default is
interrupt. RunQueue,IN_FLIGHTand the parallel state (ops/state.rs) are in memory only.
- Module support: the fast path (gate bypass, zero debounce, immediate wake) comes from [inbound-queues] sources: per-source gate bypass and debounce override for web chat senamakel/tinyeventqueues#3. Without it, web chat would wait about 1.5 s per message.
Agent brief
Depends on: senamakel#514, senamakel/tinyeventqueues#3 · Blocks: senamakel#515 · Parallel with: #8148, #8149, #8150
Research first
- How steer/collect/interrupt semantics map onto queued delivery. The queue serializes one turn per conversation, but
interruptmust still cancel an in-flight turn immediately. That control action probably stays direct, with only the message itself queued. - The latency budget. Measure time-to-turn-start before and after with
pnpm debug weband record both in the PR.
Files to consider
- Read:
crates/openhuman-core/src/web_chat/ops/channel_ops.rs:248-306,web_chat/ops/start_chat.rs:141-481,web_chat/ops/state.rs,app/src/services/chatService.ts:1670-1700,app/src/providers/ChatRuntimeProvider.tsx:620-660 - Change:
web_chat/ops/channel_ops.rs(ingest viainbound::route), theweb:handler ininbound/deliver/,app/src/services/chatService.ts(send the client message id), its Vitest test - Tests:
web_chat/ops/*_tests.rs,app/src/services/chatService.test.ts, atests/json_rpc_e2e.rscase
Workflow: implementing-an-epic step.
Subagents: tdd-implementer (Sonnet), then code-reviewer.
Gates: cargo check --manifest-path Cargo.toml · pnpm rust:clippy · cargo test -p openhuman web_chat inbound · pnpm test -- chatService · pnpm typecheck · pnpm rust:layout
Activity
M3gA-Mind commentedon Nov 16, 2026
Re-checked on current main: not done yet. Web chat doesn't go through
inbound, and each message gets a fresh id, so dedupe and durability are still the ad-hoc ones. As the issue says, this one comes last, after the channel migrations (#8148, #8149). Keeping it open.