feat(chat): approval modes, questions, background shells and a model list for pdev chats
Merged
HA
1mo ago+699+699+012345678901234567890123456789-30-30-01234567890123456789
Summary
- Approval modes: pdev chats get Superset's Ask for approval / Approve for me / Full access. In Approve for me and Full access, pdev's permission requests are answered without showing a card.
- Questions: pdev's
ask_user_questionuses the same question form as Claude's. - Background shells: shells pdev starts with
bash_backgroundappear in the chat's background-task list, can be stopped from there, and leave the list when they end. - For all ACP chats:
- long approval labels truncate inside the card;
- an answered question shows the chosen label, not its option id;
- the last reply of a turn shows the model selected for it beside the time.
- Model picker: pdev's router models (
pdev/auto,claude,fun,writing,free) appear in the new-workspace model picker.
Why / Context
- pdev has no approval modes of its own. Its ACP
modesare thinking levels (off…high). The chat showed them as approval modes, repeating the effort setting that is already in the model picker. - pdev asks before every file edit. So a chat in "full access" still stopped on each one.
- Its permission bridge (
rawInput.method: "select") also carries questions. Every option is markedallow_once, including "Deny" and "Red / Green / Blue". - pdev doesn't send ACP background-task notifications. Its
bash_backgroundreports the shell in the tool result instead:rawOutput.details = {shellId, status, pid}.
How It Works
- Approval modes:
AcpAdaptergets aclientApprovalModesoption, enabled forpdev-acpin the ACP catalogue. Under it, an agent's ownmodeconfig option is ignored.- The adapter offers the three modes and keeps the selected mode locally. It never sends
session/set_modeto pdev, ignores pdev'scurrent_mode_update, and ignores mode ids it doesn't offer. - New chats start in Full access, like Claude and Codex. Resumed chats start in Ask for approval, the same as a resumed Claude chat.
- The adapter offers the three modes and keeps the selected mode locally. It never sends
- Permissions: a request whose title and one of its options both start with "Allow" is a permission, unless pdev's
ask_user_questiontool call is running, in which case it is always a question.- In Approve for me / Full access it is answered with that "Allow…" option, and no approval item is shown.
- Switching to one of those modes also answers any permission that is already waiting.
- Option kinds are taken from the labels, because pdev marks every option
allow_once: Deny isreject_once, "always" / "session" isallow_always, everything else isallow_once.
- Questions: any other request becomes a form shaped like Claude's, in every mode, and is never answered automatically.
- pdev's "Header: question" title is split into the field title and the message.
- The choices are a single-choice field, and the chosen option id goes back as the permission outcome.
- pdev's "Other (type an answer)" becomes an optional "Other" text box. A typed answer picks pdev's Other option, and the text is sent as the next prompt once pdev's turn ends.
- Background shells (on for every ACP agent; only pi-based agents such as pdev report shells this way):
- A tool result with
details.status: "running"starts a background task, named after the shell'sdescription(or itscommand). - A later
bash_output/kill_shellwith any other status ends it. So does a 2 s check that the process is still alive, because pdev doesn't report a shell finishing on its own. - Stop sends SIGTERM to the shell's process group, as pdev's
kill_shelldoes. Replayed history (session/load) is ignored.
- A tool result with
- Model label:
agent_messageitems get an optionalmodel, the label of the model selected when the message opened. Only live messages from ACP chats get it; the native Claude and Codex harnesses don't set it.
Manual QA Checklist
Checked against a real pdev acp 0.1.1 (the bundled version):
- An edit sends a permission request with "Allow once / Allow all edits this session / Deny", all
allow_once -
ask_user_questionarrives through the same bridge; picking "Other (type an answer)" ends the turn - The real
AcpAdapterin Full access:bash_background sleep 120shows as a task named "Sleeping for 120 seconds", with no approval item; Stop kills the process, and the task leaves the list about 2 s later - The real
AcpAdapterin Full access: a pdev question shows as a pending form (header "Color", Red / Green / Blue and an Other box); picking Blue makes pdev reply "Blue", and typing "purple" makes it reply "purple"
Not yet checked in the running app (reviewers please verify):
- The pdev chat mode picker shows the three modes; a new chat starts in Full access and a reopened one in Ask
- Ask for approval: an edit shows the card, with Deny as the plain button and long "Always allow…" labels truncated
- A pdev question renders as the question form, and the answered view shows the label
- A background shell shows in the chat's background tasks and can be stopped
- The model label appears beside the reply time in ACP chats (Claude over ACP, pdev)
Testing
bun test:packages/chat-runtime: 276packages/chat: 69packages/shared: 1376- host-service
src/chat-v3+src/trpc/router/agents: 105 - desktop ChatSession +
useAgentLaunchPreferences: 265
- New adapter tests use pdev's real option shapes. They cover:
- the client modes, and that an unknown mode id is ignored;
- a permission answered without a card;
- a permission left waiting in Ask, then answered when the mode switches;
- option kinds taken from the labels;
- a question answered through the form;
- a resumed chat starting in Ask;
- the model label;
- a shell listed and then ended by pdev's reported status;
- a real detached process stopped and then dropped once it has exited.
tsc --noEmitis clean for chat-runtime, chat and shared. host-service and desktop show no errors in touched files; their only errors are the existing better-auth type errors inpackages/trpc/packages/auth.biome checkon the changed files
Known Limitations
- pdev can't take a typed answer through its permission bridge, so a typed "Other" answer arrives as the next prompt. Before it does, pdev posts "input UI request is not supported in ACP yet" and asks once more.
- pdev only asks about edits, so Approve for me and Full access behave the same for it today.
- The selected approval mode isn't saved with the session, so a reopened pdev chat is back in Ask for approval.
- The background-shell check and Stop act on the pid pdev reports, on the host machine running both.
Feature flags
Everything here renders only inside the ACP chat pane, which needs acp-chat. The pdev pieces (modes, questions, model list) also need the pdev agent, which needs pdev-agent. clientApprovalModes is set only for pdev-acp. Background-shell tracking is on for every ACP agent, but it only starts on a tool result shaped like pi's (details.shellId with status: "running"), which Claude, Codex and OpenCode don't send.
Compatibility
modelis an optional field on a loose item schema, so older clients ignore it. No tRPC procedures change.
Follow-ups
- Conversation rewind (
/rewind, "Rewind to here"), including a file-based fork for pdev, which has no ACPsession/fork. Kept out of this PR.
Summary by CodeRabbit
- New Features
- Added selectable model options for the Pdev agent; the selected model appears beside agent replies.
- Added Ask for approval, Approve for me, and Full access modes. Permission requests can appear as choice forms, with support for custom answers.
- Background shell tasks can be tracked and stopped.
- Improvements
- Long model names, approval decisions, and option labels truncate to fit, with full text available on hover.
- Completed question answers display matching choice labels when available.