Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: remove chatd usage limit enforcement (#27535) - #27599

Merged
mtojek merged 1 commit into
release/2.36from
cj/r236/rm-chatd-limit
Jul 28, 2026
Merged

fix: remove chatd usage limit enforcement (#27535)#27599
mtojek merged 1 commit into
release/2.36from
cj/r236/rm-chatd-limit

Conversation

@johnstcn

Copy link
Copy Markdown
Member

This PR surgically removes enforcement of Agents spend limits:

  • Adjusts the relevant function that checks usage to always return nil
  • Deletes tests that expect a usage limit error.

(cherry picked from commit 75fd7bc)

This PR surgically removes enforcement of Agents spend limits:
- Adjusts the relevant function that checks usage to always return nil
- Deletes tests that expect a usage limit error.

(cherry picked from commit 75fd7bc)
Copilot AI review requested due to automatic review settings July 28, 2026 16:43
@johnstcn johnstcn self-assigned this Jul 28, 2026
@johnstcn johnstcn added the cherry-pick/v2.36 Cherry-pick PR targeting release/2.36 label Jul 28, 2026
@coderagents

coderagents Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Documentation Check

Removing chatd usage-limit enforcement is a user-visible behavior change: the published docs still state that Coder Agents blocks messages when a user's spend limit is reached. Those statements are now inaccurate.

Updates Needed

  • docs/ai-coder/agents/platform-controls/usage-insights.md - The "Enforcement" section claims limits are "Checked before each chat message is processed" and that exceeding a limit returns 409 Conflict and blocks the message. With checkUsageLimit now a no-op, none of this happens. Rewrite to state that Coder Agents no longer blocks on these limits and that enforcement is handled by AI Gateway budgets, linking to Cost Controls. Also revisit the surrounding framing ("Usage limits cap how much each user can spend...", "the system checks the user's current spend before processing each chat message") so the configuration is described as tracking/reporting rather than capping.
  • docs/ai-coder/agents/platform-controls/index.md (§ Spend management, ~line 119) - "Administrators can set spend limits to cap LLM usage per user" no longer reflects behavior. Adjust the summary to match the corrected usage-insights.md.
  • docs/ai-coder/agents/platform-controls/advisor.md (~line 44) - "advisor calls are not metered against the root chat's usage limit" is now moot/confusing once enforcement is gone. Confirm the statement still means something (accounting vs. blocking) and reword or drop it.

Notes

  • No docs changes are needed for the deleted tests (coderd/exp_chats_test.go, coderd/x/chatd/*_test.go).
  • The ChatUsageLimitExceededResponse schema and spend-limit API/CLI reference pages are generated; no manual edits there.
  • This PR targets release/2.36 as a cherry-pick of fix: remove chatd usage limit enforcement #27535, and main docs are also still stale on this point. The doc fix should land on main and be backported to this release branch rather than only here.

Automated review via Coder Agents

@johnstcn
johnstcn requested a review from mtojek July 28, 2026 16:45

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

This PR removes chat usage-limit (budget) enforcement from chatd by turning the server-side limit check into a no-op and deleting tests that asserted limit-exceeded behavior, aligning enforcement responsibility with the AI Gateway.

Changes:

  • Replace Server.checkUsageLimit with a no-op implementation that always allows chat operations.
  • Delete/trim unit and integration tests that expected UsageLimitExceeded failures.
  • Remove gomock expectations for GetChatUsageLimitConfig in internal chatd title-generation tests.

Reviewed changes

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

Show a summary per file
File Description
coderd/x/chatd/chatd.go Makes checkUsageLimit always return nil, delegating enforcement to AI Gateway.
coderd/x/chatd/chatd_test.go Removes chatd runtime tests that assert operations are rejected at the usage limit.
coderd/exp_chats_test.go Removes API-level tests that assert chat endpoints return “usage limit exceeded” responses.
coderd/x/chatd/chatd_internal_test.go Removes usage-limit config DB expectations that are no longer triggered.
coderd/x/chatd/title_override_internal_test.go Removes usage-limit config DB expectation in title override tests.

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

@mtojek
mtojek merged commit c22ba3e into release/2.36 Jul 28, 2026
56 of 59 checks passed
@mtojek
mtojek deleted the cj/r236/rm-chatd-limit branch July 28, 2026 17:01
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cherry-pick/v2.36 Cherry-pick PR targeting release/2.36

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants