Skip to content

fix(coderd): return database errors at chat create and subagent spawn - #30449

Merged
ethanndickson merged 2 commits into
mainfrom
ethanndickson/codagt-1330-create
Oct 11, 2026
Merged

ethanndickson merged 2 commits into
mainfrom
ethanndickson/codagt-1330-create

Conversation

@ethanndickson

Copy link
Copy Markdown
Member

Relates to CODAGT-1330

chatd stores the deployment and organization system prompts in a chat when it's created. If either read failed, we'd log it and use the built-in default, or skip the organization prompt, so the chat ignored the admin's instructions for its whole life. The subagent model override had the same problem, and the compaction and advisor overrides quietly fell back to the chat model for that turn.

To fix, we'll just return the database error instead. Overrides that can't be used, e.g. the model was deleted or the user has no API key for its provider, still fall back like they do today.

Chat create and subagent spawn store the system prompt and the model
override for the life of the chat. When those reads failed, chatd
logged the error and stored a default, so the chat ignored the admin
settings forever. Return the error instead.

The model override resolver now only has policy for unusable overrides
(missing, disabled, not visible, or no credentials). A failed database
read always returns an error.

Part of CODAGT-1330
@linear-code

linear-code Bot commented Oct 7, 2026

Copy link
Copy Markdown

CODAGT-1330

@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-07T03:37:22.614684Z 9f94570 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: a9ae33029c

ℹ️ 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".

Rename ignoreUnavailable and ignoreMissingCredentials to failIfUnavailable and failIfNoProviderKey, so only the callers that stop on an unusable override set a flag. Behaviour is unchanged.
@ethanndickson
ethanndickson merged commit 807878c into main Oct 11, 2026
35 checks passed
@ethanndickson
ethanndickson deleted the ethanndickson/codagt-1330-create branch October 11, 2026 22:53
ethanndickson added a commit that referenced this pull request Oct 11, 2026
…0492)

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.
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants