Repository navigation
feat(devkitd): add persistent scheduled agent sends - #502
Open
codeaholicguy wants to merge 1 commit into
Open
codeaholicguy wants to merge 1 commit into
codeaholicguy wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Closes #482
Summary
Adds persistent one-shot scheduled agent message delivery owned by
devkitd, with fire-time target resolution, exact terminal pane delivery, restart/sleep late/skip handling, daemon RPC methods, and CLI commands.What Changed
rust/crates/devkit-core):scheduled_sendsSQLite table indaemon.dbwith partial pending index (idx_scheduled_sends_pending_due), zero-chronostrict RFC3339/ISO-8601 UTC parser (parse_iso8601_utc_ms), shortsch_<8-hex>IDs, 64 KiB payload cap, atomic state transitions (pending->sent|late|cancelled|failed|skipped), and amortized terminal-row pruning (1,000 rows / 30 days).ScheduledSend,ScheduleCreateParams,ScheduleListParams,ScheduleCancelParams) with generatedts-rsTypeScript bindings inpackages/daemon-client/src/gen/.rust/crates/devkitd):TmuxRuntime::pane_for_pid(TTY-to-%pane_idmatching),TmuxRuntime::send_to_pane(load-buffervia stdin +paste-buffer -p -d+ 150ms +send-keys Enter+ buffer cleanup on failure), andHerdrRuntime::send_prompt, all with bounded subprocess timeouts.scheduler.rs: fire-time target lookup by exactagent_name(registry + unique enriched live fallback; rejects dead/tombstoned/ambiguous/durable targets),HybridDeliverer(herdr-> exacttmuxpane -> narrowai-devkit agent send --id <name> --stdinfallback for unmanaged terminals), unified late/skip policy (<= 1hoverdue ->late,> 1h->skipped), sequential(due_at ASC, id ASC)execution, andin_flight_schedulescancel guard.schedule.create,schedule.list, andschedule.cancelRPC handlers (rpc/schedule.rs) and a dedicated 2stokio::time::intervalscheduler loop spawned after socket bind inserver.rs.packages/daemon-client,packages/cli):createSchedule,listSchedules, andcancelScheduletoDaemonClient.parseDurationMsandparseFutureIsoTimestampinpackages/cli/src/util/time.ts.AgentScheduleService(daemon-only, matchingAgentGroupService), extendedagent sendwith--in <duration>and--at <iso-8601>(with upfront durable-target rejection and non-fatal warning when target is not currently live), and addedagent schedule listandagent schedule cancel <id>.docs/ai/*/2026-11-25-feature-scheduled-sends.md.Validation
All checks were run fresh after rebasing onto
origin/main(f8860ede):npm run fmt:check(oxfmt --check packages+cargo fmt --all -- --check) — exit0npm run lint(6 Nx lint tasks) andcargo clippy --workspace --all-targets -- -D warnings— exit0npm run buildandcargo build -p devkitd— exit0packages/daemon-client:npx vitest run— exit0(5/5files,30/30tests passed)packages/cli:npx vitest run— exit0(120/120files,1573/1573tests passed)cargo test --workspace— exit0(222/222tests passed,0failed)node packages/cli/dist/cli.js lint --feature scheduled-sends— exit0(12/12checks passed)HOME,TMUX_TMPDIR,unset TMUX, and freshly builtdevkitd+packages/cli/dist/cli.js(never touching default daemon or tmux server).--in 2sdelivered to target pane%1while active decoy pane%0remained empty; status transitioned tosentwithsentAt).--at <future>,agent schedule list(filtered JSON + human table),agent schedule cancel, duplicate cancel rejection, andnot_foundcancel rejection.--jsonandfailedtransition with explicit reason at fire time.devkitdrestart recovery: 5m overdue row delivered aslateto target pane; 2h overdue row markedskippedwithout delivery.--in+--at,--group+--in,--wait+--in).Risks / Follow-ups
in_flight_schedulescheck and SQLiteUPDATEinschedule.cancelif concurrent cancel-at-exact-fire-time races ever become relevant.