feat(coderd/x/chatd/chatloop): emit stream and time_to_first_token stages - #28970
Draft
jscottmiller wants to merge 1 commit into
Draft
feat(coderd/x/chatd/chatloop): emit stream and time_to_first_token stages#28970jscottmiller wants to merge 1 commit into
jscottmiller wants to merge 1 commit into
Conversation
This was referenced Sep 4, 2026
jscottmiller
force-pushed
the
scott/chatd-stages/2-stage-tracer
branch
from
September 9, 2026 23:19
95c1126 to
c2a8273
Compare
jscottmiller
force-pushed
the
scott/chatd-stages/3-stream-stages
branch
from
September 9, 2026 23:19
77d9e3c to
54d3777
Compare
jscottmiller
force-pushed
the
scott/chatd-stages/2-stage-tracer
branch
from
September 11, 2026 02:25
c2a8273 to
f5bfc09
Compare
jscottmiller
force-pushed
the
scott/chatd-stages/3-stream-stages
branch
from
September 11, 2026 02:25
54d3777 to
3e6c03c
Compare
…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
force-pushed
the
scott/chatd-stages/2-stage-tracer
branch
from
September 11, 2026 19:17
f5bfc09 to
0643175
Compare
jscottmiller
force-pushed
the
scott/chatd-stages/3-stream-stages
branch
from
September 11, 2026 19:17
3e6c03c to
bf4b80a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GenerateAssistantrecords astreamstage from stream open to close and a nestedtime_to_first_tokenstage that closes on the first streamed part. The TTFT window is closed exactly once throughfinishTTFT; a window released without a part ends witherrNoFirstTokenand no histogram observation, which is the same population the pre-existingcoderd_chatd_ttft_secondshistogram already recorded. The attempt is released before the stream span ends so the TTFT window is never counted outside the stream that contains it.Callers pass a
Stagestracer and aStageModelthroughGenerateAssistantOptions; a nil tracer discards.Part of the chatd lifecycle observability stack: 1 extract step · 2 stage tracer · 3 stream stages · 4 provider attempts · 5 turn span · 6 capacity wait · 7 turn accounting · 8 dashboard. Supersedes the experimental branch in #28741.
🤖 This PR was generated by Coder Agents on behalf of @jscottmiller.