Skip to content

feat(workboard): dispatch cards to Claude Code sessions on paired nodes - #18

Merged
tomorrowflow merged 1 commit into
mainfrom
feat/workboard-node-claude-target
Oct 9, 2026
Merged

tomorrowflow merged 1 commit into
mainfrom
feat/workboard-node-claude-target

Conversation

@tomorrowflow

Copy link
Copy Markdown
Owner

Problem

Dev-loop tickets need to run as fresh Claude Code sessions on paired nodes, in a per-ticket worktree, with a model chosen per role (design decisions D36, D38/D42, D40). Until now, Workboard dispatch could only start Gateway subagents, and node ticket sessions have no Workboard tools to report back with.

Solution

The Gateway already supports this. sessions.create with execNode, cwd and model: "claude-cli/<model>" starts a fresh claude -p on the node in that folder, and later turns resume it. So this PR changes only the Workboard plugin; there are no core or SDK changes.

Card target. A card can carry metadata.automation.target = { kind: "node-claude", nodeId, repoPath, worktreesRoot, baseRef?, model? }.

Dispatch. The dispatcher:

  • refuses node targets unless dispatch is unrestricted;
  • includes the target in the claim's authority check;
  • creates factory/<card> as a worktree in the node's own clone through node.invoke system.run;
  • records the worktree's base commit with the prepared launch, for the bundle check in slice 2;
  • starts the session through sessions.create.

Reporting. The turn contract asks the session to end with a fenced workboard-report JSON block. agent_end maps that report onto the card:

Report Card result
done with at least one passed proof and none failed Proofs and summary recorded, then lifecycle sync moves the card to review
needs_input or blocked Blocked, with the reason or questions as a comment
Failing or skipped-only proof, or a missing or invalid report Blocked

The 60 s sweep no longer moves a finished node ticket to review, because that would skip the report check.

Retries. Node tickets hold their claim for 2 h by default, since they can't heartbeat. A retry reuses the worktree that a failed launch left on the card's branch.

Line cap. To keep store-normalizers.ts under its line cap, normalizeBoundedString moves to store-value-normalizers.ts and all its importers switch to it. The target normalizer moves to store-target-normalizers.ts.

Not in this slice

  • Bundle fetch, verification, import, the dev push, and node worktree cleanup (slice 2).
  • Trust KPIs (slice 3).
  • Per-owner concurrency: Workboard still allows one active card per agent.

Evidence

Real flow. I ran an isolated Gateway from this branch (profile m1) against a Docker node host (Claude Code 2.1.293):

  1. Created a card with a node-claude target, then called workboard.cards.start.
  2. The worktree factory/<card> was created on the node, with its base commit recorded.
  3. The Claude turn (Haiku 5.5) committed b78bdb7. The base commit is its ancestor.
  4. The card moved to review with two passed proofs and the summary comment.

Bugs the real flow found and this PR fixes:

  • A plugin sessions.create that carries an idempotencyKey is rejected ("requires an authenticated principal"), so the dispatcher no longer sends one.
  • The orphan worktree left by a failed start blocked the retry; retries now reuse it.

Tests.

  • New: dispatcher.node-ticket.test.ts (4 tests) and node-ticket cases in lifecycle-sync.test.ts (7 tests). They use a real SQLite store and fake only gateway.request.
  • The sweep-guard test fails with the guard removed ("expected 'review' to be 'running'").
  • node scripts/run-vitest.mjs extensions/workboard packages/workboard-contract: 399 passed, 64 s wall time. No real timers.

Checks.

  • Pass: tsgo:extensions, tsgo:extensions:test, lint:extensions, the production dead-export scan, check:import-cycles, and the line-cap ratchet.
  • Inherited failures, identical on main:
  • Local runs of the compiled-worker test lane needed a temporary untracked copy of .github/workflows/plugin-npm-release.yml, which the fork deletes. It is not part of this PR.

Review. autoreview (Codex gpt-6.1-sol, P1) found one issue: a done report with only skipped proof could reach review. It's fixed, and the case is covered by a test.

🤖 Generated with Claude Code

A card can now carry `metadata.automation.target = { kind: "node-claude",
nodeId, repoPath, worktreesRoot, baseRef?, model? }`. For such cards the
dispatcher creates the ticket worktree (`factory/<card>`) in the node's own
clone through `node.invoke` `system.run`, records its base commit with the
prepared launch, and starts a fresh Claude Code session in it through
`sessions.create` with `execNode`, `cwd`, and the card's model. Only
unrestricted dispatch may start a node ticket, and the target joins the
claim's authority check.

Node tickets cannot call Workboard tools, so the turn contract asks for a
final `workboard-report` block. `agent_end` maps it: done with passing proof
records the proof and summary and lets lifecycle sync move the card to
review; questions, blocks, failing or missing proof, and missing or invalid
reports block the card with the reason. The lifecycle sweep no longer moves a
finished node ticket to review on its own. Node tickets hold their claim for
two hours by default, and a retry reuses the worktree a failed launch left on
the card's branch.

`normalizeBoundedString` moves to `store-value-normalizers.ts` and the target
normalizer to `store-target-normalizers.ts`, keeping `store-normalizers.ts`
under its line-cap ratchet without an import cycle.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@tomorrowflow
tomorrowflow merged commit 8941065 into main Oct 9, 2026
@tomorrowflow
tomorrowflow deleted the feat/workboard-node-claude-target branch October 9, 2026 05:32
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.

1 participant