Widen agent step-cap margin to 10 min (0.2.8): cold setup can't cancel the job - #5
Merged
Conversation
…l the job The Run-agent step cap is derived as `job − AGENT_STEP_FALLBACK_MARGIN` so an over-running agent fails its STEP (leaving the job un-cancelled and the salvage epilogue reachable) rather than tripping the job cap (#12545). But that single margin has to clear TWO things the step cap does not: the `Setup agent toolchain` step that runs BEFORE the agent (a cold-cache toolchain install is ~7 min) and the commit/push/open-PR salvage AFTER it. At a 5-min margin a ~7-min cold setup consumed the agent's window and the JOB cap fired mid-agent — cancelling the job and skipping the `!cancelled()` salvage (#12611: sentry_sweeper cancelled at 1/3 on a cold run). Separately, the tight derived step cap left prose-heavy scheduled lanes (e.g. retro at job=20 → step=15) cut off before they could self-verify, publishing unverified output. Raise AGENT_STEP_FALLBACK_MARGIN 5 → 10 (covers a ~7-min cold setup + ~3-min salvage) and raise the three agent-step lane defaults by the same +5 — producer 30→35, pr-fix 30→35, scheduled-agent 15→20 — so every DERIVED step cap is unchanged from the old behavior while every job now carries 10 min of setup headroom. Non-regressive for consumers on defaults; consumers raise `timeout=` to buy the agent more working time (the margin stays 10). Tests updated for the new job caps (step caps unchanged) plus a new assertion that the job−step margin is exactly 10 across producer/pr-fix/scheduled-agent. Documents the previously-undocumented `timeout=` attr and the margin in node-types.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problem
The Run-agent step cap is derived as
job − AGENT_STEP_FALLBACK_MARGIN, so an over-running agent fails its step (job stays un-cancelled, the!cancelled()salvage still commits/pushes/opens the PR) instead of tripping the job cap (#12545). But that one margin has to clear two things the step cap doesn't:Setup agent toolchainstep that runs before the agent — a cold-cache toolchain install is ~7 min; andAt a 5-min margin, a cold setup (>5 min) means the agent step can never reach its own cap before the job cap fires → the job is cancelled mid-agent and the salvage is skipped. Observed downstream as #12611 (sentry_sweeper cancelled at 1/3 on a cold run). Separately, the tight derived step cap cut off prose-heavy scheduled lanes before they could self-verify (a retro at
job=20 → step=15timed out and published an unverified note that then thrashed review).Fix
AGENT_STEP_FALLBACK_MARGIN5 → 10 — covers a ~7-min cold setup with ~3 min of salvage headroom, so the agent reliably fails its step rather than the job.Raise the three agent-step lane defaults by the same +5 so every derived step cap is unchanged, only the setup headroom grows:
Lanes without an agent step cap (
analyst/pr-review,merge-gate,fan_in) are untouched.Non-regressive: any consumer relying on defaults keeps the exact same step caps and simply gains 10 min of setup headroom. Consumers raise
timeout=to give the agent more working time — the margin stays 10. (Downstream, the range harness will bumpretrototimeout=30for a 20-min step, resolving the unverified-retro class.)Tests / docs
test/agent-step-timeout.test.ts: updated job caps (step caps unchanged) + a new assertion thatjob − step === 10across producer/pr-fix/scheduled-agent.timeout=attr and the margin semantics inskill/reference/node-types.md.