feat: opt-in wall-clock execution backstop (complements CPU-time budget)#89
Merged
Conversation
Deferred follow-up to #79's CPU-only F-001. Re-wires the dormant wall-clock TimeoutGuard as an INDEPENDENT, opt-in limit alongside the CPU-time budget. New env knob AGENT_OS_V8_WALL_CLOCK_LIMIT_MS (>0 to arm; unset/0 => off, no default). Unlike the CPU budget, the wall-clock backstop counts elapsed real time INCLUDING idle/await, so it can cap a guest that blocks or awaits indefinitely. Both guards can be armed at once; whichever fires first calls terminate_execution and the result frame reports which (ERR_SCRIPT_WALL_CLOCK_EXCEEDED vs ERR_SCRIPT_CPU_BUDGET_EXCEEDED). Off by default so long-lived ACP adapters are never killed by a wall-clock default; the CPU budget remains the primary guard. Threaded through the CreateSession/Start frame next to the CPU budget knob. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deferred follow-up to #79, which made F-001 a CPU-time budget only and left the wall-clock
TimeoutGuarddormant. This re-wires the wall-clock guard as an independent, opt-in limit that complements the CPU budget.What changed
AGENT_OS_V8_WALL_CLOCK_LIMIT_MS. When set (>0) it arms the wall-clockTimeoutGuardin the session execution path, alongside theCpuBudgetGuard. Threaded through theCreateSession/Start frame next to the existing CPU-budget knob (AGENT_OS_V8_CPU_TIME_LIMIT_MS).0normalizes toNone, so the guard is not armed and there is no wall-clock limit. Long-lived ACP adapters run indefinitely on wall-clock and are not killed by a default. The CPU budget remains the primary guard.terminate_execution. The recordedExecutionAbortReasonis authoritative (first-writer-wins), and the result frame attributes termination to the correct guard:ERR_SCRIPT_WALL_CLOCK_EXCEEDEDERR_SCRIPT_CPU_BUDGET_EXCEEDEDTests (bounded; fenced behind worker-thread + recv-timeout)
Added to the V8 integration suite:
Verification
cargo fmt --all --checkcleancargo build --workspacegreen