From f9162c5ab3855f7f8093fdb57f0c2f01d44d7854 Mon Sep 17 00:00:00 2001 From: LHaghfoss Date: Mon, 23 Nov 2026 20:25:33 +0100 Subject: [PATCH 1/2] fix(desktop): answer delegate status on /status, not a bare status A plain "status" now goes to the model. /status in a thread with delegates adds the local delegate card; the harness's own /status report still opens in its panel. --- apps/desktop/src/state/delegateStatus.test.ts | 15 ++++++++------- apps/desktop/src/state/delegateStatus.ts | 6 +++--- apps/desktop/src/state/hostDelegates.ts | 17 +++++++++-------- apps/desktop/src/state/sendActions.ts | 9 +++++++-- docs/orchestrator.md | 19 ++++++++++--------- 5 files changed, 37 insertions(+), 29 deletions(-) diff --git a/apps/desktop/src/state/delegateStatus.test.ts b/apps/desktop/src/state/delegateStatus.test.ts index fa52203e1..0144ff710 100644 --- a/apps/desktop/src/state/delegateStatus.test.ts +++ b/apps/desktop/src/state/delegateStatus.test.ts @@ -42,21 +42,22 @@ const input = (over: Partial = {}): StatusInput => ({ }); describe("isStatusQuery", () => { - test("a bare status, in any case, with a question mark or room around it", () => { - for (const text of ["status", "Status", "status?", " STATUS ? ", "status??"]) { + test("the /status command alone, with room around it", () => { + for (const text of ["/status", " /status ", "/status\n"]) { expect(isStatusQuery(text)).toBe(true); } }); - test("anything longer is a message for the model", () => { + test("a plain status or anything longer is a message for the model", () => { for (const text of [ "", + "status", + "Status?", "status of the PR?", "what is the status", - "status please", - "/status", - "statuses", - "status\nand then merge", + "/status please", + "/statuses", + "/status\nand then merge", ]) { expect(isStatusQuery(text)).toBe(false); } diff --git a/apps/desktop/src/state/delegateStatus.ts b/apps/desktop/src/state/delegateStatus.ts index fe0d719d3..2367af81d 100644 --- a/apps/desktop/src/state/delegateStatus.ts +++ b/apps/desktop/src/state/delegateStatus.ts @@ -53,11 +53,11 @@ export interface StatusInput { } /** - * A bare `status` or `status?` (any case, with room around it) is a question the app answers - * itself. Anything longer is a message for the model: "status of the PR?" is not this. + * The `/status` command alone (room around it is fine) asks for the delegates' status too. A plain + * "status" is a message for the model like any other, and so is "/status" with more after it. */ export function isStatusQuery(text: string): boolean { - return /^\s*status\s*\?*\s*$/i.test(text); + return text.trim() === "/status"; } /** The rows, working ones first (what the reader asks about), then the rest in the order given. */ diff --git a/apps/desktop/src/state/hostDelegates.ts b/apps/desktop/src/state/hostDelegates.ts index fad1d8b3a..1b9008e43 100644 --- a/apps/desktop/src/state/hostDelegates.ts +++ b/apps/desktop/src/state/hostDelegates.ts @@ -135,13 +135,14 @@ export function delegateStatusInputs(s: AppState, orchestrator: string, max = In } /** - * A bare "status" in a thread that has delegates is answered here, from what the app already - * knows: the user's message and a local reply row go into the transcript, and no model turn runs - * (each one resent the whole context and cost as much as any other). The pull requests are read - * after the row is drawn and fill in as they arrive. False for a thread with no delegates, where - * the model answers as it always did. + * `/status` in a thread that has delegates adds their status here, from what the app already + * knows: a local reply row goes into the transcript, and no model turn runs (each one resent the + * whole context and cost as much as any other). With `withMessage` the user's message goes in + * before it; without, the harness's own `/status` report answers the message in its panel. The + * pull requests are read after the row is drawn and fill in as they arrive. False for a thread + * with no delegates, where `/status` goes to the harness as it always did. */ -export function answerStatusLocally(threadId: string, text: string): boolean { +export function answerStatusLocally(threadId: string, text: string, withMessage = true): boolean { if (!isStatusQuery(text)) return false; const s = useApp.getState(); if (!s.threads[threadId]) return false; @@ -154,8 +155,8 @@ export function answerStatusLocally(threadId: string, text: string): boolean { ...t, items: [ ...t.items, - { kind: "user", id: localId("user"), text: text.trim(), at: now }, - { kind: "status", id: statusId, at: now, rows }, + ...(withMessage ? [{ kind: "user" as const, id: localId("user"), text: text.trim(), at: now }] : []), + { kind: "status" as const, id: statusId, at: now, rows }, ], })); for (const row of rows) { diff --git a/apps/desktop/src/state/sendActions.ts b/apps/desktop/src/state/sendActions.ts index 866cbdfd0..ea3be8612 100644 --- a/apps/desktop/src/state/sendActions.ts +++ b/apps/desktop/src/state/sendActions.ts @@ -42,6 +42,7 @@ import { engine, errorText, harnessesOn, + isReportCommand, newThreadChoice, peekThread, projectThreadChoice, @@ -201,8 +202,12 @@ export async function submit(text: string, extras: ComposeExtras = emptyExtras): await cancel(id); return true; } - // A bare "status" in a thread with delegates is answered from what the app knows, with no turn. - if (!hasExtras(extras) && !get().editing[id] && answerStatusLocally(id, trimmed)) return true; + // `/status` in a thread with delegates lists them from what the app knows. When the harness + // answers `/status` as a report too, that still runs and opens its panel; otherwise no turn runs. + if (!hasExtras(extras) && !get().editing[id]) { + const report = isReportCommand(id, trimmed, extras); + if (answerStatusLocally(id, trimmed, !report) && !report) return true; + } const edit = get().editing[id]; if (edit && !isRunning(thread)) { cancelEdit(id); diff --git a/docs/orchestrator.md b/docs/orchestrator.md index 9bfdb1828..ae282794c 100644 --- a/docs/orchestrator.md +++ b/docs/orchestrator.md @@ -1031,15 +1031,16 @@ model turn: (`readDelegatePull` in `state/host.ts`, `_rustcode/pulls/state`), shared and kept for 30 s, repeated every 25 s while the panel is open and the window is visible, and skipped for a delegate outside a worktree. -- **A bare `status`.** Typing `status` or `status?` (any case, nothing else) in a - thread with delegates is answered by the app: the message and a *Status* card - go into the transcript, marked **Local reply · no model turn**, and nothing is - sent to the harness. The card carries the same rows as the panel and fills in - the pull requests as they arrive. Any longer message (`status of the PR?`) - goes to the model as before, and so does `status` in a thread with no - delegates. The card is the app's, not the thread's: it is not stored by the - engine, so a reload drops it. The matcher and the rows are pure - (`state/delegateStatus.ts`). +- **`/status`.** Typing `/status` alone in a thread with delegates adds a + *Status* card to the transcript, marked **Local reply · no model turn**. When + the harness answers `/status` as a report, that report still opens in its + panel above the composer; otherwise the message goes into the transcript + with the card and nothing is sent to the harness. The card carries the same + rows as the panel and fills in the pull requests as they arrive. A plain + `status` is a message for the model, and `/status` in a thread with no + delegates goes to the harness as before. The card is the app's, not the + thread's: it is not stored by the engine, so a reload drops it. The matcher + and the rows are pure (`state/delegateStatus.ts`). ## Orchestration tools v3 From de79d180b301ca41ece6c51f2fffec3f2da3a588 Mon Sep 17 00:00:00 2001 From: LHaghfoss Date: Mon, 23 Nov 2026 20:26:57 +0100 Subject: [PATCH 2/2] fix(desktop): keep sendActions within its comment baseline --- apps/desktop/src/state/sendActions.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/desktop/src/state/sendActions.ts b/apps/desktop/src/state/sendActions.ts index ea3be8612..c5a561c19 100644 --- a/apps/desktop/src/state/sendActions.ts +++ b/apps/desktop/src/state/sendActions.ts @@ -202,8 +202,7 @@ export async function submit(text: string, extras: ComposeExtras = emptyExtras): await cancel(id); return true; } - // `/status` in a thread with delegates lists them from what the app knows. When the harness - // answers `/status` as a report too, that still runs and opens its panel; otherwise no turn runs. + // `/status` with delegates lists them locally; a harness `/status` report still opens its panel. if (!hasExtras(extras) && !get().editing[id]) { const report = isReportCommand(id, trimmed, extras); if (answerStatusLocally(id, trimmed, !report) && !report) return true;