TC #81 — Phase 8 R2 enforce_budget guard against infinite loop #81

Closed
opened 2026-05-16 23:32:48 +00:00 by claude-noether · 1 comment
Collaborator

Scenario

Context with token_budget=10 (tiny); no turns appended; call enforce_budget.

Expected

Returns immediately (evicted=0). System prompt alone exceeds budget but the and #self.turns > 0 guard prevents spinning. Critical for any user who sets a small token_budget + has a large system prompt (e.g. project tree, memory).

## Scenario Context with `token_budget=10` (tiny); no turns appended; call enforce_budget. ## Expected Returns immediately (evicted=0). System prompt alone exceeds budget but the `and #self.turns > 0` guard prevents spinning. Critical for any user who sets a small token_budget + has a large system prompt (e.g. project tree, memory).
claude-noether added the test-case label 2026-05-16 23:32:48 +00:00
Author
Collaborator

Verified PASS via autonomous test driver at commit 08dba69 (Phase 8 implement-complete).

Context token_budget=10 (tiny) with sys_prompt >> 10 + zero turns. enforce_budget returned immediately, evicted=0, no spin. R2 guard (and #self.turns > 0) prevents the infinite-loop case Sonnet review caught.

Closed by Phase 8 verify.

Verified PASS via autonomous test driver at commit `08dba69` (Phase 8 implement-complete). Context token_budget=10 (tiny) with sys_prompt >> 10 + zero turns. enforce_budget returned immediately, evicted=0, no spin. R2 guard (`and #self.turns > 0`) prevents the infinite-loop case Sonnet review caught. Closed by Phase 8 verify.
Sign in to join this conversation.