fix: address chat lifecycle hook UAT findings - #27551
Closed
ibetitsmike wants to merge 6 commits into
Closed
Conversation
The pointer and GOAWAY branches were unreachable. net/http bundles its own HTTP/2 types and h2_error.go bridges only the struct form of a stream error, so errors.As never matched the other three targets. Their test coverage asserted x/net values that production never produces. Also correct the stale-input window in the hooks docs: a batch dispatches sequentially before the assistant row commits, so the bound scales with the number of tool calls rather than one timeout.
Contributor
Docs previewCheck off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here. |
Collaborator
Author
|
Closing: these fixes belong in the existing stack PRs, not in follow-ups. Folding them in place:
|
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.
Stack Context
This stack adds chat lifecycle hooks (#27401 → #27428 → #27429 → #27430). Full UAT against the stack tip surfaced defects that are in scope for the feature but not yet fixed. This PR carries the self-contained ones.
It sits on top of the stack rather than in the PRs the fixes logically belong to, because those heads already carry green CI and completed reviews. The stack merges together, so placement here changes nothing about what ships.
What?
Five independent fixes, one per commit:
coderd/util/xnetcoderd/x/agenthooksexecutelabelsiteRan cat, as if it had executedsitedocsWhy?
HTTP/2 retry.
Dispatcher.postretries only whenxnet.IsConnectionErroris true. An aborted response mid-request classifies asconnection_errorover HTTP/1.1 and is retried, but over HTTP/2 it arrives as a stream error, classifiedprotocol_error, and the chat turn fails. Go's default transport negotiates h2 against any TLS consumer, so this is the common deployment shape, not an edge case.Only transient codes (
NO_ERROR,INTERNAL_ERROR,REFUSED_STREAM,CANCEL,ENHANCE_YOUR_CALM) are treated as retryable.PROTOCOL_ERRORand friends stay terminal so a malformed consumer response is not retried. The retry reuses the dispatch ID, which the consumer contract already requires to be idempotent.Worth noting for review:
net/httpbundles its own HTTP/2 implementation with unexported error types.net/http/h2_error.gobridges only the struct form of a stream error tox/net/http2, so a pointer target or a GOAWAY target never matches. The check is deliberately narrow for that reason, and a test drives a real h2 server rather than asserting against syntheticx/netvalues that production never produces.Denied
executelabel. #27430 already fixed this misrepresentation forwrite_fileandedit_files.executewas the missed case. The label derives fromisError(the tool-result protocol flag), not from the execute result'ssuccessfield, so a real command that ran and exited non-zero correctly keeps its "Ran" wording.Convergence docs. A batch dispatches sequentially before the assistant row commits, so the first call's original input stays visible until the whole batch is admitted. The bound scales with the number of tool calls in the step, not a single
CODER_CHAT_HOOK_TIMEOUT.Testing
go test -race ./coderd/util/xnet/... ./coderd/x/agenthooks/...pnpm lint:types,pnpm lint:compiler,pnpm run lint-docs.