Monthly spend cap per workspace and job
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- backend, fintech-quant, frontend
Research direction
Start by reading the run-cost display and token-limit implementation, then trace how jobs are started and scheduled. The issue does not name files or tests, so first locate those entry points and check how recent run costs are stored. Done means showing a pre-run estimate and enforcing a weekly or monthly workspace or job spend cap with a clear reason when a run is stopped or skipped.
Written by the indexing model from the issue text.
Description
Problem
Model spend shows only after runs finish. Run limits cap tokens per run, but nothing caps total spend over time. Testers asked how to stop a job from spending more than a set amount.
The cost estimate part of the original idea moved to #156.
Proposal
- Levels: an owner can set a monthly cap on the workspace and on each job. Both apply. A run must fit under every cap that is set.
- Period: the calendar month in UTC. Spend is the sum of
cost_usdof runs created in that month. - Enforcement: checked when a run would start. A run over a cap does not start. It ends with a clear reason, for example "This job reached its $20 monthly spend cap." Scheduled and manual runs are treated the same.
- Runs in progress: they are not stopped. The per-run token budget already bounds them, so spend can pass the cap by at most one run per job.
- Unpriced runs: runs without a known cost count as zero. The cap screen says when some runs this month are unpriced.
- Editing: follows
Action.CHANGE_RUN_LIMITS, like other run limits. No cap is set by default. - Display: the limits screen shows the cap, this month's spend, and when the period resets.
Out of scope
- Cost estimates (#156).
- Weekly or rolling periods.
- Alerts before reaching the cap.
- Server-wide caps.
Acceptance criteria
- A run that would start over the workspace or job cap does not start, and the run shows why.
- Spend resets at the start of each UTC month.
- Runs already running are not stopped when the cap is reached.
- Unpriced runs count as zero and are called out on the cap screen.
-
.secondshift.yamlcannot set or raise a cap. - Only users allowed to change run limits can change caps.
- Dominant language
- Python
- Stars
- 1
- Forks
- 1
- Avg merge
- 1h 9m
- Merged PRs (30d)
- 322
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from piotrekno1/second-shift
-
code-review secondshift
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
piotrekno1/second-shift#419 ·
Maintainers usually reply within 1 day
-
area: deployment
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
piotrekno1/second-shift#310 ·
Maintainers usually reply within 1 day
-
code-review secondshift
Difficulty 4/5 3-5 days Newbie friendliness 46/100
piotrekno1/second-shift#421 ·
Maintainers usually reply within 1 day
-
code-review secondshift
Difficulty 4/5 3-5 days Newbie friendliness 56/100
piotrekno1/second-shift#420 ·
Maintainers usually reply within 1 day
-
Fix failed-delivery retries on PostgreSQLPossibly taken @piotrekno1 claimed this today. Opencode-review fix-approved secondshift
Difficulty 3/5 1-2 days Newbie friendliness 35/100
piotrekno1/second-shift#418 ·
Maintainers usually reply within 1 day
All issues in piotrekno1/second-shift
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 1 day
-
area:cli area:security enhancement priority:medium size:small
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
RonaldHensbergen/composable-data-stack#1338 ·
Maintainers usually reply within 1 day
-
area:stdlib effort:S impact:med platform:linux type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
automated endpoint-dead needs-curation
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
almanac-data/climate-almanac#139 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
UKGovernmentBEIS/inspect_ai#6695 · 1 comment ·
Maintainers usually reply within 1 day