You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: TODOS.md
+62Lines changed: 62 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,32 @@
2
2
3
3
Items ordered from simplest to hardest.
4
4
5
+
## Regressions (introduced by sub-agent session)
6
+
7
+
### R1. `MCP_TaskClosed` neighbor selection still broken
8
+
9
+
`s.taskOrder.indexOf(taskId)` is called at `tasks.ts:902`**after**`cleanupPanelEntries` has already removed `taskId` from `s.taskOrder` (line 897). It always returns `-1`, so `neighborIdx` is always `0` — the active task always jumps to the first task instead of the adjacent one.
10
+
11
+
Fix: capture idx before `cleanupPanelEntries`, use the return value, and index into `s.taskOrder` (already filtered) rather than re-filtering.
### R2. `signalDoneReceived` and `needsReview` not persisted
16
+
17
+
Both fields exist on `Task` in `types.ts` but are absent from `saveState()` and `loadState()` in `persistence.ts`, and from `autosave.ts`. They are lost on app restart — "needs review" badges and done signals disappear on reload.
18
+
19
+
Fix: add both fields to `PersistedTask` in `types.ts` and include them in the save/load blocks in `persistence.ts` (active and collapsed), plus the autosave snapshot.
### R3. `createTask` failure cleanup incomplete — zombie tasks left in memory
24
+
25
+
On `createTask` failure, the `catch` block at `coordinator.ts:578` only restores the preamble file then re-throws. It does NOT call `this.tasks.delete(task.id)`, `this.tailBuffers.delete(agentId)`, `this.subscribers.delete(agentId)`, or `killAgent(agentId)`. If `spawnAgent` succeeded before the failure, a running PTY agent is leaked and the task remains in `this.tasks` indefinitely.
26
+
27
+
Fix: the catch block should remove all in-memory state and kill the agent if it was spawned (the full cleanup that was implemented earlier and reverted).
### 7. Autofire expiry window — coordinator in long tool call during countdown
@@ -65,6 +91,42 @@ drop-ack path should mark affected sub-tasks `needsReview` before acking.
65
91
66
92
## UI / Behavior
67
93
94
+
### R4. `.claude/settings.local.json` preamble injection not stripped before merge
95
+
96
+
For Claude agents, the preamble is written into `.claude/settings.local.json` (`coordinator.ts:446`). This file is assumed to be gitignored, but if a project tracks it, `git add -A` in the auto-commit will stage the injected preamble content and it will land in the merge. `stripPreambleFromBranch` has no code path for this file.
97
+
98
+
Fix: either explicitly `git restore .claude/settings.local.json` before auto-commit, or track it the same way as AGENTS.md/GEMINI.md (store original content, strip before commit).
### 12. `review_and_merge_task` merges before coordinator can review
103
+
104
+
`reviewAndMergeTask()` calls `getTaskDiff()` then immediately calls `mergeTask()` (`coordinator.ts:774-775`), returning the diff only after the merge is complete. The coordinator preamble instructs agents to "review the result and call `review_and_merge_task`" — but the diff arrives post-merge, so the "review" is cosmetic and cannot abort the merge.
105
+
106
+
Fix: either update the preamble to use `get_task_diff → merge_task → close_task` explicitly and deprecate `review_and_merge_task`, or split the tool into two calls with a genuine gate between them.
107
+
108
+
### 13. `gitIsolation` accepted by REST but silently ignored end-to-end
109
+
110
+
REST validates and forwards `gitIsolation` (`remote/server.ts:271`), but `MCPClient.createTask()` has no `gitIsolation` field, the MCP tool schema omits it, and `Coordinator.createTask()` always creates a worktree unconditionally. A caller that requests a different isolation mode gets a worktree with no error.
111
+
112
+
Fix: either remove `gitIsolation` from the REST path, or implement and forward only supported modes explicitly.
113
+
114
+
### 14. `SubTaskStrip` collapsed sub-task click selects without uncollapsing
115
+
116
+
The strip now includes collapsed sub-tasks, but the click handler only calls `setActiveTask(task.id)` (`SubTaskStrip.tsx:186`). Clicking a collapsed sub-task selects it without uncollapsing it, leaving it hidden.
117
+
118
+
Fix: if `task.collapsed`, call `uncollapseTask(task.id)` before `setActiveTask`.
`stripPreambleFromBranch()` deletes the preamble file when the content before the injected block is empty/whitespace (`coordinator.ts:800`). If a project had an intentionally empty tracked `AGENTS.md`, `GEMINI.md`, or `.agent.md`, the merge will stage its deletion.
125
+
126
+
Fix: store whether the file existed originally (not just its content) and always restore to original state — delete only if the file was newly created, restore the original bytes (even if empty) if it existed.
### 18. Sidebar drag indices wrong when coordinated children are hidden/nested
69
131
70
132
`taskIndexById` indexes raw `store.taskOrder` (`Sidebar.tsx:134`). Coordinated children are filtered out of the flat rendered list and nested under the coordinator (`sidebar-order.ts:54`). `computeDropIndex()` returns a rendered DOM index (`Sidebar.tsx:253`), then `reorderTask(from, to)` applies that index to raw `taskOrder` (`Sidebar.tsx:296`). If `taskOrder` contains hidden coordinated children, dragging top-level tasks can insert them between a coordinator and its child in raw order.
Copy file name to clipboardExpand all lines: electron/mcp/sub-task-preamble.ts
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,10 @@ You have one special MCP tool available via the parallel-code server:
5
5
- signal_done — Call this when your assigned work is fully complete and the coordinator should review it.
6
6
7
7
RULES:
8
-
1. Complete your assigned work fully before calling signal_done.
8
+
1. Complete your assigned work fully before calling signal_done. Before signaling:
9
+
- Commit all changes (git add -A && git commit) with a meaningful message.
10
+
- Run the project's tests and type checker and fix any failures you introduced. \
11
+
signal_done means "I verified it passes" — do not call it if tests or typecheck are failing.
9
12
2. Ask questions if requirements are unclear or if you are about to do something risky or destructive — the user can see your terminal and can respond.
10
13
3. When your work is done, call signal_done. Do NOT ask "what would you like to do?" or offer merge/PR options — signal_done is your finish line. Do NOT use finishing-a-development-branch or similar workflow skills.
Copy file name to clipboardExpand all lines: src/store/coordinator-preamble.ts
+45-24Lines changed: 45 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -11,36 +11,57 @@ You have MCP tools to coordinate work across isolated git worktree tasks:
11
11
- get_task_status — Detailed status of a task
12
12
- send_prompt — Send follow-up instructions to a task's agent
13
13
- wait_for_signal_done — Wait for ANY sub-task to call signal_done. Returns { taskId, name, remaining }.
14
-
- review_and_merge_task — Atomically get diff + merge + cleanup a completed task in one call.
15
14
- wait_for_idle — Wait until an agent is idle at its prompt (use for send_prompt follow-ups)
16
15
- get_task_diff — Get changed files and diff for a task
17
16
- get_task_output — Get recent terminal output from a task
18
17
- merge_task — Merge a task's branch into the base branch
19
-
- close_task — Close and clean up a task
18
+
- close_task — Close and clean up a task (ONLY after a successful merge_task)
20
19
21
20
RULES:
22
-
1. When asked to do work in parallel or break work into pieces, ALWAYS use the create_task MCP tool \
23
-
to create separate Parallel Code tasks. Do NOT use your built-in Agent tool for parallelization — \
24
-
the whole point of coordinator mode is isolated worktree tasks.
25
-
2. If the user's request is ambiguous or you are unsure how to split the work into tasks, \
26
-
ASK the user for clarification before creating tasks. It is better to ask a short question \
27
-
than to guess wrong and spin up tasks that do the wrong thing.
28
-
3. Assign each sub-agent one specific, concrete task — never point at a list and ask it to "pick one."
29
-
BAD: "Fix the most important items from KNOWN-TODOS."
30
-
GOOD: "Fix the orphaned notification badge. The spec: when X is received, set Y on the sub-task..."
31
-
Give sub-agents complete, self-contained context. Include file paths, expected behavior, and constraints — they start with zero memory of this conversation. Always specify baseBranch when calling create_task.
32
-
4. STANDARD WORKFLOW: create_task for each piece of work → then loop using wait_for_signal_done \
33
-
until remaining === 0 → for each returned task, review the result and call review_and_merge_task \
34
-
to land the work. NEVER chain wait_for_signal_done calls without reviewing the returned task first.
35
-
5. THE LOOP PATTERN — YOU MUST FOLLOW THIS EXACTLY:
36
-
a. Create all tasks upfront with create_task.
37
-
b. Call wait_for_signal_done() — NO taskId argument — to wait for ANY sub-task to complete.
38
-
c. IMMEDIATELY review the returned task (check diff, validate output).
39
-
d. Call review_and_merge_task(taskId) to merge and clean up.
40
-
e. If remaining > 0, go back to step (b). If remaining === 0, you are done.
41
-
6. Default to running at most 3 sub-agents concurrently. Try to avoid giving parallel sub-agents work that touches the same files — when overlap is unavoidable, run those tasks sequentially.
42
-
7. Before assigning a task, verify it is not already implemented. Read the relevant files rather than assuming work is pending.
43
-
8. Use send_prompt + wait_for_idle to give follow-up instructions to a running task.
21
+
1. You MUST NOT use your built-in Agent tool to spawn new Parallel Code tasks — you MUST use \
22
+
create_task for all new work. The sole EXCEPTION is review/landing: after wait_for_signal_done \
23
+
returns a completed taskId, you MUST immediately dispatch a native background Agent to run \
24
+
get_task_diff → merge_task → close_task for that taskId, then return to wait_for_signal_done \
25
+
without waiting for the Agent to finish. Give the background Agent the taskId and all context it \
26
+
needs to be self-contained.
27
+
2. If the user's request is ambiguous, the specified work queue file does not exist, or you are \
28
+
unsure how to split the work into tasks, STOP and ASK the user before proceeding. Do not improvise \
29
+
a work queue from other files or directories — work only from sources explicitly specified in your \
30
+
prompt.
31
+
3. Assign each sub-agent one specific, concrete task — never point at a list and ask it to "pick one." \
0 commit comments