Skip to content

refactor(coderd/x/chatd): delete the write-only generatedChatTitle - #30926

Draft
ibetitsmike wants to merge 3 commits into
mainfrom
mike/chatd-generated-title-seam
Draft

ibetitsmike wants to merge 3 commits into
mainfrom
mike/chatd-generated-title-seam

Conversation

@ibetitsmike

Copy link
Copy Markdown
Collaborator

Deletes generatedChatTitle, a mutex-guarded cell in which maybeGenerateChatTitle stored each generated title so that tests could read it. Production passed a fresh one and never read it. The PR removes the type, its Store and Load methods, the parameter, and the five Load checks in the title tests.

Why it is safe

git grep generatedChatTitle finds nothing. Each removed Load check has a remaining check on the stored chat row or the published event:

Removed check Remaining check
WritesGeneratedTitle: title stored stored title and source, title_change event
KeepsCurrentTitleWhenNoTitleIsWritten, both cases: nothing stored stored title unchanged, no publish
TestQuickgenFollowsConfiguredRetries/Title: nothing stored model call failed and TitleGenerationOverrideCallFailure cover the same return
TitleGenerationOverrideSetUsable: title stored gomock expects the exact UpdateChatTitleByID
TitleGenerationOverrideCallFailure: nothing stored gomock fails on any UpdateChatTitleByID

One gap needed a test change. If the return after a refused title write is dropped, the code publishes the zero updatedChat on the nil owner's channel, which the test's owner subscription never sees. On main only the observer caught that (quickgen_internal_test.go:688). The two no-write cases now use a psmock pubsub with no expectations, so any publish fails them.

Mutants of maybeGenerateChatTitle (go test -overlay) and the tests they fail:

Mutant Fails
no return after a refused write write refused by a rename during the call
no return after a failed model call model call failed, TitleGenerationOverrideCallFailure
writes title + "!" WritesGeneratedTitle, TitleGenerationOverrideSetUsable, TestMaybeGenerateChatTitleAppliesModelConfigReasoningEffort
no publishChatPubsubEvent WritesGeneratedTitle

Review focus

The mock in the two no-write cases is stricter than the old owner subscription: a publish on any channel fails.

Validation

  • go test ./coderd/x/chatd/ -count=1 -race -run 'Title|Quickgen': pass.
  • Mutants: each fails as listed, and the first passes with only the observer removed. A copy with a syntax error fails to build, so the overlay applies.
  • The pre-commit hook (make pre-commit: gen, fmt, lint/go, lint/go/new-code, slim build) passed.

Xum, an AI agent, opened this PR for @ibetitsmike and wrote this description.

maybeGenerateChatTitle stored each generated title in a
generatedChatTitle so that tests could read it back. Production passed
a fresh one and never read it.

The tests already check the stored title and the title_change event.
The cases that write no title now use a pubsub mock that fails on any
Publish. Without that, dropping the return after a refused title write
would go unnoticed: it publishes an empty chat on the nil owner's
channel, which the owner subscription never sees.
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 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-18T17:06:03.843389Z 015567c Manual request
ℹ️ 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. Hooray!

Reviewed commit: 62096917cf

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

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum, an AI agent, requested this review for @ibetitsmike.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 015567c9e1

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant