From a11552edba75046c20f37a7ecd59ec883529b692 Mon Sep 17 00:00:00 2001
From: David McKay
Date: Sun, 15 Nov 2026 22:12:04 -0800
Subject: [PATCH 1/8] Say INITIAL_ADMIN_EMAILS only on the first organization's
People page
INITIAL_ADMIN_EMAILS names the admins of the deployment's first organization and of no other, but every organization's People page said "Addresses in INITIAL_ADMIN_EMAILS are always admins. You can't change them here." The line now shows only while the person is working in the first organization.
Test: admin-people-remove.test.tsx, the line shows in the first organization and not in another (shown in both before).
---
app/src/routes/_authed/admin/people.tsx | 12 ++++++-
app/tests/admin-people-remove.test.tsx | 43 +++++++++++++++++++++++--
2 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/app/src/routes/_authed/admin/people.tsx b/app/src/routes/_authed/admin/people.tsx
index 28c37fe8e3..924d8b24c2 100644
--- a/app/src/routes/_authed/admin/people.tsx
+++ b/app/src/routes/_authed/admin/people.tsx
@@ -43,6 +43,7 @@ import {
setPersonAccessMutationOptions,
setPersonRoleMutationOptions,
} from "@/lib/people/mutations";
+import { useCurrentOrganizationId } from "@/lib/organizations/current";
import { useOrganizationChoices } from "@/lib/organizations/queries";
import { type Person, peopleListQueryOptions } from "@/lib/people/queries";
import { queryClient } from "@/query-client";
@@ -122,6 +123,11 @@ function PeoplePage() {
const [removing, setRemoving] = useState(null);
const [removeOpen, setRemoveOpen] = useState(false);
const organization = useRemovalOrganization();
+ /*
+ * INITIAL_ADMIN_EMAILS names the admins of the deployment's first organization (`default`, as the
+ * API addresses it) and of no other, so only its People page says so.
+ */
+ const inFirstOrganization = useCurrentOrganizationId() === "default";
// The server refuses these too. Disabling them here is so the screen does not offer something it
// knows will be refused, not so the rule is enforced in the browser.
@@ -133,7 +139,11 @@ function PeoplePage() {
title="People"
>
{failure ? (
diff --git a/app/tests/admin-people-remove.test.tsx b/app/tests/admin-people-remove.test.tsx
index a69d4c550f..df57a13a78 100644
--- a/app/tests/admin-people-remove.test.tsx
+++ b/app/tests/admin-people-remove.test.tsx
@@ -22,6 +22,10 @@ import {
within,
} from "@testing-library/react";
import { deploymentKeys } from "@/lib/deployment/queries";
+import {
+ currentOrganizationId,
+ setCurrentOrganization,
+} from "@/lib/organizations/current";
import { queryClient } from "@/query-client";
import { Route } from "@/routes/_authed/admin/people";
import { ME_PATH, meResponse, PEOPLE_PATH, personBody } from "./accounts-api";
@@ -72,12 +76,15 @@ let refusal: string | null = null;
* and has no list of them to answer (the address is not served), as before organizations.
*/
let severalOrganizations = false;
+/** Which of the person's organizations they are working in, where there are several. */
+let activeOrganization = "default";
beforeEach(() => {
removed.clear();
writes.length = 0;
refusal = null;
severalOrganizations = false;
+ activeOrganization = "default";
queryClient.clear();
queryClient.setQueryData(deploymentKeys.capabilities(), {
generativeUi: true,
@@ -99,7 +106,7 @@ beforeEach(() => {
name: "Acme Freight",
role: "admin",
personal: false,
- active: true,
+ active: activeOrganization === "default",
},
{
id: "org_dana",
@@ -107,7 +114,7 @@ beforeEach(() => {
name: "Dana's organization",
role: "owner",
personal: true,
- active: false,
+ active: activeOrganization === "org_dana",
},
],
canCreate: true,
@@ -254,6 +261,38 @@ test("with several organizations, Remove says it takes them out of this one alon
).toBeTruthy();
});
+/*
+ * INITIAL_ADMIN_EMAILS names the admins of the deployment's first organization, `default`, and
+ * nowhere else. On another organization's People page the line saying those addresses are always
+ * admins was false there.
+ */
+test("the INITIAL_ADMIN_EMAILS line shows in the first organization only", async () => {
+ const LINE =
+ "Addresses in INITIAL_ADMIN_EMAILS are always admins. You can't change them here.";
+ severalOrganizations = true;
+ const first = await draw();
+ expect(await first.findByText(LINE)).toBeTruthy();
+ cleanup();
+
+ activeOrganization = "org_dana";
+ queryClient.clear();
+ queryClient.setQueryData(deploymentKeys.capabilities(), {
+ generativeUi: true,
+ selfHostBanner: false,
+ localEvaluation: false,
+ edition: "team",
+ });
+ try {
+ const second = await draw();
+ await second.findByText("Who is here");
+ await waitFor(() => expect(currentOrganizationId()).toBe("org_dana"));
+ await settleReactWork();
+ expect(second.queryByText(LINE)).toBeNull();
+ } finally {
+ setCurrentOrganization("default");
+ }
+});
+
test("a removal the server refuses is said in the dialog, and the person stays", async () => {
refusal = "You can't remove the only admin.";
const view = await draw();
From ded17837e30da79d536b8cb87e03326807cc4489 Mon Sep 17 00:00:00 2001
From: David McKay
Date: Sun, 15 Nov 2026 22:12:26 -0800
Subject: [PATCH 2/8] Say an answered task request was answered, not where
The needs-you line in the conversation that asked said "You answered this in its thread" even when the answer came from the Bots page's Needs you board. The card can't tell where the answer was given, so it no longer says.
---
app/src/components/tasks/task-thread.tsx | 16 ++++++++++------
app/tests/task-thread.test.tsx | 21 +++++++++++++++++++--
2 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/app/src/components/tasks/task-thread.tsx b/app/src/components/tasks/task-thread.tsx
index 748a22372d..337b885b4d 100644
--- a/app/src/components/tasks/task-thread.tsx
+++ b/app/src/components/tasks/task-thread.tsx
@@ -515,13 +515,17 @@ export function TaskReport({
);
}
-/** What a needs-you line says once the person has answered, by where the task is now. */
+/**
+ * What a needs-you line says once the person has answered, by where the task is now. Never where
+ * they answered: the thread, the Bots page's Needs you board and the inbox all answer it, and the
+ * line can't tell which.
+ */
const ANSWERED: Record = {
- working: "You answered this in its thread. It's carrying on.",
- needs: "You answered this in its thread. It needs you again there.",
- done: "You answered this in its thread, and it's done.",
- failed: "You answered this in its thread, but it couldn't finish.",
- stopped: "You answered this in its thread, and stopped it after.",
+ working: "You answered this. It's carrying on.",
+ needs: "You answered this. It needs you again in its thread.",
+ done: "You answered this, and it's done.",
+ failed: "You answered this, but it couldn't finish.",
+ stopped: "You answered this, and stopped it after.",
};
/**
diff --git a/app/tests/task-thread.test.tsx b/app/tests/task-thread.test.tsx
index 573d406008..928e842202 100644
--- a/app/tests/task-thread.test.tsx
+++ b/app/tests/task-thread.test.tsx
@@ -235,7 +235,7 @@ test("a needs-you line asks while the task waits, and changes in place once it i
expect(waiting.getByRole("button", { name: /Go to thread/ })).toBeTruthy();
cleanup();
- // Answered in the thread: the task carries on, and the line no longer says it is waiting.
+ // Answered: the task carries on, and the line no longer says it is waiting.
task = { ...task, status: "working", next: null };
const answered = draw(
@@ -244,7 +244,7 @@ test("a needs-you line asks while the task waits, and changes in place once it i
);
await answered.findByText("Needed you");
expect(
- answered.getByText("You answered this in its thread. It's carrying on."),
+ answered.getByText("You answered this. It's carrying on."),
).toBeTruthy();
expect(answered.queryByText(WAITING)).toBeNull();
expect(answered.getByRole("button", { name: /Open thread/ })).toBeTruthy();
@@ -266,6 +266,23 @@ test("a needs-you line asks while the task waits, and changes in place once it i
expect(askedAgain.queryByText(WAITING)).toBeNull();
});
+/*
+ * Found on the re-test: a person pressed Allow on the Bots page's Needs you board, and the line in
+ * the conversation that asked read "You answered this in its thread, and it's done." The card can't
+ * know where the answer was given (the thread, the board, the inbox), so it never says.
+ */
+test("an answered needs-you line never claims the answer was given in the thread", async () => {
+ task = { ...task, status: "ready_for_review", next: null as never };
+ const view = draw(
+
+
{WAITING}
+ ,
+ );
+ await view.findByText("Needed you");
+ expect(view.getByText("You answered this, and it's done.")).toBeTruthy();
+ expect(view.queryByText(/in its thread/)).toBeNull();
+});
+
test("a Bot's link to a task thread opens in the app, not in a new tab", async () => {
expect(inAppPath("/channel/channel_task", "http://openbot.invalid")).toBe(
"/channel/channel_task",
From 2a4d2cf2583e47f28717ba169a1a7a41418769b4 Mon Sep 17 00:00:00 2001
From: David McKay
Date: Sun, 15 Nov 2026 22:08:46 -0800
Subject: [PATCH 3/8] Read the Bots badge again as soon as an approval is
decided
Allow or Deny on the Needs you board left the sidebar badge on its old count until its next poll, seconds after the board showed the new one. Deciding an approval now reads the badge again at once, as answering a question already did.
---
app/src/lib/approvals.ts | 11 ++++++++-
app/tests/bots-nav-badge.test.tsx | 38 ++++++++++++++++++++++++++++++-
2 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/app/src/lib/approvals.ts b/app/src/lib/approvals.ts
index 0bd5b1bf43..fec830f2a5 100644
--- a/app/src/lib/approvals.ts
+++ b/app/src/lib/approvals.ts
@@ -486,7 +486,16 @@ export const decideApprovalMutationOptions = (queryClient: QueryClient) =>
mutationOptions({
mutationFn: ({ id, choice }: { id: string; choice: ApprovalDecision }) =>
decideApproval(id, choice),
- onSuccess: settle(queryClient),
+ /*
+ * The badge that counted it is read again at once, as for an answered question: left to its
+ * poll, it kept the old count for seconds beside a board that already showed the new one.
+ */
+ onSuccess: () => {
+ void queryClient.invalidateQueries({
+ queryKey: botLifecycleKeys.attention,
+ });
+ return settle(queryClient)();
+ },
});
/** Answer a question a Bot asked mid-run; the run resumes with the answer. */
export const answerPersonQuestionMutationOptions = (queryClient: QueryClient) =>
diff --git a/app/tests/bots-nav-badge.test.tsx b/app/tests/bots-nav-badge.test.tsx
index be1c189ec3..9d836b4661 100644
--- a/app/tests/bots-nav-badge.test.tsx
+++ b/app/tests/bots-nav-badge.test.tsx
@@ -1,8 +1,13 @@
import { afterAll, afterEach, beforeAll, expect, test } from "bun:test";
import { GlobalRegistrator } from "@happy-dom/global-registrator";
-import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import {
+ MutationObserver,
+ QueryClient,
+ QueryClientProvider,
+} from "@tanstack/react-query";
import { act, cleanup, render, waitFor } from "@testing-library/react";
import { BotsNavBadge } from "@/components/bot-profile/attention";
+import { decideApprovalMutationOptions } from "@/lib/approvals";
import { botLifecycleKeys } from "@/lib/bot-lifecycle/queries";
import { answerBotAttention, attentionOf } from "./bots-api";
import { awayFromOpenBot } from "./desktop-notifications.fixture";
@@ -123,6 +128,37 @@ test("the badge adds up what waits on the person across every Bot", async () =>
expect(badge.getAttribute("aria-label")).toBe("3 things need you");
});
+test("allowing or denying an action reads the badge again at once, as answering a question does", async () => {
+ serving([attention("expenses", { approvals: 1 })]);
+ const answered = global.fetch;
+ const decided: string[] = [];
+ // The decision, at the API's address, and every other read as before.
+ global.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => {
+ if (/\/approvals\/[^/]+\/decide$/.test(pathOf(input))) {
+ decided.push(pathOf(input));
+ return Response.json({ id: "approval-1", status: "completed" });
+ }
+ return answered(input, init);
+ }) as unknown as typeof fetch;
+ const { view, client } = draw();
+ await view.findByText("1");
+
+ // Decided on the Needs you board: the server no longer counts it.
+ served = [attention("expenses", {})];
+ await act(async () => {
+ await new MutationObserver(
+ client,
+ decideApprovalMutationOptions(client),
+ ).mutate({ id: "approval-1", choice: "deny" });
+ });
+ expect(decided).toHaveLength(1);
+ // Well inside the badge's own poll, which is 15 seconds away.
+ await waitFor(() => expect(view.queryByText("1")).toBeNull(), {
+ timeout: 2_000,
+ });
+ expect(view.container.innerHTML).toBe("");
+});
+
test("with only unread messages the badge is a dot, not a number", async () => {
serving([attention("expenses", { unread: 2 })]);
const { view } = draw();
From 3657a5a106fa83834f4779dbfaa4951fc64b57a9 Mon Sep 17 00:00:00 2001
From: David McKay
Date: Sun, 15 Nov 2026 22:08:49 -0800
Subject: [PATCH 4/8] Say why a task couldn't finish once, and offer Try again
only where it can help
A task card in the conversation that asked repeated the reason its failure line under it already gives, with the next step. The card now says Couldn't finish and leaves the reason to that line.
Tasks gain canTryAgain: false when the task couldn't finish for a reason asking again gets the same answer to, such as a Bot it asked that isn't shared with the person. The Needs you board and the Activity rows then offer Open and Mark done, not Try again. The board also names the state as the card does, Couldn't finish, with the reason as its line.
---
api/openapi.yaml | 3 ++
api/openapi/conversations.yaml | 3 ++
app/src/components/tasks/task-row.tsx | 33 +++++++++---
app/src/components/tasks/task-thread.tsx | 22 ++++----
app/src/lib/api/generated/model/task.ts | 2 +
app/src/lib/api/generated/tasks/tasks.zod.ts | 30 +++++++++++
app/src/lib/tasks/queries.ts | 29 ++++++++--
app/tests/needs-you.test.tsx | 56 ++++++++++++++++----
app/tests/task-thread.test.tsx | 39 ++++++++++----
mobile/src/api/generated/model/task.ts | 2 +
10 files changed, 176 insertions(+), 43 deletions(-)
diff --git a/api/openapi.yaml b/api/openapi.yaml
index e7279feb85..6b3ed60cbb 100644
--- a/api/openapi.yaml
+++ b/api/openapi.yaml
@@ -23950,6 +23950,9 @@ components:
- 'null'
format: date-time
description: When the person stopped its run. Its status is failed while this is set. Null or absent otherwise, and once it carries on.
+ canTryAgain:
+ type: boolean
+ description: Whether trying a failed task again could change how it ends. False when it couldn't finish for a reason asking again gets the same answer to, such as a Bot it asked that isn't shared with the person, or this Bot no longer being shared with them. Absent from a server that does not say, which reads as true.
workingSince:
type:
- string
diff --git a/api/openapi/conversations.yaml b/api/openapi/conversations.yaml
index 42247c3c9e..e9696f26f9 100644
--- a/api/openapi/conversations.yaml
+++ b/api/openapi/conversations.yaml
@@ -2451,6 +2451,9 @@ components:
- 'null'
format: date-time
description: When the person stopped its run. Its status is failed while this is set. Null or absent otherwise, and once it carries on.
+ canTryAgain:
+ type: boolean
+ description: Whether trying a failed task again could change how it ends. False when it couldn't finish for a reason asking again gets the same answer to, such as a Bot it asked that isn't shared with the person, or this Bot no longer being shared with them. Absent from a server that does not say, which reads as true.
workingSince:
type:
- string
diff --git a/app/src/components/tasks/task-row.tsx b/app/src/components/tasks/task-row.tsx
index ad2e6ae97a..e788a71e0f 100644
--- a/app/src/components/tasks/task-row.tsx
+++ b/app/src/components/tasks/task-row.tsx
@@ -27,9 +27,12 @@ import {
tryTaskAgainMutationOptions,
} from "@/lib/tasks/mutations";
import {
+ canTryAgain,
couldNotFinish,
+ failureSentence,
stoppedByYou,
TASK_DONE_LABEL,
+ TASK_FAILED_LABEL,
TASK_STATUS_LABEL,
TASK_STOPPED,
TASK_STOPPED_LABEL,
@@ -112,6 +115,23 @@ function nextLine(listed: ListedTask): string | null {
return status === "working" ? "Just started." : null;
}
+/**
+ * A task's status and line on the Needs you board. One that couldn't finish says so in its card's
+ * words, Couldn't finish, and its line is why, said once: the board read "Failed" beside a card
+ * that said "Couldn't finish", and "Couldn't finish: …" beside "Failed".
+ */
+function boardStatus(
+ listed: ListedTask,
+ settled = false,
+): { label: string; line: string | null } {
+ if (listed.status === "failed" && !stopped(listed))
+ return {
+ label: TASK_FAILED_LABEL,
+ line: listed.task.failure ? failureSentence(listed.task.failure) : null,
+ };
+ return { label: statusLabel(listed, settled), line: nextLine(listed) };
+}
+
/**
* Whether a row offers Mark done: only where it does something. Not while the task is working:
* there is nothing finished to mark, and its conversation would carry on behind a row that said it
@@ -210,7 +230,7 @@ export function TaskRow({
) : null}
- {status === "failed" ? (
+ {canTryAgain({ ...task, status }) ? (
) : null}
{children}
From 753f64fd5f0b2cfc4f850d1406393213b412340c Mon Sep 17 00:00:00 2001
From: David McKay
Date: Sun, 15 Nov 2026 22:58:37 -0800
Subject: [PATCH 7/8] Say an owner gives their Bot an app, not that they share
it
Activity named a Bot's owner switching an app on for their own Bot "Share an app", and off "Stop sharing an app". Nothing was shared with anybody. The rows now read "Give a Bot an app" and "Take an app from a Bot".
Test: audit-event-words.test.tsx, the owner's on and off rows read as giving and taking (Share an app before).
---
app/tests/audit-event-words.test.tsx | 31 ++++++++++++++++++++++++++++
shared/audit-words.ts | 5 +++--
2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/app/tests/audit-event-words.test.tsx b/app/tests/audit-event-words.test.tsx
index 98afc4781e..6546007ffa 100644
--- a/app/tests/audit-event-words.test.tsx
+++ b/app/tests/audit-event-words.test.tsx
@@ -256,6 +256,37 @@ test("what happened to an organization reads in words, and none of it as blocked
}
});
+/*
+ * Found in testing: a Bot's owner switching an app on for their own Bot read "Share an app", and
+ * off "Stop sharing an app". Nothing was shared with anybody: they gave their Bot the app.
+ */
+test("an owner giving their Bot an app, and taking it back, reads as that", async () => {
+ const view = await renderAs("team", [
+ row(
+ "a1",
+ 41,
+ "app_access.owner_granted",
+ "mcp_server",
+ {},
+ "composio-gmail",
+ ),
+ row(
+ "a2",
+ 40,
+ "app_access.owner_revoked",
+ "mcp_server",
+ {},
+ "composio-gmail",
+ ),
+ ]);
+ const lines = whats(view.container);
+ expect(lines.map((line) => line.textContent)).toEqual([
+ "Give a Bot an app",
+ "Take an app from a Bot",
+ ]);
+ expect(view.container.textContent).not.toContain("Share");
+});
+
/**
* A real-product pass read "Started by a person" on every row a person started, with nobody named,
* and searching the person's email found nothing. The server sends who in `payload.by`.
diff --git a/shared/audit-words.ts b/shared/audit-words.ts
index 9b8e1f0e0f..e409b5a62b 100644
--- a/shared/audit-words.ts
+++ b/shared/audit-words.ts
@@ -97,8 +97,9 @@ export const AUDIT_EVENT_WORDS: Readonly> = {
"app_access.approved": "Approve a request for an app",
"app_access.dismissed": "Dismiss a request for an app",
"app_access.refused": "Ask for an app",
- "app_access.owner_granted": "Share an app",
- "app_access.owner_revoked": "Stop sharing an app",
+ // A Bot's owner switching an app on or off for their own Bot: nothing is shared with anybody.
+ "app_access.owner_granted": "Give a Bot an app",
+ "app_access.owner_revoked": "Take an app from a Bot",
"plugin.grants_translated": "Choose a Bot's actions from a description",
"plugin.grants_changed": "Change a Bot's actions in an app",
"computer.action_allowed": "Use the computer",
From e73cf69348271ee16e35acd7abf04f5851f85111 Mon Sep 17 00:00:00 2001
From: David McKay
Date: Sun, 15 Nov 2026 22:59:43 -0800
Subject: [PATCH 8/8] Show an organization's owner as an admin on People
An owner's Admin switch read off and greyed: the switch read role === "admin", and an owner's role is owner. An owner governs the organization as an admin does, so the switch now reads on, and it can't be changed there, nor is Remove offered: only an owner gives ownership away, in Organization settings, and the server keeps the owner.
Test: admin-people-roles.test.tsx, an owner's switch reads on, can't be changed, and sends nothing (off before).
---
app/src/routes/_authed/admin/people.tsx | 17 ++++++++++++++---
app/tests/admin-people-roles.test.tsx | 24 +++++++++++++++++++++++-
2 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/app/src/routes/_authed/admin/people.tsx b/app/src/routes/_authed/admin/people.tsx
index 924d8b24c2..44871387d0 100644
--- a/app/src/routes/_authed/admin/people.tsx
+++ b/app/src/routes/_authed/admin/people.tsx
@@ -191,6 +191,13 @@ function PeoplePage() {
{rows.map((person, index) => {
const isSelf = person.id === currentUser.data?.id;
const busy = setRole.isPending || setAccess.isPending;
+ /*
+ * An owner governs the organization as an admin does, so their Admin switch reads on.
+ * Their role is not this switch's to change (only an owner gives ownership away, in
+ * Organization settings), and the server keeps the owner, so neither switch nor
+ * Remove is offered for them.
+ */
+ const owner = person.role === "owner";
return (
@@ -227,7 +234,9 @@ function PeoplePage() {
{
// Removing is asked about first. Restoring ends nothing, so it applies at once.
if (person.revoked) {
@@ -247,8 +256,10 @@ function PeoplePage() {
setRole.mutate({
userId: person.id,
diff --git a/app/tests/admin-people-roles.test.tsx b/app/tests/admin-people-roles.test.tsx
index 367ba950ef..a2ecfc560f 100644
--- a/app/tests/admin-people-roles.test.tsx
+++ b/app/tests/admin-people-roles.test.tsx
@@ -51,7 +51,7 @@ const sam = {
name: "Sam Ortiz",
role: "member" as const,
};
-const roles: Record = {};
+const roles: Record = {};
const sent: unknown[] = [];
beforeEach(() => {
@@ -123,3 +123,25 @@ test("the admin switch gives a member admin and back, by the member role names",
expect((await switchFor()).getAttribute("aria-checked")).toBe("false"),
);
});
+
+/*
+ * Found in testing: an organization's owner showed with the Admin switch off. An owner governs the
+ * organization as an admin does, and their role is not one this switch changes (only the owner
+ * gives ownership away, in Organization settings), so it reads on and can't be changed here.
+ */
+test("an owner's admin switch reads on and can't be changed, and nothing is sent", async () => {
+ roles.sam = "owner";
+ const view = await draw();
+ const owner = await view.findByRole("switch", {
+ name: "Admin: sam@acme.test",
+ });
+ await waitFor(() => expect(owner.getAttribute("aria-checked")).toBe("true"));
+ expect(
+ owner.hasAttribute("disabled") ||
+ owner.getAttribute("aria-disabled") === "true" ||
+ owner.hasAttribute("data-disabled"),
+ ).toBe(true);
+ fireEvent.click(owner);
+ await new Promise((resolve) => setTimeout(resolve, 50));
+ expect(sent).toEqual([]);
+});