Skip to content

flake: TestRegenerateChatTitle/PasteOnlyChat #1629

Description

@flake-investigator

CI failure details

Failure evidence

=== FAIL: coderd TestRegenerateChatTitle/PasteOnlyChat (3.64s)
...
coderd.aibridged.pool: route not supported
  path=/test-openai-c2fd95bc-df90-4e1c-911a-d11d8d5a06b6/v1/responses
  method=POST
...
exp_chats_test.go:9733:
  Error: POST .../title/regenerate: unexpected status code 500:
    Failed to regenerate chat title.
    Error: generate manual title: generate structured title: not found:
      route not supported: POST /test-openai-c2fd95bc-df90-4e1c-911a-d11d8d5a06b6/v1/responses

Error analysis

The test creates an OpenAI provider/model config and immediately calls RegenerateChatTitle. The in-process AI Gateway pool had just logged provider_count=0; its asynchronous provider snapshot reload had not incorporated the newly created route before the title request arrived. The request therefore hit the generated provider path before that route existed and returned HTTP 500.

The test helper createAdditionalChatModelConfigWithModelConfig waits for the HTTP create operation, but it does not synchronize with the AI Gateway pool reload. Because PasteOnlyChat runs in parallel, timing determines whether the route is ready.

Root cause

Classification: flaky test / asynchronous AI Gateway route-registration race. This is not caused by the commit under test.

No WARNING: DATA RACE, panic, OOM, resource-exhaustion, or abnormal process-termination evidence was present. This was a non-race test job and the test process completed normally with two distinct assertion failures in the overall run.

Assignment analysis

Intended blame/history commands:

git blame -L 9721,9741 coderd/exp_chats_test.go
git log --oneline -10 --follow coderd/exp_chats_test.go

TestRegenerateChatTitle/PasteOnlyChat, seedPasteOnlyTitleSourceMessage, and the paste-aware manual title path were introduced by 2ad5af5b54d9b371d9b7e9d17657fe2cec73d111 (fix(coderd): use pasted-text attachments as chat title input) by Michael Suchacz. Assigning to ibetitsmike as the test/function owner. The failing run author is unrelated.

Duplicate search

No matching issue was found after searches for:

  • TestRegenerateChatTitle/PasteOnlyChat
  • TestRegenerateChatTitle
  • route not supported + title
  • exp_chats_test.go + regenerate
  • related panic/OOM/process-crash and data-race signatures

Related but different failure mode: #1481 (TestRegenerateChatTitle/RegenerationFailure, status wait timeout).

Suggested fix direction

After creating/updating the AI provider and model config, wait until the in-process AI Gateway pool has reloaded the provider route before invoking title generation, or construct this test with a synchronously registered route/fake transport.

Reproduction

go test ./coderd -run 'TestRegenerateChatTitle/PasteOnlyChat' -count=100

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions