Agent pane: session offer chips behind an experiment
Summary
The agent-chat side of session offers (cx-807da), behind the session-offer experiment (default off). The look is a plain placeholder; it gets restyled to the reference later.
- An agent's
session_offerrecord draws a chip in the chat. The chip shows the offer's title and a note when the offer asks for a new worktree. - Start:
- starts the offered chat in the offer's folder (a new git worktree when asked), on the offer's agent and model;
- answers the offer with that chat (
_acpmux/offer_respond accepted, so acpmux records this chat as its parent); - sends the new chat the offer's prompt.
- The chat the person is in stays shown and keeps going. The new chat is attached hidden before its prompt, so its turn is not marked seen, and detached when the turn ends.
- Dismiss answers the offer
dismissed. - acpmux's
session_offer_decisionturns the chip into Started (with Open, which shows the new chat beside this one) or Dismissed. - Dogfood: set
cmux.experimentsto{"session-offer":"on"}in the pane's web inspector and reload.
The acpmux half (the record, the MCP tool, offer_respond) is #20305. The pane also asks for both kinds by name, so this does nothing harmful against an acpmux without them.
Testing
- Red, then green:
CMUX_BROWSER_TESTS=1 bun test test/agent-pane-session-offer.test.tsruns the real pane against a stand-in acpmux.- Red at 7378cd4f538b: the off case passed and the two chip cases failed.
- Green at the head: 3/3.
- It covers: the experiment off draws nothing; Start's
session/new(folder, agent, model); the hidden attach, prompt and detach of the new chat; the accepted answer; Dismiss.
- Gallery:
agent-pane.session-offershows the chip's states: open, Start, Dismiss, refused, started, dismissed, long title, and no worktree. bun run check,test/ui-rules.test.ts, the gallery coverage and play tests, andtest/pane-english.test.tsall pass.- Localization: 9
offer.*strings in all 21 locales;generated/strings.jsonwas regenerated on the merged head. - A review subagent ran correctness-first; its findings are fixed in the third commit.
- Found while recording in a DEV build: an offer the agent made during a turn folded into "Worked for …" once the turn ended, which hid Start and Dismiss. A red test (b6fa5d04), then the fix (8b8b3a80): offers stay out of the turn's fold, like subagent groups and the todo list.
- Not covered:
- In the app, Start does not work yet: the native pane host refuses
_acpmux/offer_respond(no entry in the pane policy), aftersession/newalready made the child chat (cx-kf0ve). The stand-in acpmux in the test does not go through that host. The experiment stays off until that lands. - A real-HID accept journey comes with the restyle.
- A Start that fails after the host made the worktree keeps that worktree; a retry reuses it.
- In the app, Start does not work yet: the native pane host refuses
Changelog
none
🤖 Generated with Claude Code
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Adds session offer chips to the agent pane, behind the session-offer experiment (off by default). With the experiment off, an agent's offers draw nothing; with it on, a session_offer record shows a chip with the offer's title, a new-worktree note when asked, and Start and Dismiss actions. The chip keeps its placeholder look until the design lands; the acpmux half (record, MCP tool, offer_respond) lands separately, and asking for offer kinds by name keeps older acpmux harmless.
Behavior
- Start opens the offered chat in the offer's folder (a new git worktree when asked), on the offer's agent and model, answers the offer with it, and sends it the offer's prompt; the current chat stays shown while the new one starts hidden and detaches when its turn ends.
- Dismiss answers the offer dismissed; the decision record turns the chip into Started (with Open) or Dismissed.
- An offer made during a turn stays out of the turn's fold, so Start and Dismiss stay visible once the turn ends.
- A retried Start reuses the worktree an earlier attempt made.