Skip to content

fix: protect budget headroom accounting (#1905)#1938

Open
svelderrainruiz wants to merge 1 commit into
issue/upstream-1905-runner-capability-matrixfrom
issue/upstream-1905-budget-headroom-guard
Open

fix: protect budget headroom accounting (#1905)#1938
svelderrainruiz wants to merge 1 commit into
issue/upstream-1905-runner-capability-matrixfrom
issue/upstream-1905-budget-headroom-guard

Conversation

@svelderrainruiz
Copy link
Copy Markdown
Contributor

Summary

  • harden receipt discovery so private source snapshots do not block cost-rollup materialization
  • surface whole-account remaining USD estimate and protected operational headroom in the GitHub budget hook
  • mark operator spendable budget as unreconciled when labor timing is incomplete

Testing

  • node --test tools/priority/tests/materialize-agent-cost-rollup.test.mjs tools/priority/tests/materialize-agent-cost-rollup-schema.test.mjs tools/priority/tests/github-comment-budget-hook.test.mjs tools/priority/tests/github-comment-budget-hook-schema.test.mjs
  • node tools/npm/run-script.mjs schema:validate -- --schema docs/schemas/github-comment-budget-hook-report-v1.schema.json --data tests/results/_agent/cost/github-comment-budget-hook.json
  • node tools/npm/run-script.mjs docs:manifest:validate
  • git diff --check

@svelderrainruiz
Copy link
Copy Markdown
Contributor Author

Published the budget correction slice behind #1937.

Highlights:

  • filters private source snapshots out of cost-rollup materialization so normalized receipts can pass cleanly
  • surfaces whole-account remaining estimate and protected operational headroom in the durable budget hook
  • stops treating the $50,000 operator cap as immediately spendable when labor timing is still incomplete

Validated with focused materialization + hook tests, schema validation, docs manifest validation, and git diff --check.

Budget hook: blended lower bound $0.020100; operator $0.000000 of $50000.000000 cap (spendable remaining unreconciled; lower bound >=$50000.000000); window invoice-turn-2026-03-HQ1VJLMV-0029 spent $0.020100 remaining $49.979900; account est $166.000000 remaining from 4150 credits @ $0.040000 per credit; operational headroom $66.000000 (reserve-near); pressure tight; turns 1 total (0 live, 0 background); 1 turn(s) still pending labor timing; calibration reserve $100.000000 across 1 held window(s). Receipt: tests/results/_agent/cost/github-comment-budget-hook.json.

@svelderrainruiz svelderrainruiz enabled auto-merge (squash) March 24, 2026 14:54
@svelderrainruiz
Copy link
Copy Markdown
Contributor Author

Budget assumption confirmed by the operator:

  • the earlier 2.9K remaining credits snapshot was pre-top-up
  • HQ1VJLMV-0029 adds 1250 credits / $50

Confirmed state for this slice:

  • $166 total remaining estimate
  • $100 protected calibration reserve
  • $66 operational headroom
  • pressure tight

Budget hook: blended lower bound $0.020100; operator $0.000000 of $50000.000000 cap (spendable remaining unreconciled; lower bound >=$50000.000000); window invoice-turn-2026-03-HQ1VJLMV-0029 spent $0.020100 remaining $49.979900; account est $166.000000 remaining from 4150 credits @ $0.040000 per credit; operational headroom $66.000000 (reserve-near); pressure tight; turns 1 total (0 live, 0 background); 1 turn(s) still pending labor timing; calibration reserve $100.000000 across 1 held window(s). Receipt: tests/results/_agent/cost/github-comment-budget-hook.json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant