mirror of
https://github.com/garrytan/gstack.git
synced 2026-08-08 23:36:06 +02:00
chore: cap audit — remove distill rate cap, loosen size/budget gates
Plan-tune cathedral follow-up. The 3/day distill cap was theatrical: at ~$0.01 per Haiku call, even a runaway loop firing every minute would cost ~$14/day, and free-text events are rare enough that the natural input rate self-limits to 1-2 fires/day. Count caps don't protect against runaway bugs (which fire 1000x/second, not 4 times/day) but DO punish heavy users who'd legitimately distill multiple times during a busy week. Removed: 3/day rate cap on bin/gstack-distill-free-text. --status output swapped from "TODAY: N / 3" to "TODAY: N run(s), $X" so users see what they're spending instead of how close they are to a meaningless count. Loosened (caps that exist for real-runaway protection, not normal scope): - EVALS_BUDGET_HARD_CAP_GATE $25 → $200/run - EVALS_BUDGET_HARD_CAP_PERIODIC $70 → $500/run - EVALS_BUDGET_HARD_CAP $30 → $300/run (umbrella fallback) - GSTACK_SIZE_BUDGET_RATIO 1.05 → 1.50 per-skill ratio - plan-review preamble byte budget 40K → 60K Principle: caps exist to catch obvious bugs (infinite retry, model price change, prompt blowup), not to gate legitimate scope growth. Set high enough that real growth never trips them, only bug territory does. Adjusted defaults are 4-8× historical worst case, leaving ample headroom for the next 12 months of legitimate expansion. Tests updated: distill-free-text removes the 3-test rate-cap describe block in favor of "no rate cap" assertion that 10 runs/day pass. Other budget tests still pass because they were never near the old ceilings. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
401a3258a3
commit
e9ad7527ea
@@ -104,44 +104,22 @@ describe('--status', () => {
|
||||
const r = run(['--status']);
|
||||
expect(r.status).toBe(0);
|
||||
expect(r.stdout).toContain('RUNS: 2');
|
||||
expect(r.stdout).toContain('TODAY: 2 / 3');
|
||||
expect(r.stdout).toMatch(/TODAY: 2 run\(s\)/);
|
||||
});
|
||||
});
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Rate cap (D7)
|
||||
// No rate cap (v1.52.0.0 cap audit) — the natural rate of free-text events
|
||||
// is rare enough that count-based capping was theatrical. Cost log alone
|
||||
// provides auditability via --status.
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
describe('rate cap (3/day per slug)', () => {
|
||||
test('exits with RATE_CAPPED when 3 runs already logged today', () => {
|
||||
describe('no rate cap (audit removed)', () => {
|
||||
test('never exits with RATE_CAPPED, even with many runs today', () => {
|
||||
const today = new Date().toISOString();
|
||||
writeCostLogEntry(cwdSlug, today);
|
||||
writeCostLogEntry(cwdSlug, today);
|
||||
writeCostLogEntry(cwdSlug, today);
|
||||
for (let i = 0; i < 10; i++) writeCostLogEntry(cwdSlug, today);
|
||||
const r = run([]);
|
||||
expect(r.status).toBe(0);
|
||||
expect(r.stdout).toMatch(/RATE_CAPPED/);
|
||||
});
|
||||
|
||||
test('yesterday runs do not count against today cap', () => {
|
||||
const today = new Date().toISOString();
|
||||
const yesterday = new Date(Date.now() - 25 * 60 * 60 * 1000).toISOString();
|
||||
writeCostLogEntry(cwdSlug, yesterday);
|
||||
writeCostLogEntry(cwdSlug, yesterday);
|
||||
writeCostLogEntry(cwdSlug, yesterday);
|
||||
writeCostLogEntry(cwdSlug, today);
|
||||
const r = run([]);
|
||||
// Not capped — proceeds past the cap check; will hit NO_LOG next.
|
||||
expect(r.status).toBe(0);
|
||||
expect(r.stdout).not.toMatch(/RATE_CAPPED/);
|
||||
});
|
||||
|
||||
test('other slugs in cost log do not count against this slug', () => {
|
||||
const today = new Date().toISOString();
|
||||
writeCostLogEntry('other-slug', today);
|
||||
writeCostLogEntry('other-slug', today);
|
||||
writeCostLogEntry('other-slug', today);
|
||||
const r = run([]);
|
||||
expect(r.stdout).not.toMatch(/RATE_CAPPED/);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user