codebyplan 1.13.26 → 1.13.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/templates/rules/todo-backend.md +20 -7
package/dist/cli.js
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
scope: org-shared
|
|
3
3
|
paths:
|
|
4
4
|
- "apps/todo-worker/**"
|
|
5
|
-
- "
|
|
5
|
+
- "packages/mcp-tools/src/**"
|
|
6
6
|
- "supabase/migrations/*todos*"
|
|
7
7
|
- "supabase/migrations/*worktrees*"
|
|
8
8
|
---
|
|
@@ -31,7 +31,7 @@ The worker is a passive cross-checker (`apps/todo-worker/src/invariants/check.ts
|
|
|
31
31
|
`todos_jobs` is the work queue drained by the worker.
|
|
32
32
|
|
|
33
33
|
```
|
|
34
|
-
MCP write →
|
|
34
|
+
MCP write → enqueueTodosJob → todos_jobs (status='pending')
|
|
35
35
|
↓
|
|
36
36
|
worker claim_todos_job (SELECT … FOR UPDATE SKIP LOCKED)
|
|
37
37
|
↓
|
|
@@ -72,23 +72,36 @@ The queue head (`get_todos` `rows[0]`) maps to one of these slash commands. The
|
|
|
72
72
|
|
|
73
73
|
## 5. Heartbeat policy
|
|
74
74
|
|
|
75
|
-
The worker's `node-cron` heartbeat runs at `0 0 * * *` (UTC midnight). It enumerates every `(repo, worktree, user)` tuple with an active checkpoint OR in-progress standalone task and enqueues a `HEARTBEAT_SWEEP` todos_jobs row for each. This catches drift from missed `
|
|
75
|
+
The worker's `node-cron` heartbeat runs at `0 0 * * *` (UTC midnight). It enumerates every `(repo, worktree, user)` tuple with an active checkpoint OR in-progress standalone task and enqueues a `HEARTBEAT_SWEEP` todos_jobs row for each. This catches drift from missed `enqueueTodosJob` calls in MCP writers.
|
|
76
76
|
|
|
77
77
|
Backoff: a failed job retries at `now + 2^attempts minutes` (cap 60min). After 3 attempts, the job stays `failed` and the heartbeat picks it up again at the next sweep.
|
|
78
78
|
|
|
79
79
|
## 6. Writer obligations — every MCP write enqueues
|
|
80
80
|
|
|
81
|
-
`
|
|
81
|
+
The shared enqueue helper lives at `packages/mcp-tools/src/tools/enqueue-todos.ts`:
|
|
82
82
|
|
|
83
83
|
```ts
|
|
84
|
-
|
|
84
|
+
enqueueTodosJob(
|
|
85
|
+
client: SupabaseClient,
|
|
86
|
+
repoId: string,
|
|
87
|
+
callerWorktreeId: string | undefined,
|
|
88
|
+
userId: string | null,
|
|
89
|
+
reason: string
|
|
90
|
+
): Promise<void>
|
|
85
91
|
```
|
|
86
92
|
|
|
87
|
-
|
|
93
|
+
Two write modules import this helper:
|
|
94
|
+
|
|
95
|
+
- **`packages/mcp-tools/src/tools/write.ts`** — checkpoint-bound writers (11 tools)
|
|
96
|
+
- **`packages/mcp-tools/src/tools/standalone-write.ts`** — standalone task writers
|
|
97
|
+
|
|
98
|
+
Every workflow mutator MUST call `void enqueueTodosJob(...)` after the mutation succeeds. The 11 checkpoint-bound writers in `write.ts` (CHK-122 + CHK-189):
|
|
88
99
|
|
|
89
100
|
`create_checkpoint, update_checkpoint, complete_checkpoint, create_task, update_task, complete_task, add_round, update_round, complete_round, create_session_log, update_session_log`
|
|
90
101
|
|
|
91
|
-
|
|
102
|
+
**Dead code note**: `apps/web/src/lib/mcp/enqueueTodoJob.ts` and its companion test are orphaned dead code — `apps/web` no longer registers any MCP write tools (they live in `packages/mcp-tools`). Do not add new callers there.
|
|
103
|
+
|
|
104
|
+
**Removed tools**: `enqueue_todo_job` and `bind_worktree_user` no longer exist. Do not reference or recreate them.
|
|
92
105
|
|
|
93
106
|
**Contract**: best-effort. The helper logs and swallows failures — the heartbeat catches anything that slips through. Atomic in-txn enqueue is NOT supported (supabase-js limitation); the worker's bounded staleness (next heartbeat ≤ 24h) is the safety net.
|
|
94
107
|
|