Repository navigation
feat(schedule): Oracle scheduler loop, approval inbox and /api/schedules - #220
Merged
Merged
Conversation
services/schedule_approvals.py holds pending approvals for approval-mode runs (one pending row per schedule, human-only decide, TTL sweep, kind= schedule notifications). oracle/services/scheduler.py is the tick: lapse approvals, fold finished jobs (JobStore.find), claim_due, then route each run through the misfire window, overlap rule, check_command and autonomy gate, dispatching as detached jobs so the tick never blocks. A kernel-held scheduler.lock keeps a second Oracle in standby. Not started anywhere yet. Verified: 21 tests incl. non-blocking dispatch and two-instance standby. Claude-Session: https://claude.ai/code/session_01JUcvmQq81aLo9ewD9Xc4qY
The Oracle builds the schedule, approval and job stores in _init_services, starts the Scheduler beside the review agent when scheduler_enabled, and registers oracle/services/schedule_api.py: CRUD with expected_rev, run now, enable/disable, runs, approvals decide (409 once lapsed), preview, status, kick. GETs stay open on loopback like the rest of the local API; mutations sit behind _local_write_guard. The blueprint's plain functions are what the mobile gateway and the Hub will call next. docs/scheduled-tasks.md describes the model and loop. Verified: 11 Flask tests against the real app. Claude-Session: https://claude.ai/code/session_01JUcvmQq81aLo9ewD9Xc4qY
Set at import, the key outlived the module and made every later test_oracle_discovery_api call answer 401. Claude-Session: https://claude.ai/code/session_01JUcvmQq81aLo9ewD9Xc4qY
|
Gro could not finish this review. |
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.
Replaces #217, which GitHub closed when its base branch was deleted on the merge of #216. Third of the Scheduled Tasks series; after this the Oracle actually fires schedules.
services/schedule_approvals.py: pending approvals forautonomy: approvalruns. One pending row per schedule, human-onlydecide, TTL sweep,kind=schedulenotifications so the Desk and phone feeds wake.oracle/services/scheduler.py: the tick. Lapse approvals → fold finished jobs →claim_due→ misfire window / overlap rule /check_command/ autonomy gate → dispatch detached jobs → dispatch approved runs → sweep. Never waits on a job. Takesscheduler.lock; a second Oracle stays instandby.oracle/oracle_server.pybuilds the stores, starts the scheduler with the Oracle and registersoracle/services/schedule_api.py(/api/schedules/*: CRUD withexpected_rev, run now, enable/disable, runs, approvals decide with 409 once lapsed, preview, status, kick).services/shell_jobs.py:JobStore.find(job_id).docs/scheduled-tasks.md.https://claude.ai/code/session_01JUcvmQq81aLo9ewD9Xc4qY