A local-first multi-agent app development platform, built on PenguinHarness
fix(server,web): an organization's approval mode reaches its open sessions, and their composer offers no always-ask (#791)
Yaowei Zhengf107bd3f123c
diff --git a/changelog/unreleased/2026-09-18-org-approval-sync.md b/changelog/unreleased/2026-09-18-org-approval-sync.mdnew file mode 100644index 00000000..1399c0ec--- /dev/null+++ b/changelog/unreleased/2026-09-18-org-approval-sync.md@@ -0,0 +1,36 @@+# An organization's approval mode reaches the sessions it already has++- **Date:** 2026-09-18+- **Type:** fix+- **Scope:** `server`, `web`, `skills`+- **PR:** [#791](https://github.com/Prism-Shadow/penguin-harness/pull/791)++[中文版](2026-09-18-org-approval-sync.zh.md)++Changing an organization's approval mode in its settings now changes it for the desk and+ticket sessions the organization already has, not only for the ones opened afterwards. The+chat composer no longer offers `always-ask` on an organization's session, where it would deny+every call that needs approval. The approval mode became the board's alone: no employee, the+CEO included, edits it in `org_config.toml`.++## Details++- `OrganizationService.patch`, which every API write of an organization's settings goes+ through, writes a changed `approval_mode` onto every session the organization's files name —+ the current and previous desks in the ledger, and every session a ticket lists — except+ archived ones. A session mid-run applies the new mode from its next approval decision. A+ write that leaves the mode as it was touches no session, so a session whose mode was changed+ from its own composer keeps it until the organization's mode next changes.+- The composer's approval picker lists `read-only`, `allow-all` and `deny-all` for a session+ stamped `client: "org"`, as the organization settings do; so does the Agents panel's+ sub-session composer, which edits the parent session's mode. A session that already stores+ `always-ask` keeps it listed and ticked until another mode is picked.+- `company-employee` and `company-ceo` (plugin `agent-company` `2026.09.18.1`) say the approval+ mode belongs to the board, which changes it in the organization's settings: an employee never+ edits `approval_mode` in `org_config.toml`, not even after a yes, because a hand edit reaches+ only sessions opened afterwards, and asks the board in the all-hands channel when it thinks the+ mode should change. The handbook index a new organization is created with says the same in its+ directory table, in both working languages; an existing organization's handbook was not+ rewritten.+- Sessions on disk whose mode already differs from their organization's were left as they are+ and take the organization's mode the next time it changes; nothing was migrated.diff --git a/changelog/unreleased/2026-09-18-org-approval-sync.zh.md b/changelog/unreleased/2026-09-18-org-approval-sync.zh.mdnew file mode 100644index 00000000..d8134b0e--- /dev/null+++ b/changelog/unreleased/2026-09-18-org-approval-sync.zh.md@@ -0,0 +1,17 @@+# 组织的审批模式改动也作用于已有的会话++- **Date:** 2026-09-18+- **Type:** fix+- **Scope:** `server`, `web`, `skills`+- **PR:** [#791](https://github.com/Prism-Shadow/penguin-harness/pull/791)++[English](2026-09-18-org-approval-sync.md)++在组织设置里改审批模式,现在连组织已有的工位会话与工单会话一并改掉,而不只作用于此后新开的会话。对话输入框在组织的会话上不再提供 `always-ask`——在那里它只会把须审批的调用一律拒掉。审批模式从此只归董事会:包括 CEO 在内,任何员工都不在 `org_config.toml` 里改它。++## 细节++- 组织设置的每次 API 写入都经过 `OrganizationService.patch`:`approval_mode` 变了,它就把新模式写到组织文件所列的每个会话上——台账里的现任与历史工位,以及各工单列出的会话——已归档的除外。运行中的会话自下一次审批决策起按新模式判定。模式没变的写入不动任何会话,因此某个会话在自己的输入区改过的模式会保留到组织下一次改模式为止。+- 对 `client: "org"` 的会话,输入区的审批选择器只列 `read-only`、`allow-all` 与 `deny-all`,与组织设置一致;智能体面板里子会话的输入框改的是父会话的模式,同样如此。已存为 `always-ask` 的会话仍列出并勾选它,直到改选其他模式。+- `company-employee` 与 `company-ceo`(插件 `agent-company` `2026.09.18.1`)写明审批模式属于董事会、由董事会在组织设置里修改:员工即使得到同意也绝不在 `org_config.toml` 里编辑 `approval_mode`——手工改动只作用于此后新开的会话——认为需要改时在全员频道向董事会请示。新建组织时生成的手册索引在目录表里写明同一点,中英两个模板都改了;已有组织的手册没有重写。+- 磁盘上模式已与组织不一致的会话保持原样,待组织下一次改模式时才随之更新;没有做任何迁移。diff --git a/packages/server/src/organization/handbook.ts b/packages/server/src/organization/handbook.tsindex 892e9a0e..728df922 100644--- a/packages/server/src/organization/handbook.ts+++ b/packages/server/src/organization/handbook.ts@@ -72,7 +72,7 @@ written in it. Commands, file names, ids and field names stay ASCII.| Path | What it is | Who writes it || --- | --- | --- |-| \`org_config.toml\` | name, mission, status, timezone, working language, approval mode, mention-chain and budget thresholds | people, CEO |+| \`org_config.toml\` | name, mission, status, timezone, working language, approval mode, mention-chain and budget thresholds | people, CEO — except the approval mode, which only the board changes, in the organization's settings || \`org_chart.yaml\` | employee tree: title, reports_to, duties, workspace, budget, model | CEO, HR (\`penguin org hire\` / \`employee set\`) || \`handbook/\` | the knowledge base: this index (\`README.md\`) and the documents it lists | CEO, HR, employees (\`penguin org handbook …\` or file tools) || \`desks.toml\` | employee → current desk session (fact file) | the server |@@ -234,7 +234,7 @@ ${input.mission}| 路径 | 是什么 | 谁来写 || --- | --- | --- |-| \`org_config.toml\` | 名称、使命、状态、时区、工作语言、审批模式、@ 连锁上限与预算阈值 | 人、CEO |+| \`org_config.toml\` | 名称、使命、状态、时区、工作语言、审批模式、@ 连锁上限与预算阈值 | 人、CEO——审批模式除外:只由董事会在组织设置里修改 || \`org_chart.yaml\` | 员工树:头衔、reports_to、职责、workspace、预算、Model | CEO、HR(\`penguin org hire\` / \`employee set\`) || \`handbook/\` | 知识库:这份索引(\`README.md\`)与它列出的文档 | CEO、HR、员工(\`penguin org handbook …\` 或文件工具) || \`desks.toml\` | 员工 → 当前工位会话(事实文件) | 服务端 |diff --git a/packages/server/src/runtime/organization/reconcile.ts b/packages/server/src/runtime/organization/reconcile.tsindex 3bf486b3..e6ccfa9d 100644--- a/packages/server/src/runtime/organization/reconcile.ts+++ b/packages/server/src/runtime/organization/reconcile.ts@@ -12,6 +12,7 @@import { createHash } from "node:crypto";import { comparePluginVersions } from "@prismshadow/penguin-core";import type { OrgCalendarOutcome, OrgChannelMessage, OrgTicketChange } from "../../api/types.js";+import type { SessionRow } from "../../db/repos/sessions.js";import type { ChannelConfig, TicketDoc } from "../../organization/files.js";import { parseChannelMessageLine, serializeChannelMessageLine } from "../../organization/files.js";import { agentPrincipal, parsePrincipal, principalAgentId } from "../../organization/principal.js";@@ -96,6 +97,39 @@ export async function listTickets(deps: OrgDeps, org: LoadedOrg): Promise<Ticketreturn { tickets, invalid };}+/**+ * The session rows an organization's files name as its own: every desk in the ledger, current+ * and previous, then every session a ticket's `sessions` lists, with that ticket's id. Both+ * files are hand-editable and what is written through the result outlives the caches (the+ * `client` stamp, the approval mode), so a name with no row, or naming a row of another+ * Project, is not the organization's and is left out.+ */+function ownedSessions(+ deps: OrgDeps,+ org: LoadedOrg,+ tickets: readonly LoadedTicket[],+): { desks: SessionRow[]; tickets: Array<{ ticketId: string; row: SessionRow }> } {+ const rowOf = (sessionId: string): SessionRow | null => {+ const row = deps.sessions.findById(sessionId);+ return row !== null && row.projectId === org.projectId ? row : null;+ };+ const desks: SessionRow[] = [];+ for (const desk of Object.values(org.desks)) {+ for (const sessionId of [desk.sessionId, ...desk.previous]) {+ const row = rowOf(sessionId);+ if (row !== null) desks.push(row);+ }+ }+ const ticketRows: Array<{ ticketId: string; row: SessionRow }> = [];+ for (const t of tickets) {+ for (const sessionId of t.doc.sessions) {+ const row = rowOf(sessionId);+ if (row !== null) ticketRows.push({ ticketId: t.ticketId, row });+ }+ }+ return { desks, tickets: ticketRows };+}+/*** Projects the ledger and the tickets' `sessions` fields into the two session caches, and* stamps `client = "org"` on every session row those files name. The caches are rebuilt from@@ -107,28 +141,40 @@ export async function listTickets(deps: OrgDeps, org: LoadedOrg): Promise<Ticket*/export function syncCaches(deps: OrgDeps, org: LoadedOrg, tickets: readonly LoadedTicket[]): void {syncDeskCache(deps, org);- // The stamp is durable, unlike the caches beside it, so a hand-edited ledger naming a- // session of another Project must not mark it as this organization's.- const owned: string[] = [];- const own = (sessionId: string): void => {- if (deps.sessions.findById(sessionId)?.projectId === org.projectId) owned.push(sessionId);- };- for (const desk of Object.values(org.desks)) {- own(desk.sessionId);- for (const prev of desk.previous) own(prev);- }- const rows: Array<{ ticketId: string; sessionId: string; agentId: string }> = [];- for (const t of tickets) {- for (const sessionId of t.doc.sessions) {- const row = deps.sessions.findById(sessionId);- if (row && row.projectId === org.projectId) {- rows.push({ ticketId: t.ticketId, sessionId, agentId: row.agentId });- owned.push(sessionId);- }- }+ const owned = ownedSessions(deps, org, tickets);+ deps.cache.syncTicketSessions(+ org.projectId,+ org.orgId,+ owned.tickets.map(({ ticketId, row }) => ({+ ticketId,+ sessionId: row.sessionId,+ agentId: row.agentId,+ })),+ );+ deps.sessions.markOrgClient(+ [...owned.desks, ...owned.tickets.map((t) => t.row)].map((row) => row.sessionId),+ );+}++/**+ * Carries the organization's approval mode onto every session it owns (see `ownedSessions`)+ * that is not archived. A desk or ticket session takes the mode of the moment it is opened and+ * its approvals read its own row, so without this a changed mode would reach only the sessions+ * opened after the change. A session mid-run applies it from its next approval decision, which+ * re-reads the row; an archived session keeps the mode it had. Run only when the mode actually+ * changed: until then, a session whose own mode was changed from its composer keeps it.+ */+export function syncApprovalMode(+ deps: OrgDeps,+ org: LoadedOrg,+ tickets: readonly LoadedTicket[],+): void {+ const mode = org.config.approvalMode;+ const owned = ownedSessions(deps, org, tickets);+ for (const row of [...owned.desks, ...owned.tickets.map((t) => t.row)]) {+ if ((row.archivedAt ?? null) !== null || row.approvalMode === mode) continue;+ deps.sessions.updateApprovalMode(row.sessionId, mode);}- deps.cache.syncTicketSessions(org.projectId, org.orgId, rows);- deps.sessions.markOrgClient(owned);}/**diff --git a/packages/server/src/runtime/organization/service.ts b/packages/server/src/runtime/organization/service.tsindex c13d6dd8..1420d422 100644--- a/packages/server/src/runtime/organization/service.ts+++ b/packages/server/src/runtime/organization/service.ts@@ -126,7 +126,7 @@ import {employeeLeft,systemMessage,} from "./notices.js";-import { appendChannelMessage, listTickets, syncCaches } from "./reconcile.js";+import { appendChannelMessage, listTickets, syncApprovalMode, syncCaches } from "./reconcile.js";import type { LoadedTicket } from "./reconcile.js";import { rotaWarnings } from "./rota.js";import { OrganizationScheduler } from "./scheduler.js";@@ -669,8 +669,16 @@ export class OrganizationService {await this.validateModel(projectId, req.model);next.model = req.model;}+ const modeChanged = next.approvalMode !== org.config.approvalMode;await this.deps.store.writeConfig(org.dir, next);org.config = next;+ // Every API write of the approval mode comes through here, so this is where a change+ // reaches the desk and ticket sessions already open rather than only the next ones. A+ // hand edit of org_config.toml does not pass here.+ if (modeChanged) {+ const { tickets } = await listTickets(this.deps, org);+ syncApprovalMode(this.deps, org, tickets);+ }return this.settings(org);});}diff --git a/packages/server/src/runtime/organization/triggers.ts b/packages/server/src/runtime/organization/triggers.tsindex a41b54c2..79cfb0b9 100644--- a/packages/server/src/runtime/organization/triggers.ts+++ b/packages/server/src/runtime/organization/triggers.ts@@ -6,7 +6,8 @@* pass provisions the ones that are missing, a trigger falls back on it, and it renews a* desk when the CEO reassigns a workspace; ticket sessions are opened per start. Both are* stamped `client: "org"` at creation — the durable marker development mode's list reads to- * leave them out of it.+ * leave them out of it — and take the organization's approval mode of that moment; a later+ * change of the mode reaches them through `syncApprovalMode` (reconcile.ts).*/import { buildOrgTriggerMessage, userText } from "@prismshadow/penguin-core";import type { OrgTriggerOrigin } from "@prismshadow/penguin-core";diff --git a/packages/server/test/organization-runtime.test.ts b/packages/server/test/organization-runtime.test.tsindex 4bad1f9d..136d0764 100644--- a/packages/server/test/organization-runtime.test.ts+++ b/packages/server/test/organization-runtime.test.ts@@ -911,6 +911,43 @@ describe("organization runtime", () => {);expect(sessions.findById(work)?.approvalMode).toBe("read-only");});++ it("carries a changed approval mode onto the sessions it already has, except archived ones", async () => {+ await createOrg();+ await service.hire(P, ORG, { newAgent: { agentId: HR }, title: "HR", reportsTo: CEO });+ // Everything here is opened under the default mode: the CEO's first desk, kept in the+ // ledger as history once renewed, the current CEO and HR desks, and two sessions on one+ // ticket, the second of which a person archives.+ const firstDesk = (await service.desk(P, ORG, CEO, {})).sessionId;+ const ceoDesk = (await service.desk(P, ORG, CEO, { renew: true })).sessionId;+ const hrDesk = (await service.desk(P, ORG, HR, {})).sessionId;+ const t = await service.createTicket(+ P,+ ORG,+ { title: "Ship it", owner: `agent:${CEO}` },+ { userId: "alice" },+ );+ const start = async (): Promise<string> =>+ (await service.startTicket(P, ORG, t.ticketId, {}, { userId: "alice" })).sessionId;+ const work = await start();+ const archived = await start();+ sessions.setArchived(archived, new Date(nowMs).toISOString());+ const live = [firstDesk, ceoDesk, hrDesk, work];+ const modeOf = (sessionId: string) => sessions.findById(sessionId)?.approvalMode;+ expect([...live, archived].map(modeOf)).toEqual(Array(5).fill("allow-all"));++ await service.patch(P, ORG, { approvalMode: "read-only" }, "alice");+ expect(live.map(modeOf)).toEqual(Array(4).fill("read-only"));+ expect(modeOf(archived)).toBe("allow-all");++ // A write that leaves the mode where it is touches no session, so a desk whose mode was+ // changed from its own composer keeps it until the organization's mode next changes.+ sessions.updateApprovalMode(hrDesk, "deny-all");+ await service.patch(P, ORG, { name: "Acme Inc", approvalMode: "read-only" }, "alice");+ expect(modeOf(hrDesk)).toBe("deny-all");+ await service.patch(P, ORG, { approvalMode: "allow-all" }, "alice");+ expect(live.map(modeOf)).toEqual(Array(4).fill("allow-all"));+ });});describe("who starts a ticket session", () => {diff --git a/packages/web/src/features/chat/approval-mode.ts b/packages/web/src/features/chat/approval-mode.tsnew file mode 100644index 00000000..30c66e4e--- /dev/null+++ b/packages/web/src/features/chat/approval-mode.ts@@ -0,0 +1,33 @@+/**+ * Which approval modes the composer's picker offers for a Session.+ *+ * An organization's Session — a desk, a ticket session, or a sub-session one of them spawned,+ * every one stamped `client: "org"` — runs with nobody watching, so the server denies on the+ * spot any call its approval mode would hand to a person. There, `always-ask` does not ask:+ * it denies every call that needs approval. The picker leaves it out for such a Session, as+ * the organization settings do. The test is the row's `client` stamp alone, because that is+ * the one the server's denial reads.+ *+ * A Session that already stores `always-ask` (written through the API, or before the picker+ * stopped offering it) keeps the entry while it is the current value, so the open menu shows+ * the mode in effect ticked instead of a list with nothing selected. Picking any other mode+ * drops it from the list.+ */+import type { ApprovalMode, SessionInfo } from "@prismshadow/penguin-server/api";++/** Every approval mode, in the picker's order. */+export const APPROVAL_MODES: readonly ApprovalMode[] = [+ "always-ask",+ "read-only",+ "allow-all",+ "deny-all",+];++/** The modes the picker lists for a Session with this `client` stamp whose mode is `current`. */+export function approvalModeChoices(+ client: SessionInfo["client"],+ current: ApprovalMode,+): readonly ApprovalMode[] {+ if (client !== "org") return APPROVAL_MODES;+ return APPROVAL_MODES.filter((mode) => mode !== "always-ask" || mode === current);+}diff --git a/packages/web/src/features/chat/chat-input.tsx b/packages/web/src/features/chat/chat-input.tsxindex 44712af8..1ff33a92 100644--- a/packages/web/src/features/chat/chat-input.tsx+++ b/packages/web/src/features/chat/chat-input.tsx@@ -722,6 +722,7 @@ export function ChatInput({sessionId,vision,approvalMode,+ approvalModes,onChangeApprovalMode,sandbox,onChangeSandbox,@@ -889,6 +890,12 @@ export function ChatInput({/** Whether the current model supports image input (models config's vision; assumed supported by default). */vision: boolean;approvalMode: ApprovalMode;+ /**+ * The modes the permission button's Approval section lists, in order (`approvalModeChoices`):+ * all four, except that an organization's Session leaves out `always-ask` unless it is the+ * current value. The button's level and title follow `approvalMode` whatever the list holds.+ */+ approvalModes: readonly ApprovalMode[];/** A returned promise keeps the permission button's pick on screen until the save settles. */onChangeApprovalMode: (mode: ApprovalMode) => void | Promise<unknown>;/** The Session's own sandbox policy (the draft's pick before there is a Session). */@@ -2614,6 +2621,7 @@ export function ChatInput({)}<PermissionSelectapprovalMode={approvalMode}+ approvalModes={approvalModes}sandbox={sandbox}onChangeApprovalMode={onChangeApprovalMode}onChangeSandbox={onChangeSandbox}diff --git a/packages/web/src/features/chat/chat-page.tsx b/packages/web/src/features/chat/chat-page.tsxindex c585a0ed..e22d18bc 100644--- a/packages/web/src/features/chat/chat-page.tsx+++ b/packages/web/src/features/chat/chat-page.tsx@@ -86,6 +86,7 @@ import type { ForkTarget } from "./task-stats-line";import { latestTaskHasSubagent, modelTaskStartCount, taskStartCount } from "./agent-topology";import { ChatInput } from "./chat-input";import type { ComposerControl } from "./chat-input";+import { approvalModeChoices } from "./approval-mode";import type { ComposerReference } from "../../lib/workspace-tree";import {compactionTally,@@ -1807,6 +1808,7 @@ export function ChatPage() {subagents={stream.subagents}models={models?.models ?? []}approvalMode={selected.approvalMode}+ approvalModes={approvalModeChoices(selected.client, selected.approvalMode)}onChangeApprovalMode={onChangeApprovalMode}onChangeSandbox={onChangeSandbox}modeSaving={modeSaving}@@ -1960,6 +1962,8 @@ export function ChatPage() {sessionId={selected.sessionId}vision={vision}approvalMode={selected.approvalMode}+ // An organization's Session is not offered always-ask: nobody is there to be asked.+ approvalModes={approvalModeChoices(selected.client, selected.approvalMode)}onChangeApprovalMode={onChangeApprovalMode}sandbox={selected.sandbox}onChangeSandbox={onChangeSandbox}diff --git a/packages/web/src/features/chat/draft-view.tsx b/packages/web/src/features/chat/draft-view.tsxindex 3b8f232b..0fce9d69 100644--- a/packages/web/src/features/chat/draft-view.tsx+++ b/packages/web/src/features/chat/draft-view.tsx@@ -73,6 +73,7 @@ import { versionBadgeFor } from "../../lib/update-flow";import { openUpdateModal, useUpdateFlow } from "../../lib/use-update-flow";import { ChatInput } from "./chat-input";import type { ComposerControl } from "./chat-input";+import { APPROVAL_MODES } from "./approval-mode";import { adoptDockScope } from "../dock/dock-state";import { setDockCwd } from "../dock/dock-terminal";import { EXAMPLE_FOLDERS } from "./example-tasks";@@ -896,6 +897,8 @@ export function DraftView({contextNow={0}vision={vision}approvalMode={approvalMode}+ // A draft becomes an ordinary conversation, never an organization's: every mode.+ approvalModes={APPROVAL_MODES}onChangeApprovalMode={changeApprovalMode}sandbox={{ ...(chatDefaults?.sandbox ?? UNCONFINED), ...sandboxPick }}onChangeSandbox={changeSandbox}diff --git a/packages/web/src/features/chat/permission-select.tsx b/packages/web/src/features/chat/permission-select.tsxindex 94ad485b..b9b922ac 100644--- a/packages/web/src/features/chat/permission-select.tsx+++ b/packages/web/src/features/chat/permission-select.tsx@@ -7,6 +7,9 @@* Filesystem and Network edit the Session's own sandbox policy: a Session keeps the policy it* was created with, so the Settings page only decides what NEW Sessions start from.*+ * Approval lists the modes the composer passes in (see approval-mode.ts): an organization's+ * Session is not offered `always-ask` unless it is the current value.+ ** Popup direction depends on context: the draft card has room below and opens downward; the* chat input docked at the bottom of the screen opens upward.*/@@ -25,7 +28,6 @@ import {import { useAuth } from "../../state/auth";import { SettingsDialog } from "../settings/settings-dialog";-const APPROVAL_MODES: ApprovalMode[] = ["always-ask", "read-only", "allow-all", "deny-all"];const FS_MODES: SessionSandbox["mode"][] = ["read-only", "workspace-write", "danger-full-access"];const NETWORK_MODES: SessionSandbox["network"][] = ["open", "local", "none"];@@ -88,6 +90,7 @@ interface PendingPick {export function PermissionSelect({approvalMode: savedApprovalMode,+ approvalModes,sandbox: savedSandbox,onChangeApprovalMode,onChangeSandbox,@@ -95,6 +98,8 @@ export function PermissionSelect({direction = "up",}: {approvalMode: ApprovalMode;+ /** The modes the Approval section lists, in order (`approvalModeChoices`). */+ approvalModes: readonly ApprovalMode[];sandbox: SessionSandbox;/** A save that returns a promise keeps the pick on screen until it settles. */onChangeApprovalMode: (mode: ApprovalMode) => void | Promise<unknown>;@@ -198,7 +203,7 @@ export function PermissionSelect({/>))}<Heading>{P.approval}</Heading>- {APPROVAL_MODES.map((mode) => (+ {approvalModes.map((mode) => (<Choicekey={mode}label={S.chat.approvalModes[mode] ?? mode}diff --git a/packages/web/src/features/chat/subagents-view.tsx b/packages/web/src/features/chat/subagents-view.tsxindex 9d080698..beb34e5d 100644--- a/packages/web/src/features/chat/subagents-view.tsx+++ b/packages/web/src/features/chat/subagents-view.tsx@@ -79,6 +79,7 @@ export function SubagentsView({subagents,models,approvalMode,+ approvalModes,onChangeApprovalMode,onChangeSandbox,modeSaving,@@ -100,6 +101,8 @@ export function SubagentsView({models: ModelInfo[];/** The PARENT session's approval mode — child approvals are judged by it (the same value the main composer edits). */approvalMode: ApprovalMode;+ /** The modes the picker lists for the PARENT session (the main composer's list). */+ approvalModes: readonly ApprovalMode[];onChangeApprovalMode: (mode: ApprovalMode) => void;/** Edits the PARENT session's sandbox policy — a child runs under its root's. */onChangeSandbox: (pick: Partial<SessionSandbox>) => void;@@ -300,6 +303,7 @@ export function SubagentsView({deliveredInputs={countDeliveredInputs(activeModel)}models={models}approvalMode={approvalMode}+ approvalModes={approvalModes}onChangeApprovalMode={onChangeApprovalMode}sandbox={session.sandbox}onChangeSandbox={onChangeSandbox}@@ -344,6 +348,7 @@ function SubagentComposer({deliveredInputs,models,approvalMode,+ approvalModes,onChangeApprovalMode,sandbox,onChangeSandbox,@@ -360,6 +365,7 @@ function SubagentComposer({deliveredInputs: number;models: ModelInfo[];approvalMode: ApprovalMode;+ approvalModes: readonly ApprovalMode[];onChangeApprovalMode: (mode: ApprovalMode) => void;/** The PARENT session's sandbox policy. */sandbox: SessionSandbox;@@ -465,6 +471,7 @@ function SubagentComposer({contextNow={contextNow}vision={false}approvalMode={approvalMode}+ approvalModes={approvalModes}onChangeApprovalMode={onChangeApprovalMode}sandbox={sandbox}onChangeSandbox={onChangeSandbox}diff --git a/packages/web/test/approval-mode.test.ts b/packages/web/test/approval-mode.test.tsnew file mode 100644index 00000000..5164a49e--- /dev/null+++ b/packages/web/test/approval-mode.test.ts@@ -0,0 +1,38 @@+/**+ * approval-mode.ts: which approval modes the composer's picker lists. An organization's+ * Session (`client: "org"`) runs with nobody watching — the server denies on the spot any call+ * its mode would hand to a person — so `always-ask` is left out there, as in the organization+ * settings. The one exception is a row that already stores it: the entry stays listed while it+ * is the current value, rather than the menu showing nothing selected. Every other Session+ * gets all four.+ */+import { describe, expect, it } from "vitest";+import { APPROVAL_MODES, approvalModeChoices } from "../src/features/chat/approval-mode";++describe("approvalModeChoices", () => {+ it("lists every mode for a Session the organization runtime did not open", () => {+ expect(APPROVAL_MODES).toEqual(["always-ask", "read-only", "allow-all", "deny-all"]);+ // `undefined`: a row from before the column existed, which reads as a web Session.+ for (const client of ["web", "cli", undefined] as const) {+ expect(approvalModeChoices(client, "allow-all")).toEqual(APPROVAL_MODES);+ expect(approvalModeChoices(client, "always-ask")).toEqual(APPROVAL_MODES);+ }+ });++ it("leaves always-ask out for an organization's Session", () => {+ for (const current of ["read-only", "allow-all", "deny-all"] as const) {+ expect(approvalModeChoices("org", current)).toEqual(["read-only", "allow-all", "deny-all"]);+ }+ });++ it("keeps always-ask listed, in its usual place, while an organization's Session stores it", () => {+ expect(approvalModeChoices("org", "always-ask")).toEqual([+ "always-ask",+ "read-only",+ "allow-all",+ "deny-all",+ ]);+ // Once another mode is picked, it is no longer offered.+ expect(approvalModeChoices("org", "deny-all")).not.toContain("always-ask");+ });+});diff --git a/plugins/agent-company/plugin.json b/plugins/agent-company/plugin.jsonindex 2b3e5494..6f93cd0f 100644--- a/plugins/agent-company/plugin.json+++ b/plugins/agent-company/plugin.json@@ -3,7 +3,7 @@"description_zh": "把 Project 里的 Agent 组织成一家公司:先与用户一问一答地创建组织,再是每个工位会话与工单会话都遵循的员工协议(触发块、工单看板、频道礼仪、预算、重负载或不可逆的事先向董事会请示),以及 CEO、人事与财务的操作手册——使命拆解为工单、招募与日程、预算与成本巡检——还有科研协议(在董事会批准的资源额度内跑 autoresearch 式实验循环、作者与审稿人对抗评审),以及让数字分身在真人之间传话的镜像协议。","short_description": "Company setup plus the employee, CEO, HR, finance, research and mirror playbooks.","short_description_zh": "创建组织,以及员工、CEO、人事、财务、科研、镜像公司的操作手册。",- "version": "2026.09.17.2",+ "version": "2026.09.18.1","category": "agent-company","preinstall": false}diff --git a/plugins/agent-company/skills/company-ceo/SKILL.md b/plugins/agent-company/skills/company-ceo/SKILL.mdindex d030a8a4..6fa5f6dd 100644--- a/plugins/agent-company/skills/company-ceo/SKILL.md+++ b/plugins/agent-company/skills/company-ceo/SKILL.md@@ -125,7 +125,7 @@ Important decisions are proposed, not taken. Before any of the following you pos- hiring: which roles, how many, with what budgets — the whole plan in one message, not one hire at a time; models only if the board asked for particular ones, otherwise every hire runs on the organization's model, or the Project's default when the organization names none;- budgets: setting or raising any employee's budget, or your own; an employee's model, since a model is a cost;- rejecting a ticket someone else proposed, or closing a P0 / P1 ticket as done without a review;-- changing `org_config.toml`, this handbook's rules or the organization's structure (moving a subordinate to another manager, offboarding).+- changing `org_config.toml`, this handbook's rules or the organization's structure (moving a subordinate to another manager, offboarding) — except the approval mode, which is not yours to change even with a yes: it belongs to the board, which changes it in the organization's settings. You only propose it, and never edit `approval_mode` in `org_config.toml` (`company-employee`, "What you may not decide alone").Write the proposal so it can be answered in one line: what you propose, why, what it costs, and the alternatives you rejected, ending with the explicit question. Then end the run. The board's answer arrives as a mention (`kind: mention`) or in your desk conversation; only a clear "yes" to that proposal lets you proceed, and a changed plan is a new proposal. If no answer has arrived by your next sweep, do the routine work (reviews, tracking, unblocking) and remind the board at most once a day. Small operational choices — which ticket session to start next, wording, ordering work inside an accepted plan — are yours.diff --git a/plugins/agent-company/skills/company-employee/SKILL.md b/plugins/agent-company/skills/company-employee/SKILL.mdindex f21eabfd..11e1bf55 100644--- a/plugins/agent-company/skills/company-employee/SKILL.md+++ b/plugins/agent-company/skills/company-employee/SKILL.md@@ -19,7 +19,7 @@ Write in the organization's **working language** — the one the handbook's 「| Path | What it is | Who writes it || --- | --- | --- |-| `org_config.toml` | Name, mission, status, timezone, approval mode, mention chain limit, budget ratios, creator | humans, the CEO |+| `org_config.toml` | Name, mission, status, timezone, approval mode, mention chain limit, budget ratios, creator | humans, the CEO — except `approval_mode`, which only the board changes, in the organization's settings || `org_chart.yaml` | The employee tree: `agent_id`, `title`, `reports_to`, `duties`, `workspace`, `budget`, `model` | the CEO and HR, through `penguin org hire` / `employee set` || `desks.toml` | Employee → current desk session | the server only || `calendar/<agent_id>/<name>.toml` | One calendar event per file | its employee, HR |@@ -157,6 +157,8 @@ Your sessions run unattended under the organization's approval mode, so the lineWhen you cannot measure a threshold, estimate; when two rules could apply, the stricter one does.+The approval mode itself belongs to the board. The board changes it in the organization's settings, which moves every open desk and ticket session to the new mode at once; `approval_mode` in `org_config.toml` is never yours to edit, not even after a yes, because a hand edit reaches only the sessions opened after it. If you think the organization needs another mode, ask the board in the all-hands channel ("Asking the board"), naming the mode and what it would unblock.+## Asking the boardThe board is the humans of the Project; the one you ask is the organization's creator — `created_by` in `org_config.toml`, written `@user:<id>`. Ask in the **all-hands channel** (`default_channel`): it is the one channel every person is in, and a mention of someone a channel does not hold is refused. One message a person can answer with one word — what you want to run, what it needs (estimated duration, CPU/GPU, memory, disk, network, money if any), how to stop it, and what you do if the answer is no — then block the ticket on that person, and **end the run**: