Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
feat(desktop): keep quick replies from putting the pet in Needs input (#2408)
Maxb3fc733f6ecb
diff --git a/docs/plans/2026-10-01-desktop-pet.md b/docs/plans/2026-10-01-desktop-pet.mdindex 011986f03..c29e9e778 100644--- a/docs/plans/2026-10-01-desktop-pet.md+++ b/docs/plans/2026-10-01-desktop-pet.md@@ -280,7 +280,7 @@ Two notes on the table:persisted, and a re-read on them can race. The fix is at the Runtime layer:when `set_quick_reply_chosen` newly records a choice, the messages endpointpublishes `message.updated` with the updated agent row after the write- commits. Every window then clears Needs input from one ordered event, and the+ commits. Every window then closes the group from one ordered event, and theWorkbench gains the same cross-tab lock for free. The window that clickedalso locks optimistically, as `QuickReplies` does today. This is a smallserver change in the shell-and-state PR, with a pytest that the event follows@@ -349,7 +349,7 @@ when the user changes the UI port, so it cannot own anything durable.late `404` for `A` cannot clear `B`: the route drops it, and`pet_unbind(A)` would be a no-op in the shell anyway.- Within one binding, a tail read started before a quick-reply- `message.updated` cannot land after it and restore Needs input.+ `message.updated` cannot land after it and reopen the group.- The switcher list is not tied to a binding, so it is fenced bygeneration only: an older `listSessions` response cannot overwrite anewer refresh that already lists a new session.@@ -363,7 +363,7 @@ comes from an API the Workbench already uses:| State | Condition | Source ||---|---|---|-| Needs input | pending vault request for `S`, or the latest agent result has unanswered `quick_replies` (see note below) | `GET /api/vault/requests?status=pending&session=S` (`usePendingVaultRequests`, refreshed on `vaults.updated` and expiry); message `content.quick_replies` and `quick_reply_chosen` |+| Needs input | pending vault request for `S` (quick replies do not count; see note below) | `GET /api/vault/requests?status=pending&session=S` (`usePendingVaultRequests`, refreshed on `vaults.updated` and expiry) || Blocked | `agent_status = failed` | `getSession(S)` and `session.status` (see Input freshness) || Ready | foreground idle and `unread_count > 0` | `inbox.unread.changed` (`unread_by_session`) || Running | `turn_state.foreground = running` or `in_flight` | `turn.start`/`turn.end` with `GET /api/sessions/S/turn-state`, as the chat page does |@@ -410,29 +410,28 @@ comes from an API the Workbench already uses:does not mark read at all. It shows "More in Avibe" (`pet_open` withthe session link) and leaves reading to the Workbench.-**Only the latest agent result's quick replies mean Needs input.** This is a-deliberate difference from the Workbench, which keeps every unanswered group-clickable regardless of age (`workbench-quick-replies.md`). Clickability is-about not blocking a user who wants an earlier option; the pet's state is-about what the agent is waiting for now. Once a newer agent result exists, the-agent has moved on, often because the user answered in free text without-pressing a button. An older unanswered group is therefore not an open-question, and treating it as one would hold the pet in Needs input-indefinitely with no action that clears it. Older groups stay clickable in the-Workbench, reached with "Open in Avibe". This also keeps the state computable-from the bounded tail, with no history scan.--A group is also answered by any user input after it (a row whose type lists-`user` in the catalog's `inputAuthors`; a display-only Show Page annotation is-not input). The user often answers-in free text, and that message starts a turn: until the next result lands the-agent is working on the answer, so the pet shows Running rather than Needs-input for the whole turn.+**Quick replies never change the state.** Agents end most replies with a+quick-reply group, so treating an unanswered group as Needs input left a bound+session in Needs input almost every time it was idle, and the state stopped+meaning "the agent cannot go on without you". Quick replies are suggestions:+the panel offers the open group as buttons, and answering one is a normal+send. Needs input is reserved for a wait that blocks the agent, which today is+a pending vault request.++The panel's open group (`openQuickReplies`) is the latest agent result's+group, while unanswered. This is a deliberate difference from the Workbench,+which keeps every unanswered group clickable regardless of age+(`workbench-quick-replies.md`): once a newer agent result exists the agent has+moved on, so the pet offers only the current group and older groups stay+clickable in the Workbench, reached with "Open in Avibe". A group is also+answered by any user input after it (a row whose type lists `user` in the+catalog's `inputAuthors`; a display-only Show Page annotation is not input).+This keeps the panel computable from the bounded tail, with no history scan.Tool approvals and `AskUserQuestion`-style waits do not exist today. Claude-runs with permissions bypassed and Codex auto-approves, so vault requests and-quick replies are the complete "needs input" set for now. A future backend that-asks the user must add its source to `derivePetState`.+runs with permissions bypassed and Codex auto-approves, so vault requests are+the complete "needs input" set for now. A future backend that asks the user+must add its source to `derivePetState`.### Panel@@ -450,8 +449,9 @@ Expanded, top to bottom:Token streaming would be a new Runtime transport and is a follow-up.3. **Activity strip** for `turn_state.background_activities`, reusing the chatpage's strip in a compact variant.-4. **Needs input.** Pending vault requests and quick-reply buttons. Quick- replies are answered in place, through the same path `QuickReplies` uses.+4. **Needs input and suggestions.** Pending vault requests, and the open+ quick-reply group as buttons. Quick replies are answered in place, through+ the same path `QuickReplies` uses.Vault requests get "Open in Avibe" (`pet_open` with the request's vaultslink), because approval UI stays in the Workbench in v1.@@ -621,8 +621,9 @@ The microphone usage string and audio-input entitlement already ship (#2293).binding to the workspace-notices session is cleared on load, and theswitcher lists a new active session that has no reply yet and omitsread-only ones;- - an older unanswered quick-reply group under a newer agent result does not- derive Needs input; the hotkey with+ - an open quick-reply group is offered in the panel but leaves the state+ Idle, and only a pending vault request derives Needs input; an older+ unanswered group under a newer agent result is not offered; the hotkey withno valid binding opens the switcher and never starts capture;- before setup is complete, `/pet` renders its setup-pending state and isnot redirected to `/setup`;@@ -641,7 +642,7 @@ The microphone usage string and audio-input entitlement already ship (#2293).- each row of the input-freshness table: the initial read on bind, eachlive trigger, and each gap fallback re-read the authoritative API, andlive rows merge without duplicates;- - a `message.updated` row carrying `quick_reply_chosen` clears Needs input;+ - a `message.updated` row carrying `quick_reply_chosen` closes the group;- a freshly bound session that is already failed derives Blocked from`getSession(S)`, with no provider row present;- any `runs.updated`, including one whose `session_id` is the executor anddiff --git a/ui/src/pet/PetPage.test.tsx b/ui/src/pet/PetPage.test.tsxindex 4b18055d0..6753c605a 100644--- a/ui/src/pet/PetPage.test.tsx+++ b/ui/src/pet/PetPage.test.tsx@@ -304,14 +304,25 @@ describe('PetPage binding', () => {});describe('PetPage state', () => {- it('shows Needs input for an open quick-reply group and clears it on message.updated', async () => {+ it('offers an open quick-reply group in the panel without asking for attention', async () => {const asking = message('q', 'S', { content: { quick_replies: ['Yes', 'No'] } });tails.S = [message('u', 'S', { author: 'user', type: 'user' }), asking];devBind('S');render(<PetPage />);- await waitFor(() => expect(pose()).toBe('needs_input'));- await emit((h) => h.onMessageUpdated?.({ ...asking, content: { ...asking.content, quick_reply_chosen: 'Yes' } }));- await waitFor(() => expect(pose()).toBe('idle'));+ summon('show');+ expect(await screen.findByText('Yes')).toBeTruthy();+ expect(pose()).toBe('idle');+ });++ it('asks for attention only for a pending vault request', async () => {+ api.getVaultRequests.mockImplementation(async () => ({ requests: [{ id: 'v1', request_type: 'access' }] } as never));+ try {+ devBind('S');+ render(<PetPage />);+ await waitFor(() => expect(pose()).toBe('needs_input'));+ } finally {+ api.getVaultRequests.mockImplementation(async () => ({ requests: [] }));+ }});it('derives Blocked from the first session read, with no provider row', async () => {diff --git a/ui/src/pet/PetPage.tsx b/ui/src/pet/PetPage.tsxindex 8726fb82e..8ba9d6de7 100644--- a/ui/src/pet/PetPage.tsx+++ b/ui/src/pet/PetPage.tsx@@ -118,7 +118,6 @@ const PetSurface: React.FC = () => {const state = derivePetState({session: data.session,- messages: data.messages,turn: data.running ? { foreground: 'running', in_flight: true } : data.turn,pendingVaultRequests: vaultRequests.length,unreadCount,@@ -238,7 +237,7 @@ const PetSurface: React.FC = () => {};// QuickReplies locks the group locally; the Runtime's message.updated for the- // answered row then clears Needs input in every window.+ // answered row then closes the group in every window.const choose = (message: WorkbenchMessage, choice: string) => send(choice, { quick_reply_for: message.id });const pressRef = useRef<{ x: number; y: number; dragged: boolean } | null>(null);diff --git a/ui/src/pet/petState.test.ts b/ui/src/pet/petState.test.tsindex 2044b5ef7..95a79b218 100644--- a/ui/src/pet/petState.test.ts+++ b/ui/src/pet/petState.test.ts@@ -43,7 +43,6 @@ const asking = (chosen?: string) => result({const quiet: PetStateInputs = {session: { agent_status: 'idle' },- messages: [user(), result()],turn: { foreground: 'idle', in_flight: false },pendingVaultRequests: 0,unreadCount: 0,@@ -57,7 +56,6 @@ describe('derivePetState', () => {['a reply is unread and the agent is idle', { unreadCount: 2 }, 'ready'],['the last run failed', { session: { agent_status: 'failed' } }, 'blocked'],['a vault request is pending', { pendingVaultRequests: 1 }, 'needs_input'],- ['the latest result asks a quick-reply question', { messages: [user(), asking()] }, 'needs_input'],])('is %s → %s', (_case, override, expected) => {expect(derivePetState({ ...quiet, ...override })).toBe(expected);});@@ -65,30 +63,31 @@ describe('derivePetState', () => {it('orders Needs input > Blocked > Ready > Running > Idle', () => {const everything: PetStateInputs = {session: { agent_status: 'failed' },- messages: [user(), asking()],turn: { foreground: 'running', in_flight: true },pendingVaultRequests: 1,unreadCount: 3,};expect(derivePetState(everything)).toBe('needs_input');- expect(derivePetState({ ...everything, messages: [user(), result()], pendingVaultRequests: 0 })).toBe('blocked');+ expect(derivePetState({ ...everything, pendingVaultRequests: 0 })).toBe('blocked');expect(derivePetState({- ...everything, messages: [], pendingVaultRequests: 0, session: { agent_status: 'idle' }, turn: null,+ ...everything, pendingVaultRequests: 0, session: { agent_status: 'idle' }, turn: null,})).toBe('ready');// A running turn is not Ready even with unread replies: the reply is not final yet.expect(derivePetState({- ...everything, messages: [], pendingVaultRequests: 0, session: { agent_status: 'idle' },+ ...everything, pendingVaultRequests: 0, session: { agent_status: 'idle' },})).toBe('running');});- it('clears Needs input once the question is answered', () => {- expect(derivePetState({ ...quiet, messages: [user(), asking('Yes')] })).toBe('idle');+});++describe('openQuickReplies', () => {+ it('offers the latest result\'s group until an option is chosen', () => {+ expect(openQuickReplies([user(), asking()])?.options).toEqual(['Yes', 'No']);+ expect(openQuickReplies([user(), asking('Yes')])).toBeNull();});- it('treats a free-text reply after the group as its answer, while that turn runs', () => {- const messages = [user(), asking(), user('free text')];- expect(openQuickReplies(messages)).toBeNull();- expect(derivePetState({ ...quiet, messages, turn: { foreground: 'running', in_flight: true } })).toBe('running');+ it('treats a free-text reply after the group as its answer', () => {+ expect(openQuickReplies([user(), asking(), user('free text')])).toBeNull();// Rows that are not the user's input do not answer it: a harness message,// or the user's own display-only Show Page annotation.expect(openQuickReplies([user(), asking(), row({ author: 'harness', type: 'harness' })])).not.toBeNull();@@ -96,9 +95,7 @@ describe('derivePetState', () => {});it('ignores an older unanswered group once a newer result exists', () => {- const messages = [user(), asking(), user('free text'), result()];- expect(openQuickReplies(messages)).toBeNull();- expect(derivePetState({ ...quiet, messages })).toBe('idle');+ expect(openQuickReplies([user(), asking(), user('free text'), result()])).toBeNull();});});diff --git a/ui/src/pet/petState.ts b/ui/src/pet/petState.tsindex 1aaea588a..5265f7863 100644--- a/ui/src/pet/petState.ts+++ b/ui/src/pet/petState.ts@@ -18,8 +18,6 @@ export type PetState = 'needs_input' | 'blocked' | 'ready' | 'running' | 'idle';export type PetStateInputs = {session: Pick<WorkbenchSession, 'agent_status'> | null;- /** The loaded tail, oldest first. */- messages: WorkbenchMessage[];turn: Pick<SessionRuntimeState, 'foreground' | 'in_flight'> | null;pendingVaultRequests: number;unreadCount: number;@@ -56,8 +54,12 @@ export const latestAgentResult = (messages: WorkbenchMessage[]): WorkbenchMessag};/**- * The quick-reply group the agent is waiting on now: the latest agent result's- * group, while unanswered. A group is answered by a chosen option or by any+ * The quick-reply group the panel offers now: the latest agent result's+ * group, while unanswered. Quick replies are suggestions that end most agent+ * replies, so they are answerable in the panel but never change the pet's+ * state.+ *+ * The group is the latest agent result's, while unanswered. A group is answered by a chosen option or by any* user input after it (a free-text reply, which then runs as a turn). An* older unanswered group is not an open question either — once a newer result* exists the agent has moved on — so it never counts (it stays clickable in@@ -78,9 +80,12 @@ export const openQuickReplies = (messages: WorkbenchMessage[]): { message: Workbconst isRunning = (turn: PetStateInputs['turn']): boolean =>turn?.foreground === 'running' || turn?.in_flight === true;-/** Priority: Needs input > Blocked > Ready > Running > Idle. */+/**+ * Priority: Needs input > Blocked > Ready > Running > Idle. Needs input means+ * the agent cannot continue without the user: a pending vault request.+ */export const derivePetState = (inputs: PetStateInputs): PetState => {- if (inputs.pendingVaultRequests > 0 || openQuickReplies(inputs.messages)) return 'needs_input';+ if (inputs.pendingVaultRequests > 0) return 'needs_input';if (inputs.session?.agent_status === 'failed') return 'blocked';if (!isRunning(inputs.turn) && inputs.unreadCount > 0) return 'ready';if (isRunning(inputs.turn)) return 'running';