Skip to content

feat(benchsdk-runner): deadlineMs — a run-level deadline drains and finishes, not fails - #518

Merged
HeyGarrison merged 2 commits into
masterfrom
devin/1792154845-runner-deadline
Oct 17, 2026
Merged

HeyGarrison merged 2 commits into
masterfrom
devin/1792154845-runner-deadline

Conversation

@HeyGarrison

Copy link
Copy Markdown
Collaborator

Summary

Snapshot/Fork run #5 paged as Job failed because the workflow's timeout 60m wrapper SIGKILLed the bench mid-run at ~iteration 57/100 on the neon and cloudflare-r2 legs (exit 124). That cap is user-defined, so it isn't a proper error — and timeout(1) can never be made graceful from the inside anyway: it returns 124 regardless of how the process exits. The fix is to make the deadline a first-class runner concept instead of a shell wrapper.

deadlineMs on BenchmarkConfig (or --deadline-ms on the CLI) sets a wall-clock budget for task execution:

  • On expiry, every scheduler (groupBy: 'participant', 'round', and the local no-ingest path) stops launching new tasks; in-flight tasks finish normally.
  • The run still flushes results, submits its summary, and exits 0 — a deadline is a planned end, not a failure. BenchmarkRunOutcome.stoppedEarly flags the truncation.
  • Plumbing: RunWorkerOptions.stopRequested is a predicate runWorker's task pool polls before each new start; the runner passes the deadline's expired() through.

The workflow then swaps the kill for the knob:

# before — exit 124 → job failed → page
timeout 60m npx tsx packages/benchsdk-runner/dist/bin.js run ... 
# after — drains + reports partial results → job passes
timeout 75m npx tsx packages/benchsdk-runner/dist/bin.js run ... --deadline-ms 3600000

timeout 75m stays as a hard backstop under the job's 90-minute cap — if the drain itself hangs, that's a real failure worth paging on.

Verified: --deadline-ms 1000 on a 10-iteration local bench ran 4 tasks, printed stopped at deadline — partial results, exited 0. Changeset covers @benchsdk/runner, @benchsdk/worker, @benchsdk/api (patch).

Link to Devin session: https://app.devin.ai/sessions/ce0748a72a10427db3c2930e20d3395f
Open in Devin Desktop: https://app.devin.ai/desktop/session/ce0748a72a10427db3c2930e20d3395f?variant=devin
Requested by: @HeyGarrison

… end, not a failure

Snapshot/Fork run #5 paged as 'Job failed' when the workflow's
`timeout 60m` wrapper SIGKILLed the bench at iteration ~57/100 on the
neon and cloudflare-r2 legs (exit 124). The cap was user-defined, so the
job shouldn't have failed — and timeout(1) can't be made graceful anyway:
it returns 124 no matter how the process exits.

Give the runner a first-class deadline instead. `deadlineMs` on the
bench config (or --deadline-ms) sets a wall-clock budget for task
execution: on expiry the schedulers stop launching tasks, in-flight ones
finish, and the run still flushes, reports, and exits 0. Plumbing is
RunWorkerOptions.stopRequested — the platform worker polls it before
each new task start. BenchmarkRunOutcome.stoppedEarly flags truncation.

snapshot-fork-benchmarks.yml swaps `timeout 60m` for --deadline-ms
3600000 with a `timeout 75m` hard backstop under the job's 90m cap.
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@HeyGarrison
HeyGarrison marked this pull request as ready for review October 17, 2026 11:57
@open-cla

open-cla Bot commented Oct 17, 2026

Copy link
Copy Markdown

Contributor License Agreement

All contributors are covered by a CLA.

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin resolved all 3 findings on 4f6ed55

Fixed by Devin (3)

  • Staggered tasks start after deadline
  • Round participants launch after deadline
  • Skipped participants vanish from partial runs

View all findings in Devin Review

Devin Review

…participants

- local + platform stagger sleeps now re-check expired() before launching
- platform path throws BenchmarkTaskSkippedError so the worker drops the
  record entirely (never launched, not an error)
- round mode re-checks after the round sleep and before each queued
  participant's task
- participants that never started are still reported (empty records) so a
  deadline-stopped run marks stoppedEarly and doesn't silently drop them
@HeyGarrison
HeyGarrison merged commit eb46515 into master Oct 17, 2026
6 checks passed
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