Repository navigation
fix: bootstrap sqlite task runtime schema - #26
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR clarifies and enforces “bootstrap-owned” SQLite initialization for the task runtime by having the runtime create/validate the tasks table on open, with accompanying repo-level tests and updated design/plan docs.
Changes:
- Add runtime-side bootstrap + schema compatibility checks when opening
<project_dir>/aim.sqlite. - Update repo tests to cover empty-project bootstrapping and incompatible schema failure, plus plugin entrypoints on an empty project.
- Update the spec and implementation plan to explicitly scope bootstrap behavior (create DB file +
taskstable only; fail fast otherwise).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
test/repo/sqlite-task-runtime-plugin.test.ts |
Removes manual table creation in helpers and adds coverage for empty-project bootstrap and incompatible schema behavior. |
docs/superpowers/specs/2026-04-18-sqlite-task-runtime-design.md |
Clarifies bootstrap responsibilities and the “fail fast on incompatible schema” boundary. |
docs/superpowers/plans/2026-04-18-sqlite-task-runtime.md |
Updates the plan/constraints to include bootstrap and explicitly exclude migrations/repairs. |
.opencode/plugins/task-runtime-sqlite/database.ts |
Implements tasks table bootstrap/validation during openTaskRuntimeDatabase. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const createTasksTable = (database: DatabaseSync) => { | ||
| database.exec(` | ||
| CREATE TABLE tasks ( | ||
| task_id TEXT NOT NULL, | ||
| task_spec TEXT NOT NULL, | ||
| session_id TEXT, | ||
| worktree_path TEXT, | ||
| pull_request_url TEXT, | ||
| status TEXT, | ||
| done INTEGER NOT NULL DEFAULT 0, | ||
| updated_at TEXT | ||
| ) |
There was a problem hiding this comment.
createTasksTable uses plain CREATE TABLE tasks (...) without IF NOT EXISTS. Since openTaskRuntimeDatabase can be called concurrently (e.g. multiple tool executions hitting an empty project), this can race and throw table tasks already exists. Consider making the DDL idempotent (CREATE TABLE IF NOT EXISTS) and/or wrapping the bootstrap in a transaction so concurrent callers don’t fail spuriously.
| - 运行时只自动创建 `<project_dir>/aim.sqlite` 与缺失的 `tasks` 表;不新增 schema migration、自动修表或兼容性回填逻辑。 | ||
| - 插件对外只暴露题述 6 个 tools,不新增调试、迁移、schema 管理或手工 `task_id` 操作工具。 | ||
| - 所有 task-bound tools 都只能从当前 tool context 的 `sessionID` 反查绑定 Task;若不存在唯一绑定,必须显式失败。 | ||
| - `mark-task-status` 只允许一个 `status` 参数,并由插件统一维护 `updated_at` 与 `done` 派生关系。 | ||
| - `dispatch-tasks` 必须覆盖 5 条分支:扫描 `done = false`、恢复已有 session、busy session 跳过、失效 session 重认领、未绑定 task 创建并绑定新 session 后发送首条 prompt。 | ||
| - prompt 只能暴露 Task 快照,不得出现 `aim.sqlite`、`dbPath`、`SELECT`、`UPDATE`、表名或 SQL 规则。 | ||
| - 若数据库可打开但现有 `tasks` schema 与运行时要求不兼容,相关入口必须显式失败,不尝试迁移。 |
There was a problem hiding this comment.
The PR description mentions “initialize and repair the … schema” and “done-column repair behavior”, but this plan/spec explicitly says the runtime must not do schema migration/repair and should fail fast on incompatible tasks tables. Please align the PR description (or the plan) so reviewers/users aren’t misled about whether schema repair is expected.
Summary
Verification