feat: add repo schedules for recurring agent jobs#156
Open
itz4blitz wants to merge 9 commits intochriswritescode-dev:mainfrom
Open
feat: add repo schedules for recurring agent jobs#156itz4blitz wants to merge 9 commits intochriswritescode-dev:mainfrom
itz4blitz wants to merge 9 commits intochriswritescode-dev:mainfrom
Conversation
Add coverage reporting and exercise recovery, cancellation, and async failure paths so the schedules feature has stronger backend validation.
There was a problem hiding this comment.
Pull request overview
Adds repo-scoped schedules for recurring agent jobs, including shared Zod types/schemas, backend scheduling + run persistence, and a new frontend “Schedules” dashboard + docs to expose and manage the feature.
Changes:
- Introduces shared schedule schemas/types (jobs, runs, requests) and wires new schedules API routes under repos.
- Implements backend schedule execution (OpenCode session creation, prompt submission, run monitoring/recovery) plus SQLite persistence + migrations.
- Adds a new frontend Schedules page with CRUD, manual runs, cancellation, and run history viewing, plus documentation updates.
Reviewed changes
Copilot reviewed 33 out of 42 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| shared/src/types/index.ts | Re-exports schedule-related shared types. |
| shared/src/schemas/schedule.ts | Adds Zod schemas/types for schedule jobs, runs, and create/update requests. |
| shared/src/schemas/index.ts | Exposes schedule schemas via shared schema barrel. |
| pnpm-lock.yaml | Locks new deps (cron-parser, cronstrue) and updates Bun type packages. |
| mkdocs.yml | Adds schedules page to docs nav. |
| frontend/src/pages/Schedules.tsx | New schedules dashboard page + editor dialog + rendering for run history output. |
| frontend/src/pages/RepoDetail.tsx | Adds “Schedules” entry point button/menu item from repo detail. |
| frontend/src/hooks/useSchedules.ts | Adds React Query hooks for schedules CRUD/runs/cancellation. |
| frontend/src/api/schedules.ts | Adds frontend API client for schedule endpoints. |
| frontend/src/App.tsx | Registers /repos/:id/schedules route. |
| frontend/package.json | Adds cronstrue dependency. |
| docs/index.md | Mentions schedules feature and links to docs page. |
| docs/features/schedules.md | New documentation page describing schedules, timing, templates, and run history. |
| docs/features/overview.md | Adds schedules to feature overview. |
| backend/test/services/schedule-config.test.ts | Tests schedule persistence normalization and next-run computation logic. |
| backend/test/services/opencode-models.test.ts | Tests model resolution fallback logic. |
| backend/src/services/schedules.ts | Implements schedule service (CRUD + execution + recovery) and schedule runner loop. |
| backend/src/services/schedule-config.ts | Implements cron/interval normalization and next-run computation using cron-parser. |
| backend/src/services/opencode-models.ts | Adds model resolution helper with fallback behavior. |
| backend/src/routes/title.ts | Switches title generation to use resolveOpenCodeModel + adds polling fallback for assistant response. |
| backend/src/routes/schedules.ts | Adds repo-scoped schedules API routes. |
| backend/src/routes/repos.ts | Mounts schedules routes under /:id/schedules. |
| backend/src/index.ts | Starts the schedule runner at backend startup. |
| backend/src/db/schedules.ts | Adds SQLite query layer for schedule jobs and runs. |
| backend/src/db/migrations/index.ts | Registers new migrations 007/008. |
| backend/src/db/migrations/007-schedules.ts | Creates schedule jobs/runs tables and indexes. |
| backend/src/db/migrations/008-schedule-cron-support.ts | Adds cron-related columns to schedule jobs table. |
| backend/package.json | Adds cron-parser dependency. |
| README.md | Mentions schedules feature in top-level feature list. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
You can also share your feedback on Copilot code review. Take the survey.
Keep cron schedules migratable, trim run polling payloads, and expose the health endpoint so Docker preview and PR feedback match the intended behavior.
Owner
|
interested in these. Just have not had time to 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.
Summary
Why
OpenCode Manager already centralizes repositories, sessions, and agent workflows. This adds the missing proactive layer: recurring repo jobs that can run in the background and be waiting for review the next time you open the app.
That makes workflows like morning repo briefs, dependency watchlists, release-readiness checks, and recurring code-health reviews feel native to the existing product instead of bolted on as a separate automation tool.
Walkthrough
1. Schedules lives in the normal repo workflow
The entry point sits alongside the existing repo actions, and scheduled runs show up in the same session stream as everything else.
2. Schedules page is a review shell first
The page is built around a fixed dashboard shell with the jobs list, current job summary, and run history visible without making the whole page scroll.
3. Run history supports both readable output and raw markdown
Completed runs keep a linked session, status, logs, rendered markdown output, and the original markdown when you want the exact generated text.
4. Job details stay available without dominating the page
The selected job can expand when you need prompt/settings context, but defaults to a collapsed state so run history stays front and center.
5. The editor walks through setup in focused tabs
The composer is GUI-first and keeps the core flow on the tabs that matter for everyday use.
General
Timing
Prompt
Templates can seed the job, but the prompt body stays fully editable so teams can fine-tune the generated prompt or replace it with a fully custom one.
What is included
Schedulesentry point from the repo detail pageRun nowreturns quickly instead of waiting on the full assistant response200 OKwith an empty body before the session finishesValidation
pnpm lintpnpm buildin a clean worktree from this branchpnpm --filter backend exec vitest run --coverage(457tests passing)backend/src/db/schedules.ts:78.44%backend/src/services/schedule-config.ts:85.08%backend/src/services/opencode-models.ts:82.88%backend/src/services/schedules.ts:79.39%backend/src/routes/schedules.ts:82.92%backend/src/routes/title.ts:85.81%Type of Change
Checklist
pnpm lintpasses locallypnpm buildpasses in a clean worktree from this branch