Skip to content

Widen agent step-cap margin to 10 min (0.2.8): cold setup can't cancel the job - #5

Merged
dpup merged 1 commit into
mainfrom
fix/setup-margin-step-cap
Sep 8, 2026
Merged

Widen agent step-cap margin to 10 min (0.2.8): cold setup can't cancel the job#5
dpup merged 1 commit into
mainfrom
fix/setup-margin-step-cap

Conversation

@dpup

@dpup dpup commented Sep 8, 2026

Copy link
Copy Markdown
Member

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:

  1. the Setup agent toolchain step that runs before the agent — a cold-cache toolchain install is ~7 min; and
  2. the commit/push/open-PR salvage after it.

At 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=15 timed out and published an unverified note that then thrashed review).

Fix

  • AGENT_STEP_FALLBACK_MARGIN 5 → 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:

    lane job default derived step cap
    producer 30 → 35 25 (unchanged)
    pr-fix 30 → 35 25 (unchanged)
    scheduled-agent 15 → 20 10 (unchanged)

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 bump retro to timeout=30 for 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 that job − step === 10 across producer/pr-fix/scheduled-agent.
  • Full suite green (432 passing).
  • Documents the previously-undocumented timeout= attr and the margin semantics in skill/reference/node-types.md.
  • Version bumped to 0.2.8 (adjust if your release flow bumps separately).

…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>
@dpup
dpup merged commit bd66415 into main Sep 8, 2026
3 checks passed
@dpup
dpup deleted the fix/setup-margin-step-cap branch September 8, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant