Skip to content

feat(server): board leads follow the engine's model pick and swap on a usage limit - #199

Merged
polymaniadeveloper-hub merged 8 commits into
masterfrom
feat/board-lead-model-pick
Nov 24, 2026
Merged

polymaniadeveloper-hub merged 8 commits into
masterfrom
feat/board-lead-model-pick

Conversation

@polymaniadeveloper-hub

@polymaniadeveloper-hub polymaniadeveloper-hub commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

This is PR C of the board revamp, slice 4b, the T3 half: "The model pick" and "Publishing the current model" in BOARD-REVAMP-UI-SPEC.md section 6a. The engine half is merged in Operation-PaperClip. PR A was #196.

Problem

The engine now publishes each seat's model of record (seatModels and currentModel) and picks a replacement lead when the lead hits a limit (POST /api/tasks/:id/lead-pick). T3 ignored both:

  • A board task's lead thread kept the team's configured model, even when the engine's record had moved on.
  • A usage-limited board lead just failed. LimitedSeatSwap skips server-owned threads, so it never reached board threads.

What changed

  • Follow the model of record.
    • When BoardTaskThreads binds a task, it uses the lead seat's seatModels entry, and falls back to the team's configured model only on engines that serve no seatModels.
    • Turns the server sends into a board thread (steers and the QA hand-off notice) carry the current lead model while the provider family is unchanged. The family test is modelAccountFamily.
    • A family change is never made inside the thread; it goes through the lead swap.
    • A turn a person sends keeps the model they chose.
  • Lead swap. LimitedSeatSwap gains one branch for board lead threads whose latest run failed on usage_limit. The existing layerWorker trigger starts it.
    • It calls lead-pick with the limited harness and model, through the keyed boardThreadAct.
    • On a pick, it resolves the provider with the shared resolveSeatProvider, then creates the successor with thread.create, carrying the board-task marker and the picked model. It reuses the existing limited-lead hand-off id and disarm command.
    • It sends a first turn with a hand-off summary built from the task detail (facts only), then moves the link with PUT board-thread, with expect set to the old link.
    • On none-free there is no successor and no link move; the engine pauses the run. moved, refused and not-found change nothing.
    • It does not use thread.fork, which carries no engineIntake (ThreadForkService.ts:123), and the upstream fork code is untouched.
  • Retry and cleanup. The 30-second reconcile pass protects a successor whose link move is still pending. It makes sure the successor has its first turn, and retries a failed link move with expect = the old link; on a conflict it lets the engine's value stand. After the move it archives the displaced lead, which stays readable from the board's archive, and it keeps the task's claim for the successor.
  • One link-write queue. Initial binding and swap link writes share one DeliveryService semaphore.
  • No new marker reads. Marker reads go through BoardThreadRows, so the boardThreadMarker.test.ts guard lists are unchanged.

T3 pieces reused: LimitedSeatSwap (its worker, leadLimit, the hand-off id and the disarm command), BoardTaskThreads.bind's thread.create path and marker, seatProvider.resolveSeatProvider, modelAccountFamily, boardThreadAct with its key, and the board archive.

Verification

  • CI: all 20 checks pass on d92385c.
  • The AMD desktop had about 2 GB free, so only named test files ran there, one at a time:
    • BoardTaskThreads.test.ts 26/26
    • LimitedSeatSwap.test.ts 18/18
    • SeatHandoffs.test.ts 21/21
    • boardThreadMarker.test.ts 4/4
    • runtimeLayer.test.ts 214/214
    • AgentContextBudget.test.ts 2/2
  • Every regression test was written first and failed before its fix.
  • fmt and lint are clean on the changed files.
  • The maintainer approved --no-verify commits, because the commit hook's two repo-wide knip passes and the typechecks don't fit in that machine's memory. Hosted CI runs the full typecheck, knip and lint.
  • CI caught four things, all fixed:
    • Marker reads in LimitedSeatSwap that the marker guard rejected; they were rerouted through BoardThreadRows.
    • Branded-id mismatches in the new tests.
    • An instanceof check on an Effect Schema class, replaced with a hoisted Schema.is.
    • The no-inline-schema-compile lint error.
  • CI truncated the server typecheck's errors. A temporary CI step from feat(delivery): file board tasks from a thread and pull a board into it #201 printed them, and it was reverted in the same push as the fix, so git diff origin/master -- .github/ is empty.

QA findings (GLM 5.3 via OpenCode, independent read-only review, after a canary turn)

Verdict: pass with fixes. All fixes are in 18667ee, with tests.

  1. Should-fix. A swap interrupted between thread.create and its first turn left the successor linked with no hand-off turn. Reconcile now runs the existing successor branch, which dispatches the turn with the deterministic :continue id before moving the link. A restart test asserts exactly one turn.
  2. Should-fix. The first pass after a swap released the claim it had just taken for the successor. A displaced row now keeps the lease when another open thread of the same task holds the link on this environment. The test asserts the lease origin is the successor.
  3. Nit, left as is. A retry may file lead-pick again. That is engine-side rows only, with unchanged behaviour.
  4. Nit. A person's deliberate re-link to the old lead during the lost-PUT window was reverted. The retry now stops once the successor's turn exists and the old lead has a newer user turn or a changed latest run. A test covers it.
  5. Nit. The swap's link write bypassed the single link-write queue. The write is now shared through the DeliveryService semaphore.
  6. Nit. The QA notice's model-following path was untested, and a failed detail read suppressed the notice. Now a seatModels variant is tested, and a read failure dispatches the notice without a model override (asserted).

GLM also confirmed:

  • the wire shapes and coded refusals
  • idempotent ids
  • authority: the engine link must name this thread on this environment
  • model following within a family
  • the runtime layer: nothing stateful is built twice
  • no regressions in team chat, NativeTeamChat or SeatHandoffs

🤖 Generated with Claude Code

Model: Claude Opus 5.5 (lead) with Codex gpt-6.2-sol (builder), in Claude Code under T3 Code.

…a usage limit

Board lead threads and server turns follow the engine's published seat model within a provider family.
A usage-limited board lead asks the engine for a lead pick, starts a marked successor thread with a hand-off summary, and moves the task's link. The reconcile pass retries a failed link move.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… thread rows

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…anged

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s its claim

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…before merge)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reverts the temporary CI step that printed the server typecheck errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@polymaniadeveloper-hub
polymaniadeveloper-hub marked this pull request as ready for review November 24, 2026 12:57
@polymaniadeveloper-hub
polymaniadeveloper-hub merged commit d0e0d2d into master Nov 24, 2026
21 checks passed
polymaniadeveloper-hub pushed a commit that referenced this pull request Nov 24, 2026
…r the master merge

#199 moved BOARD_THREAD_KEY_VARIABLE from BoardTaskThreads to DeliveryService.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants