Thanks to visit codestin.com
Credit goes to github.com

Skip to content

refactor(coderd/x/chatd): extract runGenerationStep from StartGeneration - #28968

Draft
jscottmiller wants to merge 1 commit into
mainfrom
scott/chatd-stages/1-extract-step
Draft

refactor(coderd/x/chatd): extract runGenerationStep from StartGeneration#28968
jscottmiller wants to merge 1 commit into
mainfrom
scott/chatd-stages/1-extract-step

Conversation

@jscottmiller

@jscottmiller jscottmiller commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Moves the body of the for loop in StartGeneration into runGenerationStep, which returns the input for the next step and whether the caller must reload state and run another. Control flow, error wrapping, and cleanup() placement are unchanged; each continue becomes again == true and each return becomes a return from the step.

This is a pure extraction. It gives the next PRs in the stack a function boundary for a per-step deferred span end.


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.

Move the body of the StartGeneration loop into runGenerationStep, which
runs one step of a turn and reports whether the caller must reload
state and run another. The loop keeps only state loading and the
continue/return decision. Every return path maps one to one onto the
previous inline code, so behavior is unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

experimental Changes that might not necessarily be merged, until its approved to proceed with.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant