When Compaction Is Not Enough: Run Safety with Diagnostics
Compaction is pressure relief, not permission to run forever. This afternoon we added explicit per-prompt and per-turn token budgets so a Harness loop or tool-heavy agent stops at an explainable boundary before provider limits and invoices become the control plane.
Two Budgets Answer Two Questions
MaxPromptInputTokens asks whether one constructed request is safe to send. It is the final rung of the ladder and defaults to the known model window. PerTurnMaxInputTokens asks whether the entire user turn has consumed too much input across repeated model calls.
The second budget matters for agents that iterate. Ten individually valid prompts can still represent an unreasonable turn. FabrCore accumulates token use through the run-safety scope, so the Harness does not need a separate accounting mechanism.
Stop with Evidence
The default behavior is StopWithDiagnostic. When a budget is exhausted, FabrCore raises a structured stop with the configured limit, observed use, and relevant prompt metrics. Monitors receive the same run-safety information, including the largest prompt seen during the turn.
That distinction helps both developers and users. "The model failed" invites blind retries. "This turn exceeded its 200,000-token input budget after seven calls" points to a specific tool payload, plan shape, or configuration decision.
Tune at the Model, Override at the Agent
Most teams should establish budgets on the model configuration so every agent using that model inherits a coherent window. Exceptional workloads can override them with underscore-prefixed agent arguments. The resolved ladder always reflects the effective values after defaults, model settings, and agent overrides are combined.
For Harness workloads, pair token budgets with iteration and delegation limits. One controls model consumption; the others control behavioral fan-out. Together they create a bounded definition of "keep working until done."
A stopped run is observable and resumable by application policy. It is not a silent truncation and it does not claim the task completed.