Skip to content

Auto-dispatch a thread when an issue enters plan:todo (#165) - #334

Merged
currentbits merged 5 commits into
mainfrom
coder/auto-dispatch-threads-from-planboard-sta-b6f280
Aug 17, 2026
Merged

currentbits merged 5 commits into
mainfrom
coder/auto-dispatch-threads-from-planboard-sta-b6f280

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Closes #165.

The Planboard has been a launcher: every card needed a manual Start task click. This makes it a pipeline — opt a project in and any issue that enters plan:todo starts its own thread on its own worktree, without anyone watching the board.

What changed

electron/autodispatch.js (new) — a 5-minute ticker in the main process, modelled on the existing automations scheduler. Per tick, for every local project with autoDispatch === true:

  • list issues, take OPEN ones labeled plan:todo, ascending by number
  • run the same sequence the renderer's Start task button does: fetchIssue → createThread → mark pendingWorktree → broadcast threads:changed → startRun with the issue prompt → move the label to plan:doing
  • stop once 3 threads are in status: "working" across all projects (MAX_AUTO_DISPATCH_RUNNING)

Each auto-started thread gets its own worktree, since several run concurrently. The broadcast happens before startRun so the sidebar shows the thread immediately rather than when the run finishes. Nothing thrown by gh, a fetch, or a run can kill the ticker.

Per-project opt-in — project.autoDispatch persists through services.updateProject (true sets it, false deletes the key so old stores stay clean), is typed on ProjectInfo/ProjectUpdateInput, and is toggled by a checkbox in the Edit project modal. Off by default; remote projects are skipped entirely.

Wiring — started alongside the automations scheduler in main.js, stopped on shutdown.

Design notes

  • Dedup is the plan:doing label move itself: a dispatched issue no longer matches the plan:todo query. An in-memory Set covers the window where gh issue edit fails, bounding the damage to at most one duplicate per app restart rather than a duplicate every 5 minutes. Noted in a ponytail: comment at the Set.
  • "Stop on plan:done/closed" from the issue needs no code — an issue only ever leaves plan:todo on dispatch, so it never comes back around.
  • The concurrency cap is a constant, not a setting. A knob can follow if 3 turns out to be wrong.

Known gap: poll failures (broken gh auth, say) are silent — an opted-in project just does nothing. Surfacing that needs a store field and UI; deferred.

Testing

  • electron/test/autodispatch.test.js (new, 4 cases): dispatch creates the thread + starts the run with the issue prompt + moves the label; a project without the opt-in is untouched; the same issue is not dispatched twice across two ticks; the cap blocks dispatch at 3 working threads.

  • electron/test/projects-update.test.js, test/editProject.test.tsx: the flag persists, false clears it, an unrelated patch leaves it alone, and the checkbox round-trips.

  • Full suites: electron 898/899, renderer 777/777, npm run typecheck clean. The single failure is the web-integration reconnect test, which already fails on main.

  • PR created by the Claude Code agent

Willem and others added 4 commits August 17, 2026 15:35
Poll opt-in local projects every 5 minutes for OPEN plan:todo issues,
start a worktree thread per new one (cap 3 working), and move the
label to plan:doing. Same Start-task sequence as the renderer.
…165)

Write path for the Planboard auto-dispatch flag. true persists the key;
false deletes it so old stores stay clean. The edit-project modal exposes
the checkbox; the poller itself is the other half of this issue.
…into coder/auto-dispatch-threads-from-planboard-sta-b6f280
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

…hreads-from-planboard-sta-b6f280

# Conflicts:
#	electron/services.js
#	electron/test/projects-update.test.js
#	src/components/EditProjectModal.tsx
#	src/shared/ipc.ts
#	test/editProject.test.tsx
@currentbits
currentbits merged commit 6203d6d into main Aug 17, 2026
1 check failed
@currentbits
currentbits deleted the coder/auto-dispatch-threads-from-planboard-sta-b6f280 branch October 3, 2026 16:07
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.

Auto-dispatch threads from Planboard state (issue enters plan:todo)

1 participant