GeezerVison is showing github.com — feat(delivery): board task steps run inside the task thread by polymaniadeveloper-hub · Pull Request #213 · Tevin2119/t3code
Conversation
Problem
Slice T4 of the board revamp. Each engine board task already has a hidden T3 Orchestrator thread (#204, #205), but the engine's runners still did every model step. Under a board's t3 execution, the engine now queues each step as a native attempt v2 (Operation-PaperClip #192). T3 needs to run each attempt inside the task thread and report it back. The engine stays the referee for scheduling, the cap and queue, gates and restarts.
Design
BoardTaskExecution is a new server service (apps/server/src/delivery/BoardTaskExecution.ts). It follows the claim/attach/complete pattern of NativeIntake and NativeBuildExecution and has no LLM coordinator. It runs on a 30-second pass, and also on terminal run and subagent events of board task threads.
Which attempts it takes
- It lists
GET /api/native-builds?version=2 and reads each record.
- It acts only on tasks whose
boardThread is a marked thread on this environment.
- It skips a split parent (which has no thread), another owner's step, and an engine before v2 (which answers version 1).
The claim stays alive. Each pass renews the task's orchestration claim through a new BoardTaskThreads.holdTask, which shares the board pass's claim holder. Without a live claim, no step is claimed. So the engine never sends a held step to needs-decision after the board's hand-off wait.
The team plan is the brief.
- It is a
message.dispatch into the task thread: createdBy: "system", a message and command id derived from the attempt, and no notification.
- The text is the task as filed (title, body, acceptance items), then the engine's prompt under "How to answer".
NativeTeamChat.prepareTurn now runs the team round in a board task thread only for this brief message. Every other message there still goes to the lead alone.
complete carries the lead's last reply as the plan, with contributions from the round's contribution-stage seats.
Lead attempts (review, checks, a revise) are turns of the task thread.
- They carry the system
engineNotice, so prepareTurn starts no team round.
- When the engine picked another model of the same account family, the turn switches model in place. The
turnSelection logic moved out of BoardConversation.ts into seatProvider.ts, so both services share it.
- A lead on another harness runs as a
lead · <stage> subagent instead. Its child thread is attached as the lead receipt.
Seat batches (build, QA, specialist): one system turn per run and stage.
- Its notification carries a new
engine_stage source, defined in contracts. It lists each seat's attempt, a child thread id derived ahead of time, the model selection, access and worktree.
prepareTurn dispatches each seat as delegated_task.request at the run's starting step. Each child gets completionWake: "settled_only" and runs in the engine's worktree through existing_worktree. The prompt is read from the engine, not stored in the turn.
- A full-access (or
workspace) seat runs in full-access. A read-only seat runs in approval-required, and TeamChatReadOnlyReactor declines its change requests, as it does for team-chat seats.
- The lead's turn waits until every seat is terminal, then gets their results.
- Each child's final answer is posted as its attempt's text.
Identity and attestation
- Each seat is attested through the existing attestation call (
attestSeatWith, extracted from SeatHandoffs.attestSeatAs) when it is attached, before its child starts. So its QA receipts count for the current run.
- Every
complete reports the model and harness that actually ran the step:
- for a seat, the subagent's
executedModel or its latest run, and the provider instance's driver;
- for a lead turn, the run's model selection and its provider instance.
- It never reports the engine's pick. If the identity differs from the attestation at attach, the seat is attested again.
- A step that never started reports the task thread's own model and harness.
Replay safety. Every message, child and stop has a deterministic command id. Receipts make a replay after a T3 restart send nothing twice, and a lost attach is recovered from the projection. After an engine restart, recover() cancels the records: T3 stops the turn (run.interrupt) or the child (subagent.stop), then reports the terminal state. One step that fails never stops the others.
Out of scope. Merge, publish and deploy stay engine steps under the merge permission, and the QA-hold opt-in is unchanged. Nothing here switches a board to t3.
T3 pieces reused
NativeTeamChat.prepareTurn: the seat dispatch for both the brief and engine stages.
SeatHandoffs.attestSeatAs, extracted as attestSeatWith: attestation.
- The
turnSelection helper, moved from BoardConversation into seatProvider.ts.
BoardConversation.engineNotice: lead turns.
BoardTaskThreads: claims, via holdTask.
TeamChatReadOnlyReactor: read-only seats.
resolveSeatProvider and DELIVERY_HARNESS_BY_DRIVER: provider and harness mapping.
- Existing message dispatch,
delegated_task.request, run.interrupt and subagent.stop commands.
Web, mobile and client-runtime switches over notification source kinds handle engine_stage as a system turn.
Tests
The scratch engine (boardThreadEngine.testkit.ts) now models #192's v2 routes (list, detail, claim, attach, complete) with its owner, receipt and immutability rules, plus seat attestations.
BoardTaskExecution.test.ts runs through the real DeliveryService request path. Its thread store keeps the persisted messages, runs, subagents and receipts across restarts. It covers:
- the claim → attach → complete order;
- the brief running the team round and reporting contributions;
- lead turns carrying a system notice and switching model within the account family;
- seat batches under one system turn, in their worktrees and access;
- attestation before the children start, and again on a different executed model;
- the real executed model being reported;
- replay after a T3 restart mid-attempt;
- cancellation after an engine restart;
- the task claim kept alive across passes well past the lease;
engine boards, foreign owners, split parents and refused claims left untouched.
NativeTeamChat.test.ts covers the brief running the team round in a board task thread, and an engine stage starting its seats and waiting for them.
Results:
vp test run on BoardTaskExecution, NativeTeamChat, boardThreadMarker, BoardTaskThreads, SeatHandoffs and TeamChatReadOnlyReactor: 6 files, 140 tests passed, on the final merged tree.
vp run check:changed --timeout 3000, before the last master merge: format, lint, knip, graphql, tests (15 files) and the React compiler passed. Typecheck then failed only on the web engine_stage switch, which was fixed afterwards; web typecheck is now clean.
- Server typecheck is clean on the final tree.
Not verified
- No real turn was run. Neither the Replay provider nor a real provider ran a turn: the orchestrator is stubbed at
ThreadManagementService and ProjectionStore. The handoff between prepareTurn and ProviderTurnStartService for engine stages is not exercised end to end.
- Not run against the live engine. Nothing was run against the live engine or chore: sync upstream pingdotgg/t3code #192's real code. The v2 contract was checked only against the scratch model of chore: sync upstream pingdotgg/t3code #192 at 39c68e4b.
- Read-only QA may not be able to test. It uses T3's read-only semantics, where every change request is declined. A harness that asks before running commands, such as Claude in its default mode, may be unable to run tests as QA. This needs a real-provider check before E3 switches a board.
- A turn's model is its start selection. For a lead turn, the reported model is the run's model selection, since runs carry no
executedModel. Subagents report executedModel when the provider gives it.
- Reasoning is not mapped. The engine's
reasoning setting is not passed through (options stay empty). A null model resolves to the seat's pick in the thread's team, or the step stays with the engine.
- One small race. A seat cancelled while
prepareTurn is dispatching it could start a child after the attempt was completed cancelled.
- Fields chore: sync upstream pingdotgg/t3code #192 doesn't serve: none were needed.
Depends on engine PR Tevin2119/Operation-PaperClip#192 (v2 records, ?version=2, the identity on complete). Until it merges, the engine lists no v2 records and this service does nothing.
Model: Claude Opus 5.5 (claude-opus-5-5), harness: Claude Code in T3 Code.
🤖 Generated with Claude Code
QA (GLM-5.4, at 32400d6, Mac): FAIL
- Verified: the 140 named tests pass and the server typecheck is clean.
- Blocking:
- Lead turns and stage turns are refused by the Orchestrator. A notification needs
createdBy: "agent", but these turns send "system" (BoardTaskExecution.ts L420 and L566; Orchestrator.ts L7953).
- A queued run can't be interrupted.
run.interrupt is refused on a queued run, and the rejection is stored under a fixed id, so a cancelled brief that is still queued later runs anyway. Use queued-run.cancel (L434-446; Orchestrator L14406).
- Seat batches never start with fewer than two participants.
prepareTurn returns early when there is no lineup (NativeTeamChat.ts L229; DeliveryService L769).
- Lead turns run in the task thread's checkout, not the attempt's worktree.
stepTurn ignores record.worktree and record.access (L374-489).
- Non-blocking, with the identity item promoted to blocking by the conductor:
- Identity: local children never have
executedModel, so childOutcome reports the engine's pick (L268-274). The model that ran is on the child's provider turn (OrchestratorMcpService L1121).
- A seat whose child never starts is never failed.
- The cancel-while-starting race leaves an orphan.
- The stage message id depends on how the batch is made up.
- Engine steps are mirrored onto the board card as activity.
QA (Codex gpt-6.2-astra, at 32400d6, laptop): FAIL
- Verified: the v2 decoders match chore: sync upstream pingdotgg/t3code #192, nothing switches a board's mode,
workspace access counts as a writer, and 140 tests pass.
- Blocking:
- A read-only lead can write. A same-harness lead turn runs in the
full-access task thread, and its read-only access is never applied (L192; boardThreadMarker L60).
- A completion can report an identity that never ran. With no
executedModel and no readable run, T3 falls back to the requested model and the parent's driver, and chore: sync upstream pingdotgg/t3code #192 records that as reported (L268, L367, L457).
- A step can start after the task claim is lost.
claim() returns an attempt T3 already owns before it checks holdTask (L300, L309).
- A partial batch attach replays the parent turn under a new id (L516, L554, L571).
- A cancelled seat can start after its attempt is completed (NativeTeamChat L185; L604).
QA round 2, at ccc8691
Codex (laptop, source review): FAIL, one blocking finding.
- A completed team plan can strand the task thread in the engine's worktree and in
approval-required, because the restore happens only in the completing pass (BoardTaskExecution.ts L500-529, L740-747).
GLM (Mac, real Orchestrator, ProviderTurnStartService and NativeTeamChat): FAIL, four blocking findings.
- Engine seats never start.
delegated_task.request with existing_worktree leaves the child preparing. Only ThreadLaunchService.prepareRun releases it, and only the MCP delegate tool calls that (NativeTeamChat.ts L191-205; OrchestratorMcpService L3133).
- The stage turn never ends. The Orchestrator restarts a parent held at its start only for
teamChat tasks (Orchestrator.ts L15996-16006), and engine seats lack it.
- A running seat the engine cancels isn't stopped.
subagent.stop has no effect on an app-owned task with a bound run (BoardTaskExecution.ts L668-677; Orchestrator L14236-14256).
- The folder and mode don't always come back. This is the same as Codex's finding.
Verified:
- lead and stage turns are accepted;
- a queued brief is cancelled and a running one is interrupted;
- seats start with no lineup, then hit finding 1;
- worktree and access are correct once released;
- the team plan stays a thread turn.
Conductor ruling: reuse T3's existing delegation path end to end, and prove it on the real stack (see the builder thread).
QA round 3 (GLM-5.4, at 4b0906d, Mac; real-stack harness): PASS
All four round-2 findings are fixed on the real stack: the real ThreadLaunchService, ThreadManagementService and BoardThreadRows over SQLite, plus a server restart with boot recovery.
- Seats start.
- Stage turns wake and end. Two stages each woke the lead.
- An engine cancel stops a running seat.
- The folder and mode come back after a crash, even with the engine unreachable.
- Attempts report the model the provider reported,
test-model-0601.
The committed orchestrator test fails 3 of 4 on ccc8691, and reverting any one fix makes it fail. 166 delivery tests pass, and typecheck is clean.
Non-blocking (follow-ups for E3):
- After a T3 restart mid-step, the step is reported
cancelled with no model, which the engine can't tell apart from a cancel it asked for.
- The web labels an engine stage as "The team is gathering findings".
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…cution
# Conflicts:
# apps/server/src/delivery/BoardConversation.ts
# apps/server/src/delivery/boardThreadEngine.testkit.ts
…cution
# Conflicts:
# apps/server/src/delivery/BoardConversation.ts
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 27, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|