fix(scheduler): wire timer→executor bridge so scheduled jobs run (#347) - #372
Merged
Merged
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
gnanirahulnutakki
force-pushed
the
worktree-fix-347-scheduler-executor
branch
from
July 23, 2026 18:29
7f12240 to
f0c79aa
Compare
gnanirahulnutakki
force-pushed
the
worktree-fix-347-scheduler-executor
branch
from
August 11, 2026 19:06
f0c79aa to
d109a54
Compare
gnanirahulnutakki
added a commit
that referenced
this pull request
Aug 11, 2026
…uinn-proto, resync Cargo.lock (#387) Three coupled fixes that together restore a mergeable `dev`. 1. cargo-deny (required check) is failing on every open PR and on `dev` itself with a single finding: error[unmaintained]: bitmaps is unmaintained ID: RUSTSEC-2026-0247 Solution: No safe upgrade is available! `bitmaps` is transitive only, via matrix-sdk -> imbl -> imbl-sized-chunks. It is an unmaintained notice, not a vulnerability, and cargo-deny itself reports that no safe upgrade exists. That is exactly the class `[advisories].ignore` already documents (bincode via syntect, paste via fastembed, proc-macro-error2 via Matrix/Teloxide, rustls-pemfile via qdrant-client), so it is ignored on the same terms. Vulnerability advisories are still upgraded rather than ignored — see (2). 2. Patch the two crates behind all five open Dependabot alerts. Both are reachable from the workspace and both have released fixes: - russh 0.62.2 -> 0.62.5 (direct dep of crates/terminal), closing GHSA-m65r-rprj-r5rg (CVE-2026-68930, channel-scoped server callbacks reachable without an open channel), GHSA-g9hv-x236-4qp3 (pre-auth X25519 wrong-length panic), GHSA-cqjc-rmpq-xprq (post-auth pty-req panic) and GHSA-5xvq-cp9x-6p6r (pre-auth all-zero Curve25519 encode_mpint OOB). - quinn-proto 0.11.14 -> 0.11.16 (transitive), closing the one HIGH alert, GHSA-4w2j-m93h-cj5j (remote memory exhaustion from unbounded out-of-order stream reassembly). Dependabot did raise these as #385 and #382, but against `main`, where they fail DCO; `dev` never received them. 3. Resync Cargo.lock, which had drifted from the manifests: it was missing `ardur-delegate-tool` (#332) and `ardur-durability` (#327) along with tar/filetime/xattr, and still carried stale entries. `.github/workflows/release.yml` builds `--locked`, so a release cut from `dev` would have failed to resolve. `cargo metadata --locked` now succeeds. Verified locally: `cargo deny check` reports advisories/bans/licenses/ sources all ok; `cargo fmt --check`, `cargo build --workspace` and `cargo clippy --workspace --all-targets -D warnings` are clean. --- **Why this lands first:** `cargo-deny` is a required check and is currently red on *every* open PR (#368, #369, #370, #372, #373, #374, #375 all show exactly one failing required check, and it is this one). Nothing can merge into `dev` until the advisory is resolved. Signed-off-by: GR <gnanirn@gmail.com>
gnanirahulnutakki
force-pushed
the
worktree-fix-347-scheduler-executor
branch
from
August 11, 2026 19:57
d109a54 to
78c1111
Compare
Unattended scheduling was inert end-to-end: `ardur schedule create` persisted a job, but nothing ran it. Three disjoint schedule stores existed with no timer→executor bridge — `ardur schedule fire` printed "execution engine not yet wired", and `ProactiveAutomationLoop` (the real, tested executor) had zero callers. Root cause (verified in-tree): - crates/cron `CronScheduler` marks job lifecycle but never reads `job.command` — a lifecycle marker, not an executor. - crates/automation `ProactiveAutomationLoop::fire_due` executes fully (cap-token → FusedRuntime::submit_with_provisioning → deliver → record) but nothing drove it on a clock. - crates/cli `ardur schedule fire` was a dry-run over a store no executor read. Fix (reconcile onto the automation executor; the CLI `<state>/schedules` directory becomes the single durable store that feeds it): - ardur-automation: add `ScheduleDriver` — the missing timer→executor bridge. Ticks `fire_due(Utc::now())` on an interval; `run_bounded` for one-shot/bounded runs, `start`/`stop` for a background driver. - ardur-cli: add `CliScheduleStore`, adapting `<state>/schedules/*.json` to the `ScheduleStore` contract by materializing each record into an executable `AutomationSchedule` at fire time — per-fire it mints a fresh, short-lived, attenuated cap-token and budget top-up (a token minted at create time would expire before a daily job fires) and persists `last_fire_at`/`fire_count` back. Fires run the ordinary fused pipeline and append to the same signed receipt chain a chat turn would. - ardur-cli: `ardur schedule fire <id>` now executes end-to-end; new `ardur schedule run [--interval-secs N] [--max-ticks N]` drives due schedules via `ScheduleDriver`. `ScheduleRecord` moved to the lib with additive serde-defaulted fire-state fields (pre-#347 records load unchanged). Verification: - ardur-automation driver unit tests: a bounded tick and a background start/stop each fire a due schedule. - ardur-cli: schedule_exec unit tests + updated schedule_commands integration test asserting a fire mints exactly one receipt. - New e2e scenario_scheduled_job_execution: a due schedule driven through ScheduleDriver over the real fused runtime mints a signed receipt that verifies under the publishing JWKS. - Live smoke reproduced the issue's exact repro: fire now mints a receipt and bumps fire_count instead of printing "not yet wired". - Affected crates + `cargo test -p ardur-e2e-tests` + fmt + clippy (-D warnings) all green. Checkpoint: architect/sessions/issue-347-scheduler-executor/journal.md Signed-off-by: GR <gnanirn@gmail.com>
gnanirahulnutakki
force-pushed
the
worktree-fix-347-scheduler-executor
branch
from
August 11, 2026 21:01
78c1111 to
e6aa641
Compare
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.
Fixes #347.
Root cause (verified in-tree, not assumed)
The unattended-execution path was never wired end-to-end. A user could create a schedule and it persisted, but no runtime component ever executed it — three disjoint stores with no timer→executor bridge:
crates/cron/src/scheduler.rs—CronSchedulerspawns a real ticker that flips job statusPending→Running→Completedbut never readsjob.command; it's a lifecycle marker, not an executor, and is instantiated nowhere outside its own crate.crates/automation/src/proactive.rs—ProactiveAutomationLoop::fire_due/fire_scheduleis a complete, tested executor (validate →FusedRuntime::submit_with_provisioning→ deliver → record fire), but had zero callers outside an in-crate test. Nothing drove it on a clock.crates/cli/src/main.rs—ardur schedule firewas an explicit dry-run printingexecution engine not yet wired, over a<state>/schedules/*.jsonstore no executor read.Reproduced live:
ardur schedule create … "every 5 minutes"thenardur schedule fire <id>→note: execution engine not yet wired; no receipt, no run.Fix
Reconcile everything onto the automation executor, and make the CLI
<state>/schedulesdirectory the single durable store that feeds it.crates/automation—ScheduleDriver(newdriver.rs): the missing timer→executor bridge. Owns aProactiveAutomationLoopand ticksfire_due(Utc::now())on a fixed interval.run_bounded(Some(n))for bounded/one-shot inline runs (CLI--max-ticks, tests);start/stop/is_runningfor an always-on background driver. MirrorsCronScheduler's shape but calls the real executor.crates/cli—CliScheduleStore(newschedule_exec.rs): adapts<state>/schedules/*.jsonto theScheduleStorecontract by materializing each persisted record into an executableAutomationScheduleat fire time. Per fire it mints a fresh, short-lived, attenuated cap-token and a per-fire budget top-up (a token minted at create time would have expired by the time a daily job fires days later — so per-fire minting is the only correct design for a durable scheduler), and persistslast_fire_at/fire_countback to the record. Fires run the ordinary fused ten-stage pipeline (cap-token → Cedar → cost admission → provider → signed receipt → journal) and append to the same signed receipt chain a chat turn would. Runtime wiring mirrorsFusedEngine(provider selection + offline stub fallback + persistent keys/policies + file-backed receipt log).ardur schedule fire <id>now executes end-to-end; newardur schedule run [--interval-secs N] [--max-ticks N]drives every due schedule viaScheduleDriver.ScheduleRecordmoved to the lib with additive serde-defaulted fire-state fields, so pre-[Critical] Unattended-execution gap: scheduled jobs are persisted but never run #347 records load unchanged.Security posture preserved: unattended fires require an attenuated cap-token (
validate_schedule); Cedar still governs (a fire under a deny-all policy is denied, exactly like a chat turn); per-fire cap-tokens are 300s and tool-scoped tochat.submit+ memory read/write; the CLI store id is path-traversal-checked.CronScheduleris intentionally left as a lifecycle marker — the automation loop is the single executor. A server-boot adoption ofScheduleDriver::start(sharing the server'sFusedRuntime) is the natural follow-up, deferred to keep this PR scoped to the CLI repro + the reusable bridge.Verification
ardur-automationdriver unit tests — a bounded tick and a background start/stop each fire a due schedule through the executor.ardur-cli—schedule_execunit tests + updatedschedule_commandsintegration test asserting a fire mints exactly one receipt.scenario_scheduled_job_execution— a dueAutomationScheduledriven throughScheduleDriverover the real fused runtime (stub provider) delivers the response, bumpsfire_count, and mints a signed receipt on the on-disk chain that verifies under the publishing JWKS. This is the regression guard: if any half regresses to "persist but never run", it fails.schedule firenow mints a receipt and bumpsfire_count/last_fire_atinstead of printing "not yet wired";schedule run --max-ticks 1fires an always-due schedule and mints a receipt, and correctly does not fire a not-yet-due minute (dedup honored).cargo test -p ardur-automation -p ardur-cligreen;cargo test -p ardur-e2e-testsall binaries green, 0 failures;cargo fmt --checkclean;cargo clippy -p ardur-automation -p ardur-cli --all-targets --all-features -- -D warningsclean.Do not merge — for peer review.