PaSSw0rds' Team account (#1476) has on-demand turned on for the whole
organization: spendLimitUsage has no individualLimit, pooledLimit
"45120000" and pooledRemaining "38785730" are int64 strings, pooledUsed
6334270 a number, and GetHardLimit answers {"hardLimit": 451200} with or
without a team id. cursorOnDemandOf read that as unlimited, as
cursor-agent's own usage view does, so On-demand showed only the member's
$198.55 at 0%, aside, and a spent team pool never counted the account
used up; magpie would keep routing to it until Cursor refused.
Now a team member with no individualLimit and a pooledLimit > 0 gets a
fixed On-demand window on the pool: used = pooledUsed / pooledLimit,
display "$63,342.70 / $451,200.00 (you: $198.55)", not aside. A hard
limit that forbids on-demand still reads as disabled, and a team with no
pool and a hard limit still as unlimited. Dollar figures group thousands
(cursorDollars), as plugin 0.2.10 does. This is the built-in, for users
who haven't moved to the plugin; moved users get the same from
@magpie-community/opencode-cursor-auth 0.2.10 (next commit raises the
mover's min).
Run, under a sandbox HOME with pinned caches: go test -tags nogui
./internal/provider/ (ok); gofmt -l; go vet ./... on darwin,
GOOS=linux -tags nogui and GOOS=windows (clean).
Broken by hand: with the old cursor_usage.go,
TestCursorOnDemandKeepsTheAccount/a_team's_org-wide_on-demand_pool_is_the_allowance
fails (On-demand "$198.55", used 0, aside; the spent pool "used up
false"); with a fix that puts the member's spend against the pool, it
fails too. Built from the payloads quoted in #1476. Not tried against a
real Team account.