Repository navigation
feat(credit-floor): skip paid models when account credit is below threshold (#188) - #534
Merged
Merged
Conversation
Owner
|
方向对,默认关闭也合适,先不合并。有两处合进去会改到现有账号的调度:
这两处补上之后我再看。 |
nxcjs
added a commit
to nxcjs/cli2api
that referenced
this pull request
Nov 19, 2026
Address maintainer review on PR caigee-cmd#534: - gate only Unit=="credits" with CLI2API_CREDIT_FLOOR - add independent CLI2API_PERCENT_FLOOR for percent quota providers - expose per-account credit_floor/percent_floor overrides in console/API - keep explicit zero distinguishable from inherit, persist both overrides - cover cross-unit isolation and free-model exemption with tests Rebased onto main including account-import changes.
nxcjs
force-pushed
the
fix/credit-floor-188
branch
from
November 19, 2026 06:49
c91cd20 to
ac81234
Compare
Contributor
Author
|
把这些改动合并到 PR:
验证: |
nxcjs
force-pushed
the
fix/credit-floor-188
branch
5 times, most recently
from
November 19, 2026 12:05
26d3cea to
8ea2502
Compare
Contributor
Author
|
CI 失败已修好,刚强推更新了 PR 分支。 原因是我之前的提交没有把 这次重建为基于当前
验证:最新 CI run 44520683842 六个 job 全部 success。 |
nxcjs
force-pushed
the
fix/credit-floor-188
branch
6 times, most recently
from
November 19, 2026 17:40
f52d6a6 to
7b605bf
Compare
Rebuild static assets from current main + credit-floor feature. Keep unchanged CSS/images intact and replace only the five stale JS chunks.
nxcjs
force-pushed
the
fix/credit-floor-188
branch
from
November 19, 2026 17:45
7b605bf to
bb9e679
Compare
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #188 — workbuddy 账号调度保底
Implements the configurable credit floor the maintainer described in #188: when an account's remaining credit falls below a threshold, it is excluded from paid model scheduling but stays eligible for free models, so the account is never drained to zero (free models stop working too once credit hits 0).
What changed
CLI2API_CREDIT_FLOOR— global threshold, default0(disabled, existing behaviour unchanged).credit_flooroverride (console account card + management API), falling back to the global value.Why this shape
The maintainer's reply on #188 asked for "a configurable threshold". This keeps the default off, so no existing deployment changes behaviour unless the env var or account field is set.
Validation
go vet ./...— passgo test ./... -count=1— pass (29 packages, 0 failures)go build ./cmd/server— passgo test ./internal/app -run 'TestImportConstraints|TestDutyBoundaries'— passgo test -race ./internal/executor ./internal/store ./internal/config— passgit diff --checkandscripts/release-notes.py validate— passmainHEAD81665ac; no secrets in diff.