Repository navigation
feat: let organization admins configure the daily wake-up caps - #208
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 185de224c8
ℹ️ 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".
|
@codex review
|
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Merged by the pstack parity lead. fork-ci passed on head b6c1593. The Codex review state is clean (has_unresolved_findings=false) on 4139949, and since then the branch has only taken merges from main. 0 threads are unresolved. Ops ran the UAT on a branch build of b6c1593 and it passed:
Main is ahead of this branch only by #221, which changes site composer files this PR does not touch. Part of #4. Adds an ARCHITECTURE.md TODO for Mike. |
The daily wake-up caps (288 runs per chat, 2,880 per organization, $20 spend per chat, $200 per organization) were constants. With
fork-chat-wakeupson, an organization admin can now replace each cap withPUT /api/v2/chats/fork/organizations/{organization}/wakeup-capsand read the stored, default and effective caps withGET. Each cap can go higher or lower than its default, with a minimum of 1. A cap the organization does not set keeps its default. Spend is in millionths of a dollar, liketotal_cost_micros.A new chatdmig node adds
chatd.chat_organization_wakeup_caps: one row per organization, with nullable caps and a check that each set cap is at least 1. forkdb getsGet/UpsertChatOrganizationWakeupCaps, with dbauthz and dbmetrics wrappers. An upsert replaces the whole row, so an omitted cap goes back to its default.wakeupCapReachedincoderd/x/chatd/fork_wakeup_caps.goreads the organization row before each wake-up run. The pause notification names the cap in force, for example "the chat reached its daily spend limit of $1.50".The routes use the same RBAC as the organization subagent limits: read and update on
ResourceChatModelConfig.InOrg. A member gets 404, and an auditor can read but gets 403 on update.No UI.
Tests:
TestWakeupCapshas five new cases in which an organization lowers or raises a cap. IfwakeupCapReachedignores the organization row (through a-overlay), all five fail.TestForkChatOrganizationWakeupCapscovers defaults, raise and lower, validation, RBAC, and the experiment being off.TestForkQueriercovers the new dbauthz methods.I spliced the apidoc,
typesGenerated.tsand thedocs/reference/apipages from the generated output. Hand-written code, tests and docs total about 550 lines; the rest is generated.coderd/x/chatd/ARCHITECTURE.mdgets one TODO for the new table, for the author to fill in.Part of #4