Repository navigation
fix(coderd/x/chatd): return database errors from turn preparation - #30492
ethanndickson merged 1 commit into
Conversation
Turn preparation logged failed reads of the user prompt, plan mode instructions, personal skills, advisor config, compaction threshold, MCP server configs and MCP tokens, then ran the turn without them. Return the errors instead, so the prepare retry runs and the chat shows an error if the reads keep failing. The provider switch history sanitizer and the cancel of deleted tool calls also return their database errors now. Part of CODAGT-1330
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f3fa22bdd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| mcpConfigs, err = server.effectiveMCPServerConfigs(ctx, chat) | ||
| return err |
There was a problem hiding this comment.
Keep preparation database failures retryable
When the selected MCP-config read fails, this returns the raw database error; after retryGenerationPhase exhausts its three attempts, runGenerationStep does not recognize it as errTaskRetryable and calls finishGenerationError, permanently moving every affected chat to an error state during an outage. The same regression applies to the other newly propagated preparation reads. Database connection failures are required to be retried by the runner without a fixed limit (coderd/x/chatd/ARCHITECTURE.md:1008-1020), so exhausted preparation failures should be classified as task-retryable rather than persisted as user-visible chat errors.
AGENTS.md reference: AGENTS.md:L42-L43
Useful? React with 👍 / 👎.
|
@codex review The mechanics here are right, but this isn't new to this PR. I agree prepare doesn't follow the unlimited retry rule in |
|
Codex Review: Didn't find any major issues. Hooray! 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". |
Relates to CODAGT-1330
When chatd prepares a turn, it reads a bunch of things from the database: the user's custom prompt, plan mode instructions, personal skills, the advisor config, the user's compaction threshold override, MCP server configs, inline MCP servers, MCP user tokens and the pinned workspace MCP tools. If any of those reads failed, we'd log a warning and run the turn without them, so the model would quietly ignore the user's instructions or be missing tools for that turn.
To fix, we'll just return the error instead, so the prepare retry runs, and the chat shows an error if the reads keep failing. The provider switch history sanitizer and the cancel of deleted tool calls also return their database errors now. A model config that's unavailable, e.g. deleted, is still treated as foreign by the sanitizer like it is today.
An inline MCP server with invalid stored headers still shows up as a failed connect in the chat debug panel, but a failed read of the inline MCP servers themselves now fails the turn.
This PR is in a stack on top of #30449.