fix(coderd/x/chatd/chattool): make edit_files schema and errors actionable for models - #28121
Open
ibetitsmike wants to merge 2 commits into
Open
fix(coderd/x/chatd/chattool): make edit_files schema and errors actionable for models#28121ibetitsmike wants to merge 2 commits into
ibetitsmike wants to merge 2 commits into
Conversation
…nable for models A dev.coder.com chat failed 57 consecutive edit_files calls because the model omitted files[].path and the relayed error was an opaque agent API transport error. Describe every schema field, validate entries before calling the agent with entry-indexed messages, and strip HTTP method/URL/status noise from agent API errors.
…t_files Validate entries before plan-turn checks and connection lookup, keep Helper and Validations in relayed agent API errors, and deduplicate the schema and malformed-input tests.
Collaborator
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
DanielleMaywood
approved these changes
Aug 13, 2026
DanielleMaywood
left a comment
Contributor
There was a problem hiding this comment.
I'm slightly hesitant with some of the changes because Mathias spent a lot of time tweaking this but as long as we track the before & after I'm fine
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.
Problem
Chat
45b87e40-ffe7-49e5-8932-5fd0bdb9e542on dev.coder.com failed 57 of 75edit_filestool calls. Every failure was the same: the model omittedfiles[].path(it batched edits per file but only filled inedits), and the error relayed back to the model was:The model retried the identical malformed call dozens of times. Two gaps made this sticky:
edit_filesinput schema had no field descriptions, sopathwas only a bare required property.filesentry was broken.Changes
descriptiontags to everyedit_filesschema field and state the path requirement in the tool description.filesentries in the tool before plan-turn checks and the workspace connection lookup, returning entry-indexed errors such asfiles[1].path is required; provide the absolute path of the file to edit; no files in this batch were applied.Message,Helper,Detail, andValidationsfromcodersdk.Errorinstead of the raw transport-prefixed string.Validation
go test ./coderd/x/chatd/chattoolpasses; new tests cover the schema description, entry-indexed validation errors, and transport-noise stripping (each verified red-green by toggling the fix off).go build ./...,go vet, and pre-commit (fmt + lint) pass.