Repository navigation
feat(schedule): add local channel for desktop/headless scheduling - #1050
Closed
inference-gateway-maintainer[bot] wants to merge 1 commit into
Closed
inference-gateway-maintainer[bot] wants to merge 1 commit into
inference-gateway-maintainer[bot] wants to merge 1 commit into
Conversation
Closed
4 tasks
edenreich
added a commit
that referenced
this pull request
Aug 12, 2026
#1051) ## Summary Closes #1049. Separates the scheduling subsystem into three concerns - agent runs, scheduling, and notification delivery - and renames the daemon accordingly. - **`infer channels-manager` -> `infer daemon`** (hard rename, no alias). Same three subsystems: scheduler, channel listener, heartbeat. - **Scheduler only runs agents.** `ChannelLookupFn` and the duplicated `formatAgentLine` are removed from `internal/services/scheduler`. Every fire persists a `RunRecord` (`session_id` = the run's conversation ID, `job_id`, `status`, `error`, timestamps) and streams progress through an `OnRunEvent` hook. Newest 200 records retained; `RunOnce` records survive job deletion. - **Delivery is a subscriber.** New `ScheduleNotifier` (`internal/services/schedule_notifier.go`) receives run events, and only when the job has a delivery target formats with the existing `formatAgentMessage` and calls `Channel.Send`. - **Schedule tool works from any session.** Non-channel sessions (chat, headless, desktop UUIDs) create record-only jobs; channel sessions keep today's behavior (delivery target derived from the session ID). A channel session naming a disabled channel still errors. - **Storage**: new `ScheduledRunStorage` interface implemented by all six backends (jsonl, sqlite, postgres, redis, d1, memory); migration 006 (`scheduled_job_runs`). - **Bug fix**: `RunOnce` jobs now unregister their cron entry immediately on fire - previously a short interval (e.g. `@every 2s`) could fire again before the poller noticed the delete. This supersedes the LocalChannel/JSONL direction from #1050: consumers read run records and conversations straight from the shared storage backend. ## Cross-repo impact - **desktop**: inference-gateway/desktop#109 (consume run records, spawn `infer daemon`) - unblocks inference-gateway/desktop#83. - **docs**: inference-gateway/docs#545 (command rename + run-record semantics). - **Breaking**: the `channels-manager` command no longer exists; deployments (docker-compose examples updated in this PR, k8s Orchestrator CRD args) must switch to `infer daemon`. ## Testing - `task precommit:run` green (fmt, lint, tidy, full `go test ./...`). - New unit tests: scheduler fire -> run events + persisted run records (success and failure), `RunOnce` record survival, `ScheduleNotifier` delivery/record-only/failure/unregistered-channel paths, Schedule tool record-only creation from non-channel sessions. - Manual smoke test: `infer daemon` with a jsonl backend fired a hand-dropped record-only job, persisted failed run records with the real subprocess error, and deleted the one-off job while keeping its records.
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.
Resolves #1049
Summary
Adds a
localchannel implementation so the Schedule tool'screateoperation works from desktop/headless sessions (e.g.inference-gateway/desktop#83). Previouslycreateonly worked in Telegram/WhatsApp channel-driven sessions; the new local channel writes scheduled job output to a JSONL file at~/.infer/tmp/schedule-output.jsonlthat the desktop app can consume.Changes
LocalChannelConfigwithEnabledbool toChannelsConfigLocalChannelimplementingdomain.Channel- writes outbound messages as JSON lines to~/.infer/tmp/schedule-output.jsonlregisterChannelswhencfg.Channels.Local.Enabled"local"inchannelConfigured, routing throughcfg.Channels.Local.Enabled