🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

fix(coderd/x/chatd/chaterror): classify aibridge 403 as ChatErrorKindUsageLimit - #27538

Merged
johnstcn merged 3 commits into
mainfrom
cj/chaterror/classify-aibridge-budget-exceeded
Jul 27, 2026
Merged

fix(coderd/x/chatd/chaterror): classify aibridge 403 as ChatErrorKindUsageLimit#27538
johnstcn merged 3 commits into
mainfrom
cj/chaterror/classify-aibridge-budget-exceeded

Conversation

@johnstcn

@johnstcn johnstcn commented Jul 27, 2026

Copy link
Copy Markdown
Member

Adds the string ai budget of to the classifier for ChatErrorKindUsageLimit.

Screenshot 2026-07-27 at 18 27 13

Testing notes:

  • I set the group limit by running insert into group_ai_budgets values ('<everyone group UUID>', 1, NOW(), NOW());

Created by a human, trimmed down by a Coder agent.

@johnstcn
johnstcn marked this pull request as ready for review July 27, 2026 17:29
Copilot AI review requested due to automatic review settings July 27, 2026 17:29
@johnstcn
johnstcn enabled auto-merge (squash) July 27, 2026 17:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates chat error classification in coderd/x/chatd/chaterror so AI budget exhaustion responses from AI Bridge are recognized as ChatErrorKindUsageLimit instead of being treated like auth failures.

Changes:

  • Extend usage-limit pattern matching to catch AI budget exceeded messages.
  • Add/adjust classifier pattern-coverage test cases for the new signal.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
coderd/x/chatd/chaterror/signals.go Adds a new substring signal for usage-limit detection across HTTP status codes.
coderd/x/chatd/chaterror/classify_test.go Adds a pattern-coverage test case to ensure the new usage-limit signal is classified correctly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread coderd/x/chatd/chaterror/signals.go Outdated
Comment on lines +74 to +76
// Hard usage exhaustion codes that fire at any HTTP status,
// including 429.
usageLimitAnyStatusPatterns = []string{"insufficient_quota"}
usageLimitAnyStatusPatterns = []string{"insufficient_quota", "ai budget"}
Comment thread coderd/x/chatd/chaterror/classify_test.go Outdated
@johnstcn
johnstcn disabled auto-merge July 27, 2026 17:33
johnstcn and others added 2 commits July 27, 2026 18:33
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@johnstcn
johnstcn enabled auto-merge (squash) July 27, 2026 17:40
@johnstcn
johnstcn merged commit daf655d into main Jul 27, 2026
31 of 32 checks passed
@johnstcn
johnstcn deleted the cj/chaterror/classify-aibridge-budget-exceeded branch July 27, 2026 17:54
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 27, 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.

3 participants