Skip to content

Keep Drive turns inside the window, retry 429s, and add a SCHEDULES modal - #10

Merged
ishu86 merged 9 commits into
mainfrom
feat/drive-reliability
Sep 7, 2026
Merged

Keep Drive turns inside the window, retry 429s, and add a SCHEDULES modal#10
ishu86 merged 9 commits into
mainfrom
feat/drive-reliability

Conversation

@ishu86

@ishu86 ishu86 commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Drive now trims history by turn and asks OpenAI to compact before a long thread 400s; 429s retry instead of being treated as an unsupported-param fallback.
  • Daily schedules keep an IANA timezone (box-local if omitted) and skip when the box is short on RAM. Compose points the scheduler at Drive's existing POST /api/brain, which reuses runTurn and CASE_DRIVE_API_KEY — no second runtime on the cased image.
  • The Drive sidebar has a SCHEDULES modal (list, create, run, delete). Scheduled runs show up as Drive threads titled by the schedule name.

Made with Cursor

Greptile Summary

The PR keeps Drive history within provider limits, retries provider throttling, and adds timezone-aware scheduled Drive runs.

  • Trims history at whole-turn and tool-call boundaries and adds OpenAI compaction support.
  • Distinguishes rate limits from unsupported-parameter failures and applies cancellable backoff.
  • Adds persisted schedule timezones, DST-gap handling, an HTTP scheduler-to-Drive path, and schedule management UI.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
web/web-ui/serve.mjs Adds whole-turn history trimming, compaction, scheduled brain execution, and corrected rate-limit fallback behavior; the prior orphan-output issue is fixed by filtering all unmatched retained calls and outputs.
control-plane/scheduler.py Adds timezone-aware scheduling, DST-gap validation before and after jitter, HTTP brain execution, and low-memory skip handling; both previously reported DST cases are addressed.
control-plane/store.py Adds and migrates the nullable schedule timezone column and persists it on schedule creation.
web/web-ui/index.html Adds responsive schedule listing, creation, immediate-run, and deletion controls.
web/web-ui/case-tools.mjs Centralizes rate-limit detection and retry-delay calculation while preserving cancellation during backoff.
tests/test_scheduler.py Covers named and box-local timezone behavior, DST gaps, jitter crossing a gap, HTTP brain outcomes, and resource-based skips.
web/web-ui/test_serve.mjs Exercises history trimming across oversized turns and batched, non-adjacent tool call/output pairs.

Sequence Diagram

sequenceDiagram
    participant User
    participant UI as Drive UI
    participant Cased as Control Plane
    participant Scheduler
    participant Brain as POST /api/brain
    participant Provider
    User->>UI: Create schedule
    UI->>Cased: POST schedule with prompt, time, timezone
    Cased->>Scheduler: Persist next valid UTC run
    Scheduler->>Scheduler: Detect due schedule and check resources
    Scheduler->>Brain: POST computer_id, prompt, name
    Brain->>Provider: Run Drive turn with box credentials
    Provider-->>Brain: Responses and tool calls
    Brain-->>Scheduler: Completion summary
    Scheduler->>Cased: Persist run status and next run
Loading

Reviews (3): Last reviewed commit: "Keep daily jitter from landing in a DST ..." | Re-trigger Greptile

ishu86 and others added 7 commits September 7, 2026 16:02
Turn-aware history trim plus OpenAI compaction stop a long thread from
400ing; rate-limit helpers stop a 429 from being treated as an
unsupported-param fallback.

Co-authored-by: Cursor <cursoragent@cursor.com>
… RAM.

Daily HH:MM can be an IANA zone instead of box-local time. A tight RAM
budget is a skip, not a failure. Compose can point CASE_BRAIN_URL at Drive
instead of requiring a second brain binary.

Co-authored-by: Cursor <cursoragent@cursor.com>
Compose points CASE_BRAIN_URL at POST /api/brain, which reuses runTurn and
the box key. Scheduled runs show up as Drive threads. No second runtime
on the cased image.

Co-authored-by: Cursor <cursoragent@cursor.com>
List, create, run, and delete from the sidebar. Daily times keep the
browser timezone. The box key from .env is what the run actually uses.

Co-authored-by: Cursor <cursoragent@cursor.com>
.env.example now states the brain command order and the compaction
threshold. The README notes that schedules use CASE_DRIVE_API_KEY.

Co-authored-by: Cursor <cursoragent@cursor.com>
…cased hangs up.

A no-tz daily path that froze today's offset fired an hour off on the
switch day. Naive local time lets astimezone pick the fire date's
offset. When the scheduler closes the socket the Drive turn now stops
with it, instead of spending the box key against a computer being put
to sleep.

Co-authored-by: Cursor <cursoragent@cursor.com>
The sidebar used to show the first 72 characters of the prompt. The
scheduler now sends the name, so a run called "morning sweep" shows up
as that. The HTTP brain also clips its summary like the argv path, so
the logbook stays bounded.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread web/web-ui/serve.mjs Outdated
Comment thread control-plane/scheduler.py Outdated
A suffix cut between batched calls used to leave an output whose call
was gone, which 400s the next Responses request. Daily HH:MM that does
not exist on a spring-forward day now fires the next day that has that
time, instead of an hour later.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread control-plane/scheduler.py Outdated
The wall-clock check ran before jitter, so 01:45 plus a few minutes
could become a time that never existed that morning.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ishu86

ishu86 commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator Author

Jitter-after-DST: compute_next now re-checks the wall clock after adding jitter. If that lands in a spring-forward gap, the run moves to the next day that has that time.

@ishu86
ishu86 merged commit 133082b into main Sep 7, 2026
4 checks passed
@ishu86
ishu86 deleted the feat/drive-reliability branch September 7, 2026 15:44
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