Skip to content

feat(rooms): several agents can answer on the side at once, and one review call can ask a council - #948

Merged
badcuban merged 3 commits into
mainfrom
feat/parallel-room-reviews
Nov 16, 2026
Merged

badcuban merged 3 commits into
mainfrom
feat/parallel-room-reviews

Conversation

@badcuban

Copy link
Copy Markdown
Collaborator

A room ran one side answer at a time. A "council" of reviewers (say Sol, Opus and Grok on the same diff) had to go one after another, and every review counted against the agents' three requests per user message, so a second round was refused.

What changes

  • Up to three side answers at once, one per agent. A thread's live side answers are a list, sideTurns, oldest first; sideTurn stays as the first entry for older clients. Everything reads them through @threadlines/shared/sideTurns, by id: the decider, the request decisions, the reactor (start, re-checks, interrupt, timeout, caller-turn-ended, session stop and restart loop over all), runtime ingestion's late-output guard, both projections and the web store. Events are unchanged: started appends, running and interrupt-requested update by id, settled removes by id.
  • Storage without a migration. projection_threads.side_turn now holds a JSON array (null when none). A row holding the old single object reads as a list of one, so nothing is rewritten.
  • A council in one call. room_review takes agents (two or three) instead of agent. The changes are captured once, each agent gets its own request sharing a batchId, they run side by side, and the result lists each review in reviews. An identical retry joins the running call; a call dropped during capture sends nothing.
  • The limit still stops chains. A batch counts once toward ROOM_AGENT_REQUEST_LIMIT, remembered in batchesSinceUser (cleared when the user writes), so a member is never re-counted or refused however its siblings settle. Requests outside the batch still wait for the user.
  • Busy rules per agent. Asking an agent already answering, or a fourth, is refused, including a guest an invite brings back. The user can now ask a second agent while one answers. A queued message waits only for its own agent's side answer.

Tradeoffs

  • Older clients connected to a newer server see only the first live answer through sideTurn. Others read as stopped until they settle; the thread's Stop still stops them. Same skew we accepted for attachments.
  • Tool text grows ~0.5 KB on demand (room_review's description and its agents option) and 32 bytes up front (room_ask no longer says one answer at a time). agentContextBudget.json is updated; it's what agents need to know to run a council.

How it was checked

  • vp fmt, vp lint, vp run typecheck, the full unit suite (vp run test) and the full web browser suite pass. A desktop menu test failed once on this checkout's missing Electron install and passed on rerun.
  • New tests: a three-agent council counted once even when one review fails before the others start; agents answering side by side with per-agent and cap refusals; a held message not released by another agent's answer; the batch call (one capture, one batch, every review listed) and its refusals; a dropped batch during capture sends nothing; an old single-object row still reads.
  • Existing tests updated on purpose: ones that expected "one side answer per thread" or the old single-object storage now expect the list.
  • The plan and the diff were each reviewed independently; all seven findings were fixed.

Not checked: a live council with real agents in the running app.

…eview call can ask a council

A room ran one side answer at a time, so a council of reviewers had to go
one after another, and each review counted against the agents' request
limit, which refused a second round.

- A thread's live side answers are a list (sideTurns), up to three, one per
  agent; sideTurn stays as the first for older clients. Every lookup goes
  through @threadlines/shared/sideTurns, by id, in the decider, the request
  decisions, the reactor, ingestion, both projections and the web store.
- projection_threads.side_turn holds a JSON array; a row with the old single
  object reads as a list of one. No migration.
- room_review takes agents (two or three): the changes are captured once,
  each agent gets its own request sharing a batchId, and they run side by
  side; the result lists each review. A batch counts once toward the
  request limit (batchesSinceUser), however its members settle.
- Busy rules are per agent plus the cap, including a guest brought back by
  an invite. A held message waits only for its own agent's answer.
@vercel

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
threadlines Ready Ready Preview Nov 16, 2026 9:44am UTC

Request Review

@badcuban
badcuban added this pull request to the merge queue Nov 16, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 16, 2026
@badcuban
badcuban added this pull request to the merge queue Nov 16, 2026
Merged via the queue into main with commit c293cad Nov 16, 2026
24 checks passed
@badcuban
badcuban deleted the feat/parallel-room-reviews branch November 16, 2026 09:55

This branch was successfully deployed

1 active deployment
Preview — 1d6442a9 Deployed Nov 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant