Skip to content

#3116: 0.2.0 AD2: the local driver waits out usage limits and resumes on the same model - #3285

Open
jparker2006 wants to merge 4 commits into
mainfrom
builder/3116-usage-limit-resume
Open

jparker2006 wants to merge 4 commits into
mainfrom
builder/3116-usage-limit-resume

Conversation

@jparker2006

@jparker2006 jparker2006 commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Closes #3116

Summary

turn exits non-zero
  -> read last lines of turn log (built-in Claude/Codex patterns + optional row.limit)
  -> parse reset time (ISO-8601, epoch, relative duration, clock time)
  -> if reset > 6h away: record limit state, exit (wake refuses with reset time)
  -> else wait:
       with reset time: reset + 15s + random(0..30s), resume once
       overload without reset: 60s, then 120s, then stop
  -> wake during wait: D3 refusal naming limit + reset time
  -> resume: driver --turn runs one normal wake turn on the same harness & model

When a local-driver turn exits non-zero after hitting a usage limit or provider overload, the turn supervisor waits out the window and resumes once with the normal wake prompt on the same harness and model, while wake and start's first-turn check report the limit and reset time under D3.

Idea only from Cloudroom's retry-policy.ts (Apache-2.0) and Gas City's workladder (MIT); written fresh in Python with no code copied.

Evidence

  • Before (49c427f2): Running the 5 new proof tests in adapters/local/test_driver.py on the base driver failed all 5 cases (test_usage_limit_waits_and_resumes_once_on_same_model, test_wake_during_limit_wait_refuses_with_reset_time_and_stop_ends_wait, test_overload_without_reset_time_backs_off_60_120_then_stops, test_limit_beyond_six_hours_does_not_wait_and_first_turn_reports_limit, test_row_limit_pattern_and_reset_time_formats): no automatic wait/resume occurred and wake/start returned no usage-limit refusal with reset time.
    After (2cb2822d): python3 -I adapters/local/test_driver.py passes all 29 tests (24 existing + 5 new proof cases, including the driver kit for claude and codex and the macOS simulation).

Merge danger

Door: two-way

Blast radius: local

A bug in limit detection or supervisor wait handling affects only the local driver's non-zero turn exit path; normal exit-0 turns, schema.json, and kernel/driver.v1.md are unchanged.

Facts

  • Branch: builder/3116-usage-limit-resume. Head: 2cb2822daf70ebd08c6d8fba2f80a5c1b74905f8. Tree: 9a248afb642b0edfc325ac1dfa53ee613e03feaf
  • Changed paths: adapters/local/driver, adapters/local/test_driver.py, adapters/local/fixtures/fake-harness, adapters/local/README.md (shared: one bullet), adapters/local/harness-row.md (shared: one row), changes/3116.md (all inside owned paths)
  • Tests: python3 -I adapters/local/test_driver.py (29 tests OK, including driver kit on claude and codex); python3 -I adapters/local/test_harnesses.py --rows adapters/local/fixtures/rows (all 28 planted rows matched expected outcomes); full suites run in CI
  • Red run: committed before the fix at 49c427f206ff3fba09acd9b28c6cb1bae0055335
  • Claims:
    • Usage-limit wait (reset + 15s + jitter) and single auto-resume on the same harness and model, editing builder status note 1 without duplication: fixture test (test_usage_limit_waits_and_resumes_once_on_same_model)
    • wake during wait refuses under D3 with reset time and passes schema.json, and stop ends the waiting supervisor: fixture test (test_wake_during_limit_wait_refuses_with_reset_time_and_stop_ends_wait)
    • Overload without reset time backs off 60s, then 120s, then stops: fixture test (test_overload_without_reset_time_backs_off_60_120_then_stops)
    • Reset beyond 6 hours does not wait and wake/start first-turn check report the limit and reset time while normal failures stay unchanged: fixture test (test_limit_beyond_six_hours_does_not_wait_and_first_turn_reports_limit)
    • Harness row limit pattern validation/detection and reset-time formats (ISO-8601, epoch, relative, clock time): fixture test (test_row_limit_pattern_and_reset_time_formats)
  • Seams: none (AD2 logic is isolated in its own functions in adapters/local/driver so AD6 merges cleanly)
  • Helpers: none
  • CI: running on 2cb2822daf70ebd08c6d8fba2f80a5c1b74905f8 (updated once green)
  • Gaps: proven on synthetic fixtures with faked time; live provider usage-limit and overload behaviour is unverified

@jparker2006

Copy link
Copy Markdown
Member Author

First successful push: c97d1ad at 2026-11-24T20:29:06Z

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.

0.2.0 AD2: the local driver waits out usage limits and resumes on the same model

1 participant