fix: remove chatd usage limit enforcement - #27535
Conversation
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.
There was a problem hiding this comment.
observation: this actually tests the interaction between compaction and usage limit.
There was a problem hiding this comment.
Should we adapt these tests to integrate with AI Gateway? Not now, but as a potential follow-up.
There was a problem hiding this comment.
100% yes, this was just where the knife landed.
| require.Equal(t, []string{"hello", "queued", "later queued"}, userTexts) | ||
| } | ||
|
|
||
| func TestEditMessageRejectsWhenUsageLimitReached(t *testing.T) { |
There was a problem hiding this comment.
Interesting test...I haven't used the edit functionality in agents, I assume this just creates a new message (based on the edited message), which means a new request in AI Gateway, so the spend is accumulated. Should work without any problems I would say 🤔
There was a problem hiding this comment.
Yep, that's how editing works!
| }) | ||
| } | ||
|
|
||
| func TestCompactChat(t *testing.T) { |
There was a problem hiding this comment.
Should we adapt these tests to integrate with AI Gateway? Not now, but as a potential follow-up.
Documentation Check
Updates Needed
Not flagged: Automated review via Coder Agents |
There was a problem hiding this comment.
Pull request overview
This PR removes server-side enforcement of chat usage/spend limits in chatd by turning the limit check into a no-op and deleting tests/mocks that assert the previous rejection behavior.
Changes:
- Make
(*Server).checkUsageLimit(...)always returnnil, effectively disabling limit enforcement in chatd. - Remove chatd unit tests that expected
UsageLimitExceededErrorduring create/edit/compaction flows. - Remove gomock expectations for
GetChatUsageLimitConfigin internal chat title tests now that the limit check no longer queries it.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

This PR surgically removes enforcement of Agents spend limits: