Skip to content

feat(coderd/x/chatd/chatloop): emit stream and time_to_first_token stages - #28970

Closed
jscottmiller wants to merge 1 commit into
scott/chatd-stages/2-stage-tracerfrom
scott/chatd-stages/3-stream-stages
Closed

jscottmiller wants to merge 1 commit into
scott/chatd-stages/2-stage-tracerfrom
scott/chatd-stages/3-stream-stages

Conversation

@jscottmiller

@jscottmiller jscottmiller commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Superseded by #29770. Closed in favor of the reduced stack #29773.

GenerateAssistant records a stream stage from stream open to close and a nested time_to_first_token stage. finishTTFT closes the TTFT window exactly once: the first content part closes it as a success and observes both the stage histogram and the pre-existing coderd_chatd_ttft_seconds; a failed stream open or an error part ends the span with that error and observes nothing, so both histograms stay success-only; a window released without any part ends with errNoFirstToken. The attempt is released before the stream span ends, so the TTFT window always falls inside its stream.

Callers pass a Stages tracer and a StageModel through GenerateAssistantOptions; a nil tracer discards.

🤖 This PR was generated by Coder Agents on behalf of @jscottmiller.

@jscottmiller
jscottmiller force-pushed the scott/chatd-stages/3-stream-stages branch from 77d9e3c to 54d3777 Compare September 9, 2026 23:19
@jscottmiller jscottmiller added the experimental Changes that might not necessarily be merged, until its approved to proceed with. label Sep 11, 2026
@jscottmiller
jscottmiller force-pushed the scott/chatd-stages/3-stream-stages branch from 54d3777 to 3e6c03c Compare September 11, 2026 02:25
@jscottmiller
jscottmiller force-pushed the scott/chatd-stages/3-stream-stages branch from 3e6c03c to bf4b80a Compare September 11, 2026 19:17
@jscottmiller jscottmiller removed the experimental Changes that might not necessarily be merged, until its approved to proceed with. label Sep 14, 2026
@jscottmiller
jscottmiller force-pushed the scott/chatd-stages/3-stream-stages branch from bf4b80a to 4e8f3fe Compare September 14, 2026 20:16
@jscottmiller
jscottmiller force-pushed the scott/chatd-stages/3-stream-stages branch from 4e8f3fe to 1dc7e9f Compare September 14, 2026 22:06
@jscottmiller
jscottmiller force-pushed the scott/chatd-stages/3-stream-stages branch from 1dc7e9f to 8f27c5b Compare September 15, 2026 21:39
@jscottmiller
jscottmiller force-pushed the scott/chatd-stages/3-stream-stages branch from 8f27c5b to 6d35660 Compare September 16, 2026 03:12
@jscottmiller
jscottmiller force-pushed the scott/chatd-stages/3-stream-stages branch 2 times, most recently from 264c6b9 to 063a17b Compare September 17, 2026 20:31
@jscottmiller
jscottmiller force-pushed the scott/chatd-stages/3-stream-stages branch from 063a17b to 53ce37f Compare September 17, 2026 21:26
@jscottmiller
jscottmiller force-pushed the scott/chatd-stages/3-stream-stages branch from 53ce37f to af1f4de Compare September 21, 2026 00:09
@jscottmiller
jscottmiller force-pushed the scott/chatd-stages/3-stream-stages branch from af1f4de to 6b14918 Compare September 21, 2026 22:52
@linear-code

linear-code Bot commented Sep 22, 2026

Copy link
Copy Markdown

CODAGT-1102

@jscottmiller
jscottmiller force-pushed the scott/chatd-stages/3-stream-stages branch from 6b14918 to 5553212 Compare September 23, 2026 01:37
…ages

GenerateAssistant takes a StageTracer and StageModel and opens a stream
stage around the guarded model stream. guardedStream opens a
time_to_first_token stage that finishTTFT closes exactly once, on the
first streamed part or when the attempt is released without one; only
windows a part closed feed the TTFT and stage histograms. The attempt
is released before the stream stage ends so the TTFT window always
falls inside the stream that contains it.
@jscottmiller
jscottmiller force-pushed the scott/chatd-stages/3-stream-stages branch from 5553212 to a03d6df Compare September 23, 2026 02:14
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant