Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(session): strip forged steering origin and tighten outbox poison
vastsa63cd20885e43
diff --git a/apps/desktop/electron/main/persistence-outbox.ts b/apps/desktop/electron/main/persistence-outbox.tsindex 08c60d830..1c0ab34a4 100644--- a/apps/desktop/electron/main/persistence-outbox.ts+++ b/apps/desktop/electron/main/persistence-outbox.ts@@ -101,10 +101,9 @@ export class PersistenceOutbox {data: String(error),});} else if (isPoisonMessageError(error)) {- // The host will reject this row forever (for example provenance- // check: a steering message written into the wrong session). Drop- // only this entry and keep draining so one poisoned head cannot- // starve every later message out of the transcript.+ // The host will reject this row forever (provenance / permission+ // on this message). Drop only this entry and keep draining so one+ // poisoned head cannot starve later transcript rows (D597).this.logger("warn", "session persistence flush dropped poisoned message", {key: current.key,data: String(error),@@ -171,11 +170,12 @@ function isDuplicateMessageIdError(error: unknown): boolean {}/**- * The host will reject this message on every attempt, no matter how many times- * it is retried. These are permanent, message-level errors (provenance /- * validation / permission), not transient host failures. Dropping the row is- * the only way to keep the FIFO outbox from starving every message behind it.+ * The host will reject this message on every retry. Match the host-core+ * provenance prefix in the JSON-RPC message body (append maps those failures+ * as INTERNAL). Do not treat PLUGIN_PERMISSION_DENIED or schema+ * INVALID_PARAMS as poison — those are a different surface, and serde+ * failures do not even put INVALID_PARAMS in the message text.*/function isPoisonMessageError(error: unknown): boolean {- return /PERMISSION_DENIED|INVALID_(ARGUMENT|PARAMS)|NOT_FOUND: session/i.test(String(error));+ return /(?<![A-Z_])PERMISSION_DENIED:/i.test(String(error));}diff --git a/apps/desktop/test/persistence-outbox.test.mjs b/apps/desktop/test/persistence-outbox.test.mjsindex 612a1bdfc..247f45520 100644--- a/apps/desktop/test/persistence-outbox.test.mjs+++ b/apps/desktop/test/persistence-outbox.test.mjs@@ -161,3 +161,23 @@ test("poisoned provenance message does not stall later outbox entries (D597)", alogs.some((row) => row.message === "session persistence flush dropped poisoned message"),);});++test("PLUGIN_PERMISSION_DENIED is not poison and still pauses the outbox (D597)", async () => {+ const dir = await mkdtemp(join(tmpdir(), "pi-outbox-"));+ const outbox = new PersistenceOutbox(dir, silent);+ const host = mockHost(async () => {+ throw new Error("PLUGIN_PERMISSION_DENIED: missing grant for fs.write");+ });+ const getHost = () => host;+ await outbox.enqueue(+ { key: "message:s1:a", sessionId: "s1", message: { id: "a" } },+ getHost,+ );+ await outbox.enqueue(+ { key: "message:s2:b", sessionId: "s2", message: { id: "b" } },+ getHost,+ );+ await outbox.flush(getHost);+ assert.equal(outbox.size(), 2);+});+diff --git a/crates/host-core/src/session_collaboration/provenance.rs b/crates/host-core/src/session_collaboration/provenance.rsindex 16a41cd50..7c44ed4cc 100644--- a/crates/host-core/src/session_collaboration/provenance.rs+++ b/crates/host-core/src/session_collaboration/provenance.rs@@ -34,6 +34,8 @@ pub fn prepare_append("PERMISSION_DENIED: steering input does not target its delivery session"));}+ // Extra human input must not inherit or smuggle agent origin.+ message.session_message = None;return Ok(message);}if delivery.target_session_id != session_iddiff --git a/crates/host-core/src/session_collaboration/tests.rs b/crates/host-core/src/session_collaboration/tests.rsindex bc82106ae..1223216d8 100644--- a/crates/host-core/src/session_collaboration/tests.rs+++ b/crates/host-core/src/session_collaboration/tests.rs@@ -247,14 +247,24 @@ fn steering_input_persists_without_inheriting_delivery_origin() {let message = send(&db, &parent, &child, "one");let turn = begin_turn(&db, &child, &message.id, None, None).unwrap();+ // The delivery user row still receives host-derived origin.+ sessions::append_message(&db, &child, &ui("user", &message.content), Some(&turn)).unwrap();+// Additional human input into the delivery turn keeps its human origin: it- // must not be rejected as a delivery mismatch, and it must not be stamped- // with the delivery's agent origin.+ // must not be rejected as a delivery mismatch, must not inherit the+ // delivery's agent origin, and must drop a client-supplied origin.let mut steering = ui("user", "also update the docs");steering.steering = Some(true);+ steering.session_message = Some(json!({"messageId":"forged","kind":"task"}));sessions::append_message(&db, &child, &steering, Some(&turn)).unwrap();let detail = sessions::get_session(&db, &child).unwrap().unwrap();+ let delivery_row = detail+ .messages+ .iter()+ .find(|m| m.content == message.content)+ .expect("delivery user persisted");+ assert!(delivery_row.session_message.is_some());let appended = detail.messages.iter()diff --git a/docs/adr/0041-bounded-host-runtime-and-persistence-outbox.md b/docs/adr/0041-bounded-host-runtime-and-persistence-outbox.mdindex eed2d1d31..fc8d4e51e 100644--- a/docs/adr/0041-bounded-host-runtime-and-persistence-outbox.md+++ b/docs/adr/0041-bounded-host-runtime-and-persistence-outbox.md@@ -28,7 +28,9 @@ and are flushed sequentially after a successful host handshake. The handshakemessage append is idempotent by message id. A colliding id that already belongsto another session is remapped to `{sessionId}:{id}` before the JSONL write(D444). The outbox treats `UNIQUE constraint failed: messages.id` as an ack,-not a pause.+not a pause. A permanently rejected append (`PERMISSION_DENIED:` provenance+or permission on that row) is dropped the same way so one poison head cannot+fill the 1024-entry cap and discard every later row (D597).## Consequencesdiff --git a/docs/adr/0239-session-collaboration-messages.md b/docs/adr/0239-session-collaboration-messages.mdindex 9f13323c3..ffde65449 100644--- a/docs/adr/0239-session-collaboration-messages.md+++ b/docs/adr/0239-session-collaboration-messages.md@@ -38,6 +38,9 @@ Messages have explicit task, message, or completion provenance, persisted withthe transcript and rendered separately from human input. Live model prompts andrestored history use the same source framing. Session messages are not new humanauthorization and do not participate in user-message editing or regeneration.+Accepted user steering into a claimed delivery turn remains human input: it does+not receive the delivery origin, and a client-supplied `session_message` is+stripped (D597).A requested completion callback produces at most one durable completion messageto the originating session. It references the original delivery and the actualdiff --git a/docs/adr/active-turn-steering.md b/docs/adr/active-turn-steering.mdindex 6284ef216..4f997034e 100644--- a/docs/adr/active-turn-steering.md+++ b/docs/adr/active-turn-steering.md@@ -30,7 +30,11 @@ row. Host append permits a terminal assistant to replace its own streamingreservation, retaining sequence and turn ownership; completed rows remainimmutable on replay. Recovery updates the reservation in place. The persisted`UiMessage.steering` marker protects input from Smart Stop, including after-renderer reload; no separate renderer submission registry is needed.+renderer reload; no separate renderer submission registry is needed. Host+provenance treats steering into a claimed collaboration delivery turn as extra+human input: it must target that delivery's session, does not inherit the+delivery's agent origin, and strips any client-supplied `session_message`+(D597).## Consequences and validationdiff --git a/docs/spec/03-runtime/04-data-storage.md b/docs/spec/03-runtime/04-data-storage.mdindex 8fbc297ad..8d1660118 100644--- a/docs/spec/03-runtime/04-data-storage.md+++ b/docs/spec/03-runtime/04-data-storage.md@@ -1435,7 +1435,14 @@ host call is still pending. If `messages.id` already belongs to anothersession, the host remaps to `{sessionId}:{id}` before any JSONL write; areplay of the original id is a no-op against that remapped row. The outboxtreats `UNIQUE constraint failed: messages.id` as an ack and keeps draining-(D444). No schema migration is required.+(D444). A permanently rejected append whose host error carries a+`PERMISSION_DENIED:` prefix is likewise dropped so the FIFO can continue;+`PLUGIN_PERMISSION_DENIED` and other host failures still pause (D597).+Steering into a claimed collaboration delivery turn is extra human input: it+must target that delivery's session, is exempt from the delivery+content/attachment contract, does not inherit the delivery origin, and has+any client-supplied `session_message` stripped. No schema migration is+required.## 12. Native Pi session authority (ADR 0254)diff --git a/docs/spec/03-runtime/06-host-rpc-protocol.md b/docs/spec/03-runtime/06-host-rpc-protocol.mdindex d1ab5b3a1..0ede6ddab 100644--- a/docs/spec/03-runtime/06-host-rpc-protocol.md+++ b/docs/spec/03-runtime/06-host-rpc-protocol.md@@ -478,7 +478,9 @@ The ledger is durable across a host restart. A queued entry with itsan unclaimed or running delivery is marked `interrupted` by the startup fenceand is never replayed automatically. Transcript provenance is host-derived andcannot be forged or removed by `session.appendMessage` or transcript-replacement.+replacement. Steering (`UiMessage.steering`) into a claimed delivery turn is+additional human input in that session: it does not receive the delivery+origin, and a client-supplied `session_message` is stripped (D597).The host rejects unknown roles, non-RFC3339 or non-monotonic timestamps, andoversized/deep payloads. Tool values are sanitized for host-reserved keys. The@@ -570,7 +572,8 @@ a later replay of the original id is a no-op (D444). Electron main may keepmessage appends in its application-owned outbox while host-core is restarting;the outbox flushes in order after a successful handshake and treats`UNIQUE constraint failed: messages.id` as an ack rather than pausing the-queue. A missing sessions row is restored from the live JSONL (or created as a+queue. A `PERMISSION_DENIED:` append is dropped the same way so a poison head+cannot stall the FIFO (D597). A missing sessions row is restored from the live JSONL (or created as astub under the same id when the file is gone) so a queued outbox can drain(D318). `session.delete` drops that session's outbox entries. In-flightcheckpoints never go through the outbox: a checkpoint is only meaningfuldiff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex f4cc24ac2..0718da938 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -1063,6 +1063,29 @@ identify the platform validation still needed.- **Status**: Unit-covered (`append_message_remaps_ids_owned_by_another_session`,`persistence-outbox.test.mjs`); desktop journey outstanding+#### E2E-SESSION-outbox-poison-does-not-drop-history++- **Preconditions**: A session-collaboration delivery turn is running. The user+ steers with Alt+Enter (content that does not match the delivery). Later+ assistant and tool rows from this or another session queue behind that+ append. Optionally the outbox already holds a `PERMISSION_DENIED:` head from+ an older host.+- **Steps**: 1) Start a collaboration delivery turn. 2) Alt+Enter a steering+ prompt. 3) Let the turn produce assistant/tool rows, including in another+ session if convenient. 4) Quit and reopen. 5) Open the affected sessions.+- **Expected**: Steering persists as a human user row with no+ `session_message` origin. The delivery user row still has host-derived+ origin. Later assistant/tool rows survive reopen. The outbox is empty and+ did not stay paused on `PERMISSION_DENIED:`. A `PLUGIN_PERMISSION_DENIED`+ head would still pause rather than drain.+- **Specs linked**: `03-runtime/04-data-storage.md`,+ `03-runtime/06-host-rpc-protocol.md`, ADR 0041, ADR 0239,+ ADR active-turn-steering, D597+- **Acceptance**: F (persistence)+- **Milestone**: M2+- **Status**: Unit-covered (`steering_input_persists_without_inheriting_delivery_origin`,+ `persistence-outbox.test.mjs`); desktop journey outstanding+#### E2E-011: Switch between project and temporary sessionsdiff --git a/docs/spec/08-meta/decisions-log.md b/docs/spec/08-meta/decisions-log.mdindex 512b295be..0c8b3b690 100644--- a/docs/spec/08-meta/decisions-log.md+++ b/docs/spec/08-meta/decisions-log.md@@ -270,6 +270,7 @@ Gold source: local Codex electron captures; latest row wins where rows conflict.| D324 | Idle session switch keeps a not-yet-flushed completed tail | **Amend D317 / ADR 0137 in the renderer: `selectSession` stitches the bounded durable page onto the live snapshot whenever the session is running or still has live provenance (`liveSessionTranscripts`). A completed assistant/tool row that the durable page does not yet contain stays. Live provenance is cleared only once that page already contains every live id, not merely because the turn ended. Renderer only: no IPC, storage, host-protocol, or pagination change.** | User prompts persist before the model runs; assistant/tool rows go through the async outbox and land after `message_end`. After `agent_end`, idle revalidation used the durable page only and dropped replies that were already on screen (issue #41). || D327 | Completed replies survive process restart | **Amend D299 / ADR 0153 / ADR 0041: the finished `message_end` snapshot is checkpointed before the outbox append; `completed`/`error` `session.endTurn` deletes `.inflight.json` only when that id is already indexed; boot recovery skips completed leftovers so the outbox can append first; handshake awaits that drain then `session.recoverInflightMessages` promotes any leftover as `complete`. Additive RPC, no protocol or schema version change.** | The same user-only transcript as issue #41 after a full quit (issue #42): user rows are durable before the model runs, assistant/tool rows sit in the outbox, and D324's live merge does not survive process teardown. || D444 | Cross-session message id collision remaps; outbox UNIQUE is not a pause | **Amend ADR 0041 / D327: `session.appendMessage` still treats an id already indexed in the same session as a no-op (or a terminal-assistant replacement of a streaming row). If that globally unique `messages.id` already belongs to another session, the host remaps to `{sessionId}:{id}` before writing JSONL or the index, and a later replay of the original id is also a no-op against the remapped row. Electron's persistence outbox treats `UNIQUE constraint failed: messages.id` as an idempotent ack and continues draining, so one colliding toolCallId cannot stall every later assistant/tool row or fill the 1024-entry cap. No protocol or schema version change.** | Provider tool rows used `toolCallId` (e.g. `call_421522`) as `messages.id`. Those ids are not globally unique. A collision failed SQLite after the JSONL write, the FIFO outbox paused on that head, later rows from every session never persisted, and a quit showed earlier history as gone (issue #523). |+| D597 | Drain poison outbox entries; accept steering into a delivery turn | **Amend ADR 0041 / ADR 0239 / ADR active-turn-steering / D444: Electron's persistence outbox treats a host append whose message carries a `PERMISSION_DENIED:` prefix as a permanent rejection, drops that row, and keeps draining. `PLUGIN_PERMISSION_DENIED` and other failures still pause. Host provenance accepts `UiMessage.steering` into a claimed collaboration delivery turn when the target session matches, without stamping the delivery origin and after stripping any client-supplied `session_message`. Cross-session steering is still `PERMISSION_DENIED`. No protocol or schema version change.** | Alt+Enter into a session-collaboration delivery turn was rejected as a delivery mismatch, the outbox retried that head forever, filled to 1024, and later assistant/tool rows were discarded so the transcript kept only user messages. || D328 | Parent-judged subagent lifetime | **Amend ADR 0089 / ADR 0119 / ADR 0129: idle and duration watchdogs are not armed; parent `agent_end` does not abort running delegates; the runtime keeps the durable turn open and prompts the parent with reports when they finish. `TaskWait` timeout and `TaskList` return a heartbeat (agent, status, elapsed, turns, last tool). Only `TaskStop` and user Stop abort a delegate. Explicit `maxTurns` and the concurrency cap of 10 stay. Runtime only: no IPC, storage, or host-protocol change.** *(amended by D352: a terminal parent error does abort leftover delegates and returns the session to idle)* | The parent cannot see live delegate work and treats `TaskWait` expiry as permission to finish, after which abort-on-end killed the unfinished job. Waiting is an event loop; models are not. || D352 | Parent fatal error aborts leftover delegates | **Amend D328 / ADR 0166: parent idle still keeps the durable turn open and does not abort running delegates. A terminal parent provider/stream error (including exhausted HTTP 429), overflow-recovery failure, mutation-budget termination, or rejected prompt aborts leftover delegates, skips the D328 resume prompt, and emits `agent_end`. `isRunning` does not count leftover delegates after that error, so Continue is not `AGENT_BUSY`. A later `agent_end` must not overwrite the failed TurnOutcomeCard. Each new parent prompt bumps a turn epoch and only auto-resumes delegates started in that turn. Runtime and renderer only: no IPC, storage, or host-protocol change.** | After a parent 429 the UI showed Continue while a Gemini (or other) subagent kept the sidecar busy, so the next prompt was `session already has an active turn`. See ADR 0189 and E2E-155. || D354 | Label both macOS release architectures | **Amend D353 / ADR 0145: both native macOS release lanes pass target-specific electron-builder patterns. Public assets are `PI-Desktop-<version>-arm64.dmg` / `PI-Desktop-<version>-arm64-mac.zip` and `PI-Desktop-<version>-x64.dmg` / `PI-Desktop-<version>-x64-mac.zip`. Generated per-architecture updater feeds retain these URLs and checksums. This changes release asset naming only; updater ownership, signing, and delivery mode remain unchanged.** | The arm64 asset `PI-Desktop-0.14.4.dmg` did not identify its architecture, while the x64 lane used a different `Intel` convention. Both public architectures need self-describing, standard labels. |@@ -6244,3 +6245,20 @@ that was sitting at the bottom — including after the turn had finished.exposes enabled canonical levels, and the chip renders the canonical string.Schema v19 rebuilds `sessions` so the CHECK includes `omit`.See ADR 0295 and E2E-203a.++## 2026-09-19 — Drain poison outbox entries; accept steering into a delivery turn (D597)++- Decision D597 amends ADR 0041, ADR 0239, ADR active-turn-steering, and D444.+ A host append whose error message carries a `PERMISSION_DENIED:` prefix is a+ permanent, message-level rejection. The Electron outbox drops that row and+ keeps draining so one poison head cannot fill the 1024-entry cap. Substring+ matches such as `PLUGIN_PERMISSION_DENIED` still pause, as do other host+ failures.+- Steering into a claimed collaboration delivery turn is extra human input in+ that session. It is exempt from the delivery content/attachment contract, does+ not inherit the delivery's agent origin, and has any client-supplied+ `session_message` stripped. Steering that names another session is still+ `PERMISSION_DENIED`.+- See `03-runtime/04-data-storage.md`, `03-runtime/06-host-rpc-protocol.md`,+ E2E-SESSION-outbox-poison-does-not-drop-history.+diff --git a/docs/zh-CN/spec/03-runtime/04-data-storage.md b/docs/zh-CN/spec/03-runtime/04-data-storage.mdindex cf32a8fec..7b35ed8b2 100644--- a/docs/zh-CN/spec/03-runtime/04-data-storage.md+++ b/docs/zh-CN/spec/03-runtime/04-data-storage.md@@ -1284,4 +1284,8 @@ UI投影损失最新检查点。如果主机调用尚未完成时出现更新的追加快照,outbox 同样保留该快照。若 `messages.id` 已属于另一会话,主机在写 JSONL 之前改写为 `{sessionId}:{id}`;重放原始 id 对该改写行无操作。outbox 把 `UNIQUE constraint failed: messages.id`-当作确认并继续排空(D444)。无需存储架构迁移。+当作确认并继续排空(D444)。带 `PERMISSION_DENIED:` 前缀的永久拒绝同样丢弃该行+以便 FIFO 继续;`PLUGIN_PERMISSION_DENIED` 和其他宿主失败仍暂停(D597)。+向已认领的协作投递回合做 steering 是额外的人类输入:必须指向该投递的会话,+不受投递内容/附件契约约束,不继承投递来源,并清掉客户端带来的+`session_message`。无需存储架构迁移。diff --git a/docs/zh-CN/spec/03-runtime/06-host-rpc-protocol.md b/docs/zh-CN/spec/03-runtime/06-host-rpc-protocol.mdindex 22672c665..aa2e0cb2e 100644--- a/docs/zh-CN/spec/03-runtime/06-host-rpc-protocol.md+++ b/docs/zh-CN/spec/03-runtime/06-host-rpc-protocol.md@@ -401,7 +401,7 @@ off | minimal | low | medium | high | xhigh | max在命令启动后重试命令,并在之前获取超时的子命令释放执行槽。-`session.appendMessage` 通过消息 ID 是幂等的。若该 id 已属于另一会话,则在写 JSONL 之前改写为 `{sessionId}:{id}`,之后重放原始 id 为无操作(D444)。Electron 主进程可以在 host-core 重启时把消息留在应用自有 outbox 里;握手成功后按顺序冲洗,并把 `UNIQUE constraint failed: messages.id` 当作确认而不是停整队。进行中检查点从不经过发件箱:检查点只对存活的主机有意义,在最终行之后重放它是错误的。+`session.appendMessage` 通过消息 ID 是幂等的。若该 id 已属于另一会话,则在写 JSONL 之前改写为 `{sessionId}:{id}`,之后重放原始 id 为无操作(D444)。Electron 主进程可以在 host-core 重启时把消息留在应用自有 outbox 里;握手成功后按顺序冲洗,并把 `UNIQUE constraint failed: messages.id` 当作确认而不是停整队。带 `PERMISSION_DENIED:` 前缀的追加同样丢弃以免毒消息卡住 FIFO(D597)。进行中检查点从不经过发件箱:检查点只对存活的主机有意义,在最终行之后重放它是错误的。### 权限- `permissions.evaluate`diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.mdindex 389921317..27c561ee6 100644--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md@@ -494,6 +494,16 @@ unit/integration 测试;代码 pull request 使用有选择且高价值的 E2E- **里程碑**:M2- **状态**:单位已覆盖(`append_message_remaps_ids_owned_by_another_session`、`persistence-outbox.test.mjs`);桌面旅程待补+#### E2E-SESSION-outbox-poison-does-not-drop-history++- **先决条件**:一个 session-collaboration 投递回合正在运行。用户用 Alt+Enter 做 steering(内容与投递不一致)。之后本会话或其他会话的助手/工具行排在这条追加后面。可选:outbox 里已有旧宿主留下的 `PERMISSION_DENIED:` 队头。+- **步骤**:1) 开始一次协作投递回合。2) Alt+Enter 一条转向输入。3) 让该回合产出助手/工具行(也可在另一会话)。4) 退出并重新打开。5) 打开受影响会话。+- **预期**:steering 作为没有 `session_message` 来源的人类用户行落盘。投递用户行仍有宿主来源。更晚的助手/工具行在重新打开后仍在。outbox 为空,没有停在 `PERMISSION_DENIED:`。`PLUGIN_PERMISSION_DENIED` 队头仍会暂停而不是排空。+- **链接规格**:`03-runtime/04-data-storage.md`、`03-runtime/06-host-rpc-protocol.md`、ADR 0041、ADR 0239、ADR active-turn-steering、D597+- **接受**:F(持久化)+- **里程碑**:M2+- **状态**:单位已覆盖(`steering_input_persists_without_inheriting_delivery_origin`、`persistence-outbox.test.mjs`);桌面旅程待补+#### E2E-173:展开中的实时委托运行过程跟随最新输出diff --git a/docs/zh-CN/spec/08-meta/decisions-log.md b/docs/zh-CN/spec/08-meta/decisions-log.mdindex e7a88982d..c858dc603 100644--- a/docs/zh-CN/spec/08-meta/decisions-log.md+++ b/docs/zh-CN/spec/08-meta/decisions-log.md@@ -274,6 +274,7 @@| D324 | 空闲切换保留尚未刷入的已完成尾巴 | **在渲染器中修订 D317 / ADR 0137:`selectSession` 在会话仍在运行或仍有实时来源(`liveSessionTranscripts`)时,把有界持久化页缝到实时快照上。持久化页尚未包含的已完成助手/工具行予以保留。只有当该页已包含每一个实时 id 时才清掉实时来源,而不是回合一结束就清。仅渲染器:不改动 IPC、存储、主机协议或分页。** | 用户提示在模型运行前就落盘;助手/工具行走异步 outbox,在 `message_end` 之后才写入。`agent_end` 之后的空闲再验证只用持久化页,会丢掉已经显示在屏幕上的回复(issue #41)。 || D327 | 已完成回复在进程重启后仍然存在 | **修订 D299 / ADR 0153 / ADR 0041:`message_end` 的完成快照在 outbox 追加之前先做检查点;`completed`/`error` 的 `session.endTurn` 仅在该 id 已索引时才删除 `.inflight.json`;启动恢复跳过已完成残留以便 outbox 先追加;握手等待排空后再用 `session.recoverInflightMessages` 把剩下的提升为 `complete`。附加 RPC,不改协议或 schema 版本。** | 与 issue #41 相同的「只剩用户消息」画面,但发生在完全退出之后(issue #42):用户行在模型运行前就落盘,助手/工具行停在 outbox,D324 的实时缝合无法跨进程。 || D444 | 跨会话消息 id 碰撞时改写;outbox 的 UNIQUE 不再停整队 | **修订 ADR 0041 / D327:`session.appendMessage` 仍把本会话已索引的 id 当作无操作(或用终态助手替换流式行)。若该全局唯一 `messages.id` 已属于另一会话,主机在写 JSONL 或索引之前改写为 `{sessionId}:{id}`,之后重放原始 id 也对改写后的行无操作。Electron 持久化 outbox 把 `UNIQUE constraint failed: messages.id` 当作幂等确认并继续排空,因此一个撞车的 toolCallId 不会卡住之后所有助手/工具行,也不会把 1024 上限填满。不改协议或 schema 版本。** | 工具行曾把 `toolCallId`(如 `call_421522`)当作 `messages.id`,这些 id 并不全局唯一。碰撞会在 JSONL 写完后 SQLite 失败,FIFO outbox 停在队头,所有会话的后续行都无法落盘,退出后再开就像前期历史丢了(issue #523)。 |+| D597 | 丢弃 outbox 毒消息;接受投递回合内的 steering | **修订 ADR 0041 / ADR 0239 / ADR active-turn-steering / D444:Electron 持久化 outbox 把消息正文带 `PERMISSION_DENIED:` 前缀的追加当作永久拒绝,丢掉该行并继续排空。`PLUGIN_PERMISSION_DENIED` 和其他失败仍暂停。宿主 provenance 在目标会话一致时接受已认领协作投递回合上的 `UiMessage.steering`,不盖投递来源,并清掉客户端带来的 `session_message`。跨会话 steering 仍是 `PERMISSION_DENIED`。不改协议或 schema 版本。** | 向 session-collaboration 投递回合按 Alt+Enter 会被当成投递不匹配拒绝,outbox 永远重试队头,打满 1024 后丢掉后面的助手/工具行,转录只剩用户消息。 || D328 | 由父级判定的子智能体寿命 | **修订 ADR 0089 / ADR 0119 / ADR 0129:不武装空闲和时长看门狗;父级 `agent_end` 不中止仍在跑的委托;运行时保持持久回合打开,完成时把报告交给父级。`TaskWait` 超时和 `TaskList` 返回心跳。只有 `TaskStop` 和用户 Stop 会中止委托。显式 `maxTurns` 和并发上限 10 保留。运行时专用,不改 IPC、存储或主机协议。** | 父级看不到实时委托工作,把 `TaskWait` 到期当成可以收工;等待是事件循环,模型不是。 || D352 | 父级终态错误中止残留委托 | **修订 D328 / ADR 0166:父级空闲仍不中止委托。终端父级 provider/stream 错误(含耗尽的 HTTP 429)、溢出恢复失败、变更预算终止或拒绝的提示会中止残留委托、跳过 D328 续跑提示并发出 `agent_end`。`isRunning` 在该错误后不计残留委托,因此继续不会变成 `AGENT_BUSY`。见 ADR 0189 与 E2E-155。** | 父级 429 后 UI 显示继续,子智能体仍占 sidecar,下一条提示变成 session already has an active turn。 || D354 | 同时标注两个 macOS 发布架构 | **修订 D353 / ADR 0145:两条原生 macOS 发布通道都使用带架构后缀的 electron-builder 模式。公开资产为 `PI-Desktop-<version>-arm64.dmg` / `-arm64-mac.zip` 以及 `-x64.dmg` / `-x64-mac.zip`。更新源 URL 与校验和保持一致。只改发布资产命名。** | arm64 资产原先不标明架构,x64 又用另一套 Intel 约定。 |@@ -4478,3 +4479,16 @@ that amendment are retired by ADR 0268; the upstream work-panel lifecycle stays.共用低层 omit 路径,适配器不发送思考字段。显式 `off` 仍关闭思考。- Composer 推理菜单在所选模型有已启用规范档位时把 `omit` 放在最前,芯片渲染规范字符串。Schema v19 重建 `sessions` 以使 CHECK 包含 `omit`。见 ADR 0295 与 E2E-203a。++## 2026-09-19 —— 丢弃 outbox 毒消息;接受投递回合内的 steering(D597)++- 决策 D597 修订 ADR 0041、ADR 0239、ADR active-turn-steering 与 D444。+ 宿主追加错误消息带 `PERMISSION_DENIED:` 前缀时是永久的、消息级拒绝。+ Electron outbox 丢掉该行并继续排空,避免一条毒消息把 1024 上限填满。+ `PLUGIN_PERMISSION_DENIED` 这类子串以及其他宿主失败仍暂停。+- 向已认领的协作投递回合做 steering 是该会话里额外的人类输入:不受投递+ 内容/附件契约约束,不继承投递来源,并清掉客户端带来的 `session_message`。+ 指向另一会话的 steering 仍是 `PERMISSION_DENIED`。+- 见 `03-runtime/04-data-storage.md`、`03-runtime/06-host-rpc-protocol.md`、+ E2E-SESSION-outbox-poison-does-not-drop-history。+