Skip to content

Support lightweight multi-agent prompt fan-out in composer - #424

Open
j-asefa wants to merge 1 commit into
mainfrom
loop/ux-3-multi-agent-prompt
Open

j-asefa wants to merge 1 commit into
mainfrom
loop/ux-3-multi-agent-prompt

Conversation

@j-asefa

@j-asefa j-asefa commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

Point 3 of the 7 Feed/composer UX items: send one new-thread prompt to up to three agents.

  • Picking recipients: in a new thread, connected non-selected agent pills get a + / ✓ toggle that adds up to two extra recipients (MAX_COMPOSER_RECIPIENTS = 3). The destination line reads Sends to @a, @b, @c, the button reads Send (N), and the Send options / Send later sheets list every recipient. It is off inside a thread, when replying to a message or result, with a leading @agent mention, with Let Loop choose, and for filing commands. Extras are saved with the composer draft (WorkspaceComposerDraft.extraRecipients).
  • Sending: each recipient goes through the existing durable single send (prepareStoredSend → submit/schedule → settleStoredSend), with its own receipt and idempotency key. Extras go first and the selected agent last.
    • An accepted extra is removed from the composer (dropExtraRecipient, which writes the saved composer immediately) before its receipt is settled.
    • The batch stops at the first failure. The draft stays, and the error says who already accepted: Sent to @vera. Not sent to the others: ….
    • A retry therefore sends only to agents that have not accepted. An uncertain (5xx/no response) recipient keeps its pending receipt and is repeated with the same key, so the server returns the original run instead of starting a second one.
    • A scheduled batch shows one toast naming every recipient, and Undo cancels every scheduled send.

Change from the earlier version of this PR

blackberry's version kept "accepted" receipts in sendReceiptStore to skip agents on retry. Review 1085016c found two P1s in that bookkeeping: a later single send reused an accepted key, and stale accepted receipts made a later identical batch skip an agent. There were also two Mediums: a retry with a different mode or time, and wrong toast wording. I replaced it with the design above. sendIntent.ts and sendReceiptStore.ts are now unchanged from main, and the UI and draft-state work is kept.

Known limitation

The recipient list is per tab (session storage), like the rest of the composer selection. If the tab is lost mid-batch and the user re-adds an agent that already accepted, that agent is sent the message again. That would be a new explicit send, not an automatic replay: uncertain sends keep their pending receipt and are always repeated with their original key.

Evidence (commit fed176e, on main e45900b…2ebe8291c)

  • npx vitest run test/composer-inline-handoff.test.tsx test/client-pending-identities.test.ts test/send-intent.test.ts test/drafts.test.ts test/workspace-drafts.test.ts test/composer-context.test.ts test/composer-launch.test.ts: 7 files, 46 tests passed. The new composer tests cover:
    • extras sent first and the selected agent last, with distinct keys
    • a 503 on one extra keeps its key for the retry, and the accepted extra is not re-sent
    • the final send clears the draft and names all recipients
    • a later solo send of the same text to an accepted agent gets a new key (the P1 from 1085016c)
    • a refused (409) extra stays in the composer
    • a scheduled batch creates three schedules, and Undo cancels all three
  • npm run typecheck and npm run build: exit 0. Prettier check on changed files: clean.
  • Not run: browser smokes and live providers. Full suites run in CI.

🤖 Generated with Claude Code

The composer's agent pills get a +/✓ toggle that adds up to two extra
recipients to a new thread (not in threads, replies, @mentions, routing or
filing commands). The destination line, Send button and send sheets name
every recipient.

Each recipient goes through the existing durable single send, with its own
receipt and idempotency key. Extras are sent first and the selected agent
last. An accepted extra is removed from the composer before its receipt
is settled, so a retry after a later failure sends only to the agents that
have not accepted it, and an uncertain one is repeated with its original
key. Scheduled batches report every recipient and Undo cancels them all.

Replaces the earlier accepted-receipt design on this branch, whose batch
bookkeeping in sendReceiptStore reused or skipped keys for later sends.
Based on blackberry's UI and draft-state work.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@j-asefa
j-asefa force-pushed the loop/ux-3-multi-agent-prompt branch from 4805c9e to fed176e Compare November 24, 2026 11:09
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