Docs: ai-bot streaming modes, event schema, and throttle defaults#5568
Conversation
…defaults Update the ai-bot README to match the code: AI_BOT_STREAM_THROTTLE_MS defaults to 250ms and AI_BOT_STREAM_MIN_DELTA to 0 (both were stale). Add a Streaming modes section for AI_BOT_STREAMING_MODE (room-edits / off / to-device), document the app.boxel.response-stream to-device event payload, and explain the rationale for each mode. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
habdelra
left a comment
There was a problem hiding this comment.
[Claude Code 🤖] Reviewed as a fidelity check: since this is docs-only, I traced every documented value, field, and behavior back to the code it claims to describe (responder.ts, response-publisher.ts, main.ts, matrix-utils.ts, matrix-constants.ts) on the head branch.
Bottom line: the doc is accurate on nearly everything, with two claims that contradict the code and one that overstates a knob's reach. No blocking issues; all three are quick doc edits.
What lands right (verified, not skimmed):
- Throttle defaults match:
AI_BOT_STREAM_THROTTLE_MS=250(responder.ts:143) andAI_BOT_STREAM_MIN_DELTA=0(responder.ts:193) — the old600/300values were indeed stale. - The
MIN_DELTAexception list ("new reasoning, a changed tool call, the first content, and the final send always go through") maps one-to-one onto theshouldSenddisjunction atresponder.ts:207-212. - Streaming modes and their delivery:
room-editsusesm.replace(matrix-utils.ts:42-47),offsends nothing mid-turn,to-devicepreviews go oversendToDeviceand only the final consolidated state lands as a room event (responder.ts:133-141) — all correct. - Event schema: every
AppBoxelResponseStreamContentfield matches (matrix-constants.ts:146-161),sequenceis per-turn monotonic from 0 (responder.ts:157), andarguments: {}until the streamed JSON parses is exactlytoCommandRequest's catch branch (response-publisher.ts:33-41).
Recommendations:
- Fix the tool-requests wire key:
app.boxel.tool-requests→app.boxel.toolRequests— see the thread on the schema table (should-fix). - Rework the
to-devicefallback paragraph — a tool/code-patch continuation keeps streaming via the turn-history fallback inmain.ts, rather than dropping tooff; see the thread on that paragraph (should-fix). - Scope the throttle-tuning intro so
MIN_DELTAisn't credited with gating to-device previews — see the thread on that section (non-blocking).
Adjacent, out of scope: the body character-delta gate (contentDelta >= minDelta) keys off body length only; reasoning-only growth is covered by the separate reasoningDelta > 0 term. That's consistent and not worth documenting — noting it only so the "body characters" wording in the table isn't later "fixed" to include reasoning.
Generated by Claude Code
… key Address review on the ai-bot README: - The tool-requests content key is camelCase `app.boxel.toolRequests`, not kebab-case — it's the value a reader copies verbatim. - A tool/code-patch continuation keeps streaming: ai-bot resolves the target from the most recent stamped prompt in the turn's history, so multi-step turns don't drop to `off` after the first tool call. Only a turn whose history carries no stamped id falls back to `off`-mode behavior. - `AI_BOT_STREAM_MIN_DELTA` gates `room-edits` only; `to-device` previews send on every throttle window. `AI_BOT_STREAM_THROTTLE_MS` gates both. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1833dd1
into
cs-12261-response-stream-event-schema
Updates the ai-bot README to match the code and document the streaming knobs.
Changes
AI_BOT_STREAM_THROTTLE_MSis250ms (was documented as600) andAI_BOT_STREAM_MIN_DELTAis0(was documented as300).AI_BOT_STREAMING_MODE—room-edits(default),off, andto-device— what each delivers and the to-device device-targeting fallback.app.boxel.response-streamto-device event payload (AppBoxelResponseStreamContent) field by field, including its cumulative-state / last-writer-wins-by-sequencesemantics.Base
Stacked on
cs-12261-response-stream-event-schema, which implements the streaming modes and event type this documents.Test plan
Docs-only; verified every value and field against
packages/ai-bot/lib/responder.ts,packages/ai-bot/main.ts, andpackages/runtime-common/matrix-constants.ts.🤖 Generated with Claude Code