Skip to content

feat(schedule): add local channel for desktop/headless scheduling - #1050

Closed
inference-gateway-maintainer[bot] wants to merge 1 commit into
mainfrom
fix/issue-1049
Closed

inference-gateway-maintainer[bot] wants to merge 1 commit into
mainfrom
fix/issue-1049

Conversation

@inference-gateway-maintainer

Copy link
Copy Markdown
Contributor

Resolves #1049

Summary

Adds a local channel implementation so the Schedule tool's create operation works from desktop/headless sessions (e.g. inference-gateway/desktop#83). Previously create only worked in Telegram/WhatsApp channel-driven sessions; the new local channel writes scheduled job output to a JSONL file at ~/.infer/tmp/schedule-output.jsonl that the desktop app can consume.

Changes

  • config/channels.go: Add LocalChannelConfig with Enabled bool to ChannelsConfig
  • internal/services/channels/local.go (new): LocalChannel implementing domain.Channel - writes outbound messages as JSON lines to ~/.infer/tmp/schedule-output.jsonl
  • cmd/channels.go: Register local channel in registerChannels when cfg.Channels.Local.Enabled
  • internal/agent/tools/schedule.go: Accept "local" in channelConfigured, routing through cfg.Channels.Local.Enabled
  • docs/scheduling.md: Add local channel setup instructions in step 2 of Setup

@edenreich edenreich closed this Aug 12, 2026
@edenreich
edenreich deleted the fix/issue-1049 branch August 12, 2026 08:32
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.
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.

[FEATURE] Allow Schedule tool create outside channel-driven sessions (local/desktop channel)

1 participant