Skip to content

feat: rooms, promise badges, handoff and decision cards on threads - #202

Open
nullStack65 wants to merge 3 commits into
release/native-0.1.10from
cos/room-primitive
Open

nullStack65 wants to merge 3 commits into
release/native-0.1.10from
cos/room-primitive

Conversation

@nullStack65

@nullStack65 nullStack65 commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Hold merging until the release-line freeze lifts at 2026-11-25 22:00 UTC.

A founder can now talk to several bots in one place, the bots can show what they promised and when it is due, and a founder decision can show its options. Until now each bot conversation was separate, and nothing on a thread showed promises, handoffs or decision options.

What it adds

  1. Room. A thread facilitates a room with two to eight member bot threads. Its own agent, the facilitator, sends each founder message to every member with t3_thread_send, waits with t3_thread_wait, reads the replies with t3_thread_read, and answers with each member's view by name plus a short synthesis. On close, t3_thread_update (action collaborate, close_room) stores the summary and decisions and returns roomRecord: a Markdown Linear comment for the named issue and a memory entry. The facilitator then writes both with its own Linear and memory tools.
  2. Promise badge. set_promise / keep_promise. The card turns red when a promise is overdue. It re-renders once at each due time with no polling (new useNowAcross, built on the existing deadline store).
  3. Handoff card. set_handoff: from → to, what, and an optional due time (red once overdue). null clears it.
  4. Decision card. request_decision accepts optional options (2 to 5 {label, effect}) and a recommendation that must name one of them. The asked founder sees the options with their effects, and the recommended one is highlighted. Picking one inserts Decision: <label> (or Review: / Approval:, to match the ask) into the composer, so the founder still sends the reply, and the reply closes the ask as it does today.

Design note

Data model. There is one optional collaboration field on the thread (packages/contracts/src/threadCollaboration.ts): { room?, promises?, handoff? }. A room is {topic, members: ThreadId[], linearIssue?, openedAt, closedAt?, close?: {summary, decisions[{text, owner?, dueAt?}]}}. Promises are {id, text, dueAt, owner?, keptAt?}, with at most 10 open at once. A pure applyCollaborationUpdate runs in the decider and leaves the state unchanged on an invalid update, so a replayed command can't fail. A stored value that a later rule rejects decodes as {}.

What it reuses.

  • The existing thread.metadata.update command and thread.metadata-updated event, with no new event types. The thread row stores its payload as JSON, so there is no migration.
  • The t3_thread_update MCP tool, with one new action.
  • The thread shell, so clients get the field with no new reads.
  • The existing per-turn run note (as for the deferred delegation nudge), which reminds an open room's facilitator how to fan out.
  • The thread tools for the fan-out itself.
  • The existing composer banner stack for the web cards.

Tradeoffs.

  • The agent fans out, not the server. There is no new reactor or service, and it works across linked environments wherever t3_thread_send already does. The cost is that turn-taking is only as fair as the facilitator's prompt. A server-driven fan-out would be stricter and much larger.
  • Linear and memory writes happen in the facilitator, not on the server. The server has no Linear or memory hook. close_room returns the exact text, and the facilitator posts it with its own connectors. If the agent stops between closing and posting, the record is still on the thread but not yet in Linear or memory.
  • An open room adds about 700 bytes of note to each facilitator turn.
  • Agent context grows. The t3_thread_update input schema grows by 1,437 bytes. See "Needs sign-off".

Needs sign-off: agent context budget

src/provider/AgentContextBudget.test.ts fails on this branch. I did not change agentContextBudget.json. That is a maintainer decision. The release line was already over before this change: the base measures 61,917 bytes against a committed 61,564. That 353-byte gap came from the sidebar change for standing bots (#160, 858979b), which grew the create_threads and t3_thread_launch inbox text without updating the budget. This PR adds 1,437 bytes: 1,172 for the typed collaboration property, 212 for the decision options, 39 for the tool description sentence and 14 for the new action name. Only about 140 of those bytes are description text. Shortening my own descriptions saves 81 (measured, not applied). Trimming the five longest or duplicated existing tool texts saves 868 more (measured, not applied), which still leaves the total 841 bytes over.

Not in this PR

  • Mobile cards. The data reaches mobile in the shell, but nothing renders it yet.
  • A UI to open a room or keep a promise. Agents do both through MCP. The web has "Close room" and decision picks, and both only fill in the composer.
  • Before/after screenshots. No integrated client pass was run.

Verification

  • Typecheck: contracts, server and web all pass (effect-tsgo).
  • Lint on the changed files: clean. The one remaining warning is in existing ProjectionStore.ts code this PR doesn't touch.
  • Contracts: threadCollaboration.test.ts, threadInbox.test.ts and threadMetadataMcp.test.ts pass, 38 of 38.
  • Server, on Node 26.13.1: Orchestrator.control-reads (including a new room round-trip through the decider and the shell), ProviderTurnStartService, McpToolAccess, orchestrator tools, DelegationNudge and AgentContextBudget. 200 of 201 pass; the one failure is the budget test above.
  • Web browser test: useDeadline.browser.test.tsx passes, 2 of 2.
  • ThreadMetadataMcpService.test.ts (new) covers t3_thread_update collaborate: refusing missing, deleted and self members before dispatch; opening and closing a room with the returned record; and refusing a second close. 3 of 3 pass. The member test fails when the member check is disabled.
  • Review repairs (bc9a951): forks and subagents drop the room, a closed room refuses open_room, and collaborate command ids include the sub-action. Each has a test that fails without its fix. Contracts 40 of 40, and ThreadMetadataMcpService, SubagentProjection, ThreadForkService and Orchestrator.control-reads 70 of 70.

Deploy: fleet

Model: claude-opus-5-5
Task: feat

🤖 Generated with Claude Code

A thread can now facilitate a room of two or more bot threads. The room's
own agent fans each founder message out with t3_thread_send / wait / read,
and on close it returns a Linear comment and a memory entry for the
facilitator to write. Threads can also carry promises with due times (red
when overdue), a handoff (from, to, what, due), and a founder decision can
list options with effects and a recommendation.

All of it is one optional `collaboration` field on the thread, written
through the existing thread.metadata.update command and the
t3_thread_update MCP tool (new `collaborate` action). No new event types,
services or migrations. The web shows it as composer banner cards.

Model: claude-opus-5-5
Task: feat
Agent: Claude Code
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

The collaborate path refused missing, deleted and self room members
without a test. Cover those refusals, open then close with the returned
Linear and memory record, and the refused second close.

Model: claude-opus-5-5
Task: test
Agent: Claude Code
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nullStack65

Copy link
Copy Markdown
Owner Author

Note

🤖 grok-4.7 responding on behalf of nullStack65

Independent review of 4049c32c302f75b92e38f10ecde027b044daebd7. Automated reviewer, grok-4.7, Magpie Codex harness. Changes needed.

Forks and subagents copy an open room and then fan out as if they facilitated it. Opening a room again after close deletes the close record. One clientRequestId cannot distinguish an open from a close.

Important

  1. Copied rooms fan out from forks and children. makeSubagentChildThread and fork planning spread the parent thread and only strip delegatedFrom. An open room, its promises, and its handoff are copied. The next turn prepends roomFacilitatorNote for that copy, so the child treats itself as the facilitator. Strip collaboration in both constructors.
    packages/provider-core/src/server/subagentProjection.ts:69
    apps/server/src/orchestration-v2/ThreadForkService.ts:103
    apps/server/src/orchestration-v2/ProviderTurnStartService.ts:985

  2. Reopening after close deletes the record. open_room always replaces room. A closed room's closedAt and close are dropped, including the text close_room just returned. Refuse another open while that close is still stored, or keep the close where the next open cannot erase it.
    packages/contracts/src/threadCollaboration.ts:165

  3. One idempotency key covers every collaborate payload. commandId uses the action name collaborate, not the update type. The same clientRequestId replays the first command and returns success. An open followed by a close under that key leaves the room open and returns no roomRecord. Include the update type, or a hash of the payload, in the command id.
    apps/server/src/mcp/ThreadMetadataMcpService.ts:55

Nits

  1. threadShellFromProjection never copies collaboration, while shellFromState does. The live shell snapshot uses shellFromState, so the cards still appear. The in-memory shell does not.
    apps/server/src/orchestration-v2/ProjectionStore.ts:1975

  2. Decision option labels are not single-line, and a review or approval still prefills Decision: <label>. The click only fills the composer. It does not send or store a choice.
    packages/contracts/src/threadInbox.ts:63
    apps/web/src/components/chat/ComposerCollaboration.tsx:99

  3. open_room checks that each member exists and is not the room thread. It does not apply the mode or link checks t3_thread_send uses, so a room can name a thread the facilitator cannot message. Sending still enforces those checks. Reading a thread was already allowed for an orchestration caller. This does not open a new way into another thread.
    apps/server/src/mcp/ThreadMetadataMcpService.ts:245

Checked

  • A second close is refused before dispatch. A replayed close in the decider keeps the first close. Self, missing, and deleted members are refused. The three metadata-service tests and the shell round-trip cover that.
  • collaboration is optional. Existing threads decode without it. Unknown fields are ignored on decode, so an older client still accepts a thread that now has the field. No migration.
  • Picking an option does not spoof a decision. Nothing records the chosen label; the person still sends the draft. The close text is whatever the facilitator submits.
  • The new schema text is already short. The context-budget growth is the typed union, not spare description. I am not treating the existing budget failure as a finding.
  • Not overbuilt: one optional field, the existing metadata command, and composer banners. Mobile cards are left out on purpose.

Tests

Node 26.13.1 for the web test. Node 22.22.1 for the rest.

  • effect-tsgo tsrs --noEmit for contracts, server, and web: exit 0. The output is existing schema-brand suggestions, with no error in this diff.
  • Contract tests threadCollaboration, threadMetadataMcp, and threadInbox: 38 passed.
  • ThreadMetadataMcpService.test.ts and the room case in Orchestrator.control-reads.test.ts: 4 passed, 32 skipped by the name filter.
  • useDeadline.browser.test.tsx: 2 passed. Node 22 could not load the web config; Node 26 passed.

Checks

On 4049c32c302f75b92e38f10ecde027b044daebd7: Deploy line declared, Voice + inbox core, Voice + inbox web, Voice + inbox mobile, and Voice + founder inbox are success. Earlier cancelled runs of those same names are superseded. CodeRabbit is success and did not review.

- Forks and subagents no longer copy the source thread's room, promises
  or handoff, so their turns carry no facilitator note.
- open_room is refused once a room is closed, so the close record stays.
- collaborate command ids include the sub-action, so one clientRequestId
  can open and then close a room.
- The thread shell built from a projection carries collaboration.
- Decision option labels are single-line, and a pick drafts Decision,
  Review or Approval to match the ask.

Model: claude-opus-5-5
Task: fix
Agent: Claude Code
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nullStack65

Copy link
Copy Markdown
Owner Author

Repair note for the review above, pinned to head bc9a95102d6277ca4fa05968bea5fb7d1592744a (was 4049c32c30).

Important

  1. Forks and subagents inherited an open room. makeSubagentChildThread and ThreadForkService now drop collaboration along with delegatedFrom, so a child carries no room, promises or handoff. roomFacilitatorNote now takes the room or undefined, and turn start calls it directly. Tests: SubagentProjection.test.ts and ThreadForkService.test.ts give the source an open room and assert the child has no collaboration and an empty facilitator note. Both fail without the fix.
  2. open_room overwrote a closed room. collaborationUpdateError now refuses open_room once the room is closed, and applyCollaborationUpdate leaves the state as it was. Re-opening an open room to change its topic or members still works. Tests: threadCollaboration.test.ts checks that a reopen is refused and the state is unchanged, and ThreadMetadataMcpService.test.ts checks that a reopen after close is refused before dispatch.
  3. The idempotency key ignored the sub-action. collaborate command ids are now collaborate.<type> plus the clientRequestId. Other actions keep their existing ids. Test: the MCP service harness now replays a repeated command id as the orchestrator does, and "opens then closes a room under one clientRequestId" closes the room and returns roomRecord. It fails without the fix.

Nits

  1. threadShellFromProjection now copies collaboration.
  2. Decision option labels must be one line (test in threadCollaboration.test.ts), and a pick drafts Decision:, Review: or Approval: to match the ask.
  3. Left as is, with a code comment: open_room only checks that members exist, because t3_thread_send applies the mode and link checks on every message the facilitator sends.

Checks run on Node 26.13.1: typecheck passes for contracts, server, web and provider-core. Tests: contracts 40 of 40; ThreadMetadataMcpService, SubagentProjection, ThreadForkService and Orchestrator.control-reads 70 of 70; useDeadline.browser 2 of 2. Lint on the changed files is clean apart from one existing ProjectionStore.ts warning. The agent-context measurement is unchanged at 63,354 bytes, and that budget decision is still open.

This branch has not been deployed

No deployments
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