Skip to content

fix(coderd/x/chatd): remember quickgen parameter rejections per model - #31493

Merged
deansheather merged 1 commit into
mainfrom
dean/codagt-1411-quickgen-side-jobs-make-3-rejected-requests-per-run-on
Nov 9, 2026
Merged

deansheather merged 1 commit into
mainfrom
dean/codagt-1411-quickgen-side-jobs-make-3-rejected-requests-per-run-on

Conversation

@deansheather

Copy link
Copy Markdown
Collaborator

On Claude Opus 5.5, chat title generation and the turn-status label each made four upstream requests, three of them rejected with a 400. The temperature retry in generateQuickgenObject called generateObject again, which restarted from the forced tool call the model had already rejected. Each turn left about six bad_request rows in aibridge_interceptions and added 1.5 to 3.5 seconds of latency.

This replaces the per-call fallbacks with quickgenParamModel, a wrapper applied in resolveModelCall. It falls back to plain JSON text when the model rejects the forced tool_choice, drops temperature when the model rejects it, and records each rejection in a replica-wide sync.Map keyed by AI provider ID, model, and parameter, following the existing thinkingDropBlock map. Entries expire after 6 hours so a provider that starts accepting a parameter again is picked up without a restart. Only quickgen calls GenerateObject, so chat turns are unaffected.

Opus 5.5 Before First job per replica (and after expiry) Later jobs
Title / status label 4 (3 rejected) 3 (2 rejected) 1
Summary 2 (1 rejected) 2 (1 rejected) 1

Rejections are still detected by matching tool_choice or temperature in a 400 body, as before. A false match now persists for the TTL on that replica rather than one job; the worst case is text mode or no temperature for that model.

Closes CODAGT-1411

Decision log
  • Opus 5.5 reports one rejected parameter per 400, so a job that knows nothing yet needs 3 requests; the issue's "2 requests" target for the minimal fix isn't reachable.
  • A per-job flag (first iteration) only got jobs to 3 requests. Sharing rejections across jobs gets steady state to 1 without a hardcoded model list, which wouldn't match gateway aliases such as Bedrock IDs anyway.
  • Per-replica memory over a database column or admin setting: no migration, no request-path writes, self-healing via TTL. Each replica pays the learning cost once per model per TTL window.
  • Keyed by provider ID plus model so the same model name behind different providers is learned independently.

Generated by Coder Agents on behalf of @deansheather.

On Claude Opus 5.5, title generation and the turn-status label each
made four upstream requests, three of them rejected with a 400: the
temperature retry restarted from a forced tool call the model had
already rejected.

Wrap resolved models in quickgenParamModel, which falls back to text
mode when the forced tool_choice is rejected and drops temperature
when it is rejected, recording each rejection per provider and model
in a replica-wide map with a 6 hour TTL. The first job on a replica
makes 3 requests; later jobs make 1.
@linear-code

linear-code Bot commented Oct 29, 2026

Copy link
Copy Markdown

CODAGT-1411

@deansheather
deansheather marked this pull request as ready for review November 9, 2026 10:56
@deansheather
deansheather temporarily deployed to main November 9, 2026 10:56 — with GitHub Actions Inactive
@ethanndickson

Copy link
Copy Markdown
Member

@codex review

@ethanndickson

Copy link
Copy Markdown
Member

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: 🔄 Running

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T11:24:03.996521Z f672b1a Manual request
🔒 Security Review 🔄 Running since 2026-11-09T11:35:06.348438Z f672b1a 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. Bravo.

Reviewed commit: f672b1adae

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

@deansheather
deansheather merged commit acbcd0e into main Nov 9, 2026
54 of 55 checks passed
@deansheather
deansheather deleted the dean/codagt-1411-quickgen-side-jobs-make-3-rejected-requests-per-run-on branch November 9, 2026 11:39
@deansheather
deansheather temporarily deployed to main November 9, 2026 11:39 — with GitHub Actions Inactive
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 9, 2026

This branch was previously deployed

1 inactive deployment
main — f672b1ad Deployed Nov 9, 2026 by deansheather via cla #252410
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