Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
docs: renumber the resume ADR to 0279 and sync the spec, E2E and references
Tioit-Wang89490e3e5d38
diff --git a/apps/desktop/src/lib/assistant-turns.ts b/apps/desktop/src/lib/assistant-turns.tsindex 2ec9d9b0e..cf9c0bd2a 100644--- a/apps/desktop/src/lib/assistant-turns.ts+++ b/apps/desktop/src/lib/assistant-turns.ts@@ -105,7 +105,7 @@ function collectSubagentRuns(return runs;}-// Map each Task call to the last call of its chain (ADR 0276): a resumed+// Map each Task call to the last call of its chain (ADR 0279): a resumed// delegation is one delegate session continued by a later Task call, so the// chain's rows all belong on the latest card, where they read as one// continuing conversation rather than a card per call.diff --git a/apps/desktop/test/assistant-turns.test.mjs b/apps/desktop/test/assistant-turns.test.mjsindex 7d35b30e8..46453fba1 100644--- a/apps/desktop/test/assistant-turns.test.mjs+++ b/apps/desktop/test/assistant-turns.test.mjs@@ -259,7 +259,7 @@ test("a delegate turn with both reasoning and text keeps both rows", () => {);});-test("a resumed delegation continues in the latest Task card (ADR 0278)", () => {+test("a resumed delegation continues in the latest Task card (ADR 0279)", () => {const { entries, visible } = buildTranscriptEntries([message("user", "user", "Audit the store"),message("task-1", "tool", "report", {diff --git a/docs/adr/0062-bounded-subagents-behind-a-task-tool.md b/docs/adr/0062-bounded-subagents-behind-a-task-tool.mdindex 5e987718a..11c1dc4e0 100644--- a/docs/adr/0062-bounded-subagents-behind-a-task-tool.md+++ b/docs/adr/0062-bounded-subagents-behind-a-task-tool.md@@ -4,7 +4,7 @@- Status: Accepted for implementation (definition roots amended by ADR 0112;timeout policy amended by ADR 0119; delegation presentation amended by D265;opt-in parent-tool inherit amended by ADR 0246; resumable delegations amended- by ADR 0276)+ by ADR 0279)- Date: 2026-08-06- Deciders: PI-Desktop core- Related: D201, ADR 0041 (persistence outbox), ADR 0048 (lazy per-turn tool@@ -12,7 +12,7 @@template documents), D138 (session-scoped inline permission requests),D198 (contract modes), ADR 0112 (capability roots and Settings IA), ADR 0119(event-driven subagent timeouts), D265 (one delegation reads as a card too),- ADR 0246 (opt-in `tools: inherit`), ADR 0276 (resumable delegations)+ ADR 0246 (opt-in `tools: inherit`), ADR 0279 (resumable delegations)## Contextdiff --git a/docs/adr/0089-proactive-background-subagent-delegation.md b/docs/adr/0089-proactive-background-subagent-delegation.mdindex 5272b936a..79918f6d1 100644--- a/docs/adr/0089-proactive-background-subagent-delegation.md+++ b/docs/adr/0089-proactive-background-subagent-delegation.md@@ -1,10 +1,10 @@# ADR 0089: Proactive Background Subagent Delegation- Status: Accepted for implementation (resumable delegations amended by- ADR 0276)+ ADR 0279)- Date: 2026-08-16- Deciders: PI-Desktop core-- Related: D201, D202, ADR 0062, ADR 0063, ADR 0048, ADR 0100, ADR 0276, E2E-142+- Related: D201, D202, ADR 0062, ADR 0063, ADR 0048, ADR 0100, ADR 0279, E2E-142## Contextdiff --git a/docs/adr/0276-resumable-subagent-delegations.md b/docs/adr/0279-resumable-subagent-delegations.mdsimilarity index 71%rename from docs/adr/0276-resumable-subagent-delegations.mdrename to docs/adr/0279-resumable-subagent-delegations.mdindex 6cbe9b8d4..0a063a9ac 100644--- a/docs/adr/0276-resumable-subagent-delegations.md+++ b/docs/adr/0279-resumable-subagent-delegations.md@@ -1,4 +1,4 @@-# ADR 0276: Resumable subagent delegations+# ADR 0279: Resumable subagent delegations- Status: Accepted for implementation- Date: 2026-09-17@@ -57,9 +57,10 @@ are keyed by `parentToolCallId`, so reconstructing a chain's context meansselecting every row whose `parentToolCallId` is in the chain and whose`agentName` matches.-`DelegationRecord` gains `delegateSessionId`, `toolCallIdChain`, `resumable`,-`readFiles`, and `readLineCount`. The registry keeps a secondary index from-`delegateSessionId` to the chain's live record.+`DelegationRecord` gains `delegateSessionId`, plus `resumedFrom` and+`modelChangedFrom` on a run that continues a chain. Read tracking lives on the+chain, not the record: the registry keeps one entry per `delegateSessionId` and a+secondary index from every `delegationId` on that chain to it.### 3. Context reconstruction is a pure function@@ -86,23 +87,37 @@ model can act on:| Condition | Error ||---|---|| unknown or evicted id | `Unknown delegation "<id>"` plus the current resumable list |-| still running | `Delegation <id> is still running; call TaskWait to converge first` |+| still running | `Delegation <id> is still running`, call TaskWait first — a resume is never queued || `stopped` / `aborted` | not resumable; a future revive path (out of scope here) |+| `interrupted` (the app closed mid-run) | not resumable; start a new delegation || `Task.agent` differs from the chain's agent | name mismatch, lists available || `Task.model` present on a resume | not allowed on a resumed run — start a new delegation to change models |-| chain exceeds the read budget | the chain is excluded from the resumable list, so this surfaces as unknown id |+| chain exceeds the read budget | `Delegation <id> has read too much to resume cheaply` |+| the chain resolves but has no rows left to replay | the chain is dropped and reported as having no recorded history; the same id is never listed as reusable |No new error codes for "evicted" versus "never existed": both resolve to thesame unknown-id error, because the model's only correct action is identical.+A resume keeps the chain's own model binding. The `providerId/modelId` key the+chain recorded is preferred; a chain rebuilt from the transcript only knows the+model id, which is matched against what the session has configured. Changing the+parent's own session model therefore does not strand a chain, and a delegate never+swaps models by accident. If nothing resolves the recorded binding any more, the+run continues on the binding the definition resolves to now and records the+previous model id in the delegation's lifecycle details as `modelChangedFrom`:+refusing instead would strand the chain forever, and swapping silently would hand+the same conversation to a different model with no trace.+### 5. Only `completed` and `failed` are resumableA `failed` run's reads and findings still have value; its failed assistant rowis dropped by the converter like any other error row. `stopped` and `aborted`encode the user's or the parent's decision to abandon that line of work, and-resuming it would contradict the stop. (`timed_out` is a vestigial status —-ADR 0119's timeouts were withdrawn by D328 — and is treated as `failed` for this-purpose.)+resuming it would contradict the stop. `interrupted` (the app closed while the+run still worked) means the same thing for this purpose: the delegate never+settled, so there is nothing trustworthy to continue. (`timed_out` is a vestigial+status — ADR 0119's timeouts were withdrawn by D328 — and is treated as `failed`+for this purpose.)### 6. One live record per chain, ever@@ -114,10 +129,13 @@ forking successors.### 7. Resumable chains are bounded, LRU, per agent name`MAX_RESUMABLE_CHAINS_PER_AGENT = 2`. Chains are exempt from the existing-`pruneFinishedDelegations` oldest-first sweep while under this bound; exceeding-it evicts the least-recently-used whole chain (record, chain index, and reverse-map entries together). Tombstones are unnecessary: `delegationId` is a random-UUID, so an evicted id cannot collide with a future one.+`pruneFinishedDelegations` oldest-first sweep. Exceeding the bound evicts the+least-recently-used whole chain when a delegation settles — registry entry and+every reverse-map entry together. A chain whose latest run is still working is+never evicted: dropping it would strand the delegate writing into it, so the+bound counts reusable chains and a live chain may momentarily push the group over+it. Tombstones are unnecessary: `delegationId` is a random UUID, so an evicted id+cannot collide with a future one.### 8. Read budget gates chain growth@@ -164,6 +182,19 @@ session launch the runtime scans the transcript's `Task` rows, groups them bytheir `resume` links into chains, and rehydrates the secondary index. Restartdoes not lose resumability.+Two details make a rebuilt chain behave like a live one. Agent names are+normalized on rebuild (`Explorer` and `explorer.md` both mean `explorer`), so the+rebuilt chain still selects its own rows and still matches `Task.agent`. And each+call carries the status its own `Task` row recorded: the settlement projection+rewrites that row in place, so a chain knows whether its last run was `completed`+or `failed`. A run the app closed while it still worked never settled: its row+still says `running`, which rebuilds as `interrupted` — not resumable, rather+than staying open forever. A row that records no status at all is trusted as+settled, because every `Task` row this app writes carries one. The model binding+itself is not persisted as a key, so a rebuilt chain is matched to a configured+binding by model id; two accounts offering the same model id are+indistinguishable at that point.+### 13. The transcript renders a chain as one continuous conversationA resumed delegation's card shows the whole chain's rows as consecutive turns@@ -178,10 +209,9 @@ counters start at zero; `details.resumedFrom` keeps the link auditable.delegate's own context only; the parent still receives nothing but reportsthrough `TaskWait`, and `parentToolCallId` rows are still skipped when theparent's context is rebuilt.-- No new storage schema, tables, or event types. The required fields- (`delegateSessionId`, `toolCallIdChain`, `resumable`, read tracking) live on- the in-memory `DelegationRecord`; `resumedFrom` rides the existing lifecycle- details projection.+- No new storage schema, tables, or event types. Chain identity, read tracking,+ and the model binding live on the in-memory chain; `resumedFrom` and+ `modelChangedFrom` ride the existing lifecycle details projection.- A resumed run is billed and bounded exactly like a fresh one — same concurrencyslot, same permission scope, same fallback models, same abort sources.- Failure mode of the read budget is graceful degradation to a cold start, neverdiff --git a/docs/adr/README.md b/docs/adr/README.mdindex 72aa2bd50..02afac254 100644--- a/docs/adr/README.md+++ b/docs/adr/README.md@@ -305,3 +305,4 @@ Each ADR includes:| 0276 | [Official plugin channel and backup channels](0276-official-plugin-channel-and-backup-channels.md) | Accepted for implementation (amends ADR 0102; D442) || 0277 | [Draggable chat content width](0277-draggable-chat-content-width.md) | Accepted (D439) || 0278 | [Canonical application ID `net.aiuo.pi-desktop`](0278-canonical-application-id.md) | Accepted (D443; amends D141 / D371 / ADR 0204; issue #524) |+| 0279 | [Resumable subagent delegations](0279-resumable-subagent-delegations.md) | Accepted for implementation (amends ADR 0062; ADR 0089; issue #513) |diff --git a/docs/spec/03-runtime/02-agent-runtime.md b/docs/spec/03-runtime/02-agent-runtime.mdindex c112c31c1..666643d7d 100644--- a/docs/spec/03-runtime/02-agent-runtime.md+++ b/docs/spec/03-runtime/02-agent-runtime.md@@ -770,7 +770,7 @@ also aborts leftover delegates,skips the resume prompt, and returns the session to idle so Continue is not`AGENT_BUSY` (D352).-**Resumable delegations (ADR 0276).** `Task` accepts an optional `resume`+**Resumable delegations (ADR 0279).** `Task` accepts an optional `resume`parameter carrying the `delegationId` of a settled delegation in the sameconversation. The resumed delegate is a new `SubagentRun` seeded with thechain's prior messages — the original `task` brief plus every row the chain@@ -785,26 +785,35 @@ event type, storage schema, or tool parameter is introduced.A chain is the sequence of `Task` calls that share one delegate session: thefirst call, plus every later call that passed the earlier `delegationId` as`resume`. The runtime rebuilds the chain index from the persisted transcript at-launch — each `Task` row carries its own `delegationId` in `toolResult.details`-and the resumed id in `toolArgs.resume` — so resumability survives a sidecar-restart. Chain identity (`delegateSessionId`) stays internal; the parent only+launch — each `Task` row carries its own `delegationId` and settled status in+`toolResult.details` and the resumed id in `toolArgs.resume`, with the agent+name normalized on rebuild — so resumability survives a sidecar restart.+Chain identity (`delegateSessionId`) stays internal; the parent onlyever passes a `delegationId`, and the reverse map resolves it.-Only `completed` and `failed` chains are resumable; `stopped` and `aborted`-runs are terminal and revive only by starting a new delegation. A chain whose-read-only tool output exceeds `MAX_RESUMABLE_READ_LINES` (50000) leaves the-reusable list without an in-chain trim, so a resume never silently drops-history. The registry keeps at most `MAX_RESUMABLE_CHAINS_PER_AGENT` (2) chains-per definition name, evicting least-recently-active ones.+Only `completed` and `failed` chains are resumable; `stopped` and `aborted` runs+are terminal and revive only by starting a new delegation, and a run the app+closed while it still worked rebuilds as `interrupted`, which is not resumable+either. A chain whose read-only tool output exceeds `MAX_RESUMABLE_READ_LINES`+(50000) leaves the reusable list without an in-chain trim, so a resume never+silently drops history. The registry keeps at most+`MAX_RESUMABLE_CHAINS_PER_AGENT` (2) reusable chains per definition name and+evicts least-recently-active ones whenever a delegation settles; a chain that is+still working is never evicted, so the bound counts reusable chains and a live+chain may sit above it until it settles.Resume is strictly same-session and never queues: resuming a runningdelegation is a tool error telling the parent to converge with `TaskWait`first, and a chain has at most one live record at a time. `model` and `resume`-together are rejected — a resumed run keeps the chain's model, and changing-models means starting a new delegation. An unknown id, an id belonging to-another definition, a non-resumable status, and an over-budget chain each-return a tool error naming the reason and, for an unknown id, the reusable ids-when there are any.+together are rejected, and a resumed run keeps the chain's recorded binding:+the `providerId/modelId` key it resolved is preferred, a chain rebuilt from the+transcript is matched by model id, and when nothing resolves it the run+continues on the definition's current binding and records the previous model id+as `modelChangedFrom` in its lifecycle details. Changing models on purpose means+starting a new delegation. An unknown id, an id belonging to another definition,+a non-resumable status, an over-budget chain, and a chain whose rows are gone+each return a tool error naming the reason and, for an unknown id, the reusable+ids when there are any.The parent discovers reusable chains through the system prompt, which listseach chain's latest `delegationId`, its objective, and up todiff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex 1d686dc18..3bd2dabfa 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -7478,7 +7478,7 @@ identify the platform validation still needed.| B / F / Security — Provider copy | E2E-PROVIDER-copy-config-without-credentials || A — App startup | E2E-001, E2E-002, E2E-003, E2E-004, E2E-067, E2E-076, E2E-079, E2E-092, E2E-097, E2E-143, E2E-150, E2E-168, E2E-204 || B — Model config | E2E-005, E2E-006, E2E-007, E2E-038, E2E-050, E2E-052, E2E-055, E2E-066, E2E-080, E2E-082, E2E-102c, E2E-102d, E2E-102e, E2E-151, E2E-154, E2E-163, E2E-166, E2E-172, E2E-174, E2E-197, E2E-005G, E2E-005J, E2E-199, E2E-201, E2E-202, E2E-203, E2E-205, E2E-206, E2E-209 |-| C — Conversation & stream | E2E-008, E2E-008d, E2E-008a, E2E-009, E2E-010, E2E-011, E2E-011a, E2E-011b, E2E-011d, E2E-011e, E2E-011g, E2E-031, E2E-040, E2E-047, E2E-048, E2E-048A, E2E-049, E2E-052, E2E-053, E2E-054, E2E-055, E2E-059, E2E-059a, E2E-060c, E2E-060d, E2E-061, E2E-061a, E2E-062, E2E-064, E2E-065, E2E-068, E2E-071, E2E-073, E2E-074, E2E-075, E2E-081, E2E-083, E2E-084, E2E-086, E2E-087, E2E-088, E2E-088b, E2E-089, E2E-090, E2E-094, E2E-095, E2E-096, E2E-097, E2E-098, E2E-099, E2E-102, E2E-102a, E2E-102b, E2E-102c, E2E-102d, E2E-102g, E2E-106, E2E-109, E2E-111, E2E-114, E2E-116, E2E-117, E2E-118, E2E-119, E2E-120, E2E-121, E2E-218, E2E-219, E2E-AGENTS-001, E2E-142, E2E-144, E2E-145, E2E-146, E2E-146a, E2E-147, E2E-151, E2E-154, E2E-155, E2E-158, E2E-159, E2E-161, E2E-162, E2E-166, E2E-172, E2E-173, E2E-174, E2E-177, E2E-178, E2E-179, E2E-180, E2E-182, E2E-183, E2E-187, E2E-198, E2E-199, E2E-202, E2E-203, E2E-207, E2E-208, E2E-CHAT-content-width-handles, E2E-250, E2E-102i, E2E-PLUGIN-session-orchestrator-real-workers, E2E-SUBAGENT-settlement-updates-before-parent-poll |+| C — Conversation & stream | E2E-008, E2E-008d, E2E-008a, E2E-009, E2E-010, E2E-011, E2E-011a, E2E-011b, E2E-011d, E2E-011e, E2E-011g, E2E-031, E2E-040, E2E-047, E2E-048, E2E-048A, E2E-049, E2E-052, E2E-053, E2E-054, E2E-055, E2E-059, E2E-059a, E2E-060c, E2E-060d, E2E-061, E2E-061a, E2E-062, E2E-064, E2E-065, E2E-068, E2E-071, E2E-073, E2E-074, E2E-075, E2E-081, E2E-083, E2E-084, E2E-086, E2E-087, E2E-088, E2E-088b, E2E-089, E2E-090, E2E-094, E2E-095, E2E-096, E2E-097, E2E-098, E2E-099, E2E-102, E2E-102a, E2E-102b, E2E-102c, E2E-102d, E2E-102g, E2E-106, E2E-109, E2E-111, E2E-114, E2E-116, E2E-117, E2E-118, E2E-119, E2E-120, E2E-121, E2E-218, E2E-219, E2E-AGENTS-001, E2E-142, E2E-144, E2E-145, E2E-146, E2E-146a, E2E-147, E2E-151, E2E-154, E2E-155, E2E-158, E2E-159, E2E-161, E2E-162, E2E-166, E2E-172, E2E-173, E2E-174, E2E-177, E2E-178, E2E-179, E2E-180, E2E-182, E2E-183, E2E-187, E2E-198, E2E-199, E2E-202, E2E-203, E2E-207, E2E-208, E2E-CHAT-content-width-handles, E2E-250, E2E-102i, E2E-PLUGIN-session-orchestrator-real-workers, E2E-SUBAGENT-settlement-updates-before-parent-poll, E2E-SUBAGENT-resume-a-settled-delegation || D — Workspace | E2E-012, E2E-013, E2E-022B, E2E-024I, E2E-047, E2E-049, E2E-057, E2E-058, E2E-060, E2E-068, E2E-075, E2E-078, E2E-153, E2E-158, E2E-182, E2E-187, E2E-252 || D — Workspace (project ordering) | E2E-253 || E — Tools & permissions | E2E-008a, E2E-014, E2E-015, E2E-016, E2E-017, E2E-018, E2E-019, E2E-024I, E2E-024K, E2E-040, E2E-049, E2E-074, E2E-093, E2E-097, E2E-099, E2E-100, E2E-101, E2E-102, E2E-102d, E2E-102e, E2E-102g, E2E-103, E2E-105, E2E-106, E2E-107, E2E-111, E2E-112, E2E-113, E2E-114, E2E-115, E2E-116, E2E-119, E2E-121, E2E-122, E2E-142, E2E-145, E2E-147, E2E-155, E2E-158, E2E-166, E2E-181, E2E-PLUGIN-imported-pi-package-skills |@@ -7487,7 +7487,7 @@ identify the platform validation still needed.| G — Plugins | E2E-022, E2E-022A, E2E-022B, E2E-022C, E2E-023, E2E-024, E2E-024B, E2E-024C, E2E-024D, E2E-024E, E2E-024W, E2E-024F, E2E-024G, E2E-024H, E2E-024I, E2E-024J, E2E-024K, E2E-024L, E2E-024M, E2E-024N, E2E-024O, E2E-024P, E2E-025, E2E-026, E2E-105, E2E-117, E2E-120, E2E-122, E2E-123, E2E-024Q, E2E-148, E2E-152, E2E-153, E2E-PLUGIN-imported-pi-package-skills, E2E-PLUGIN-import-extension-installs-dependencies, E2E-PLUGIN-import-extension-reports-missing-dependency, E2E-PLUGIN-global-shortcut-owns-only-its-own-command, E2E-PLUGIN-permission-gate-for-real-time-capabilities, E2E-PLUGIN-background-audio-and-realtime-connection, E2E-PLUGIN-fs-root-follows-the-calling-session || H — Diagnostics | E2E-027, E2E-031, E2E-034, E2E-042, E2E-096, E2E-098, E2E-104, E2E-107, E2E-108, E2E-109, E2E-110, E2E-113, E2E-115, E2E-116, E2E-118, E2E-121, E2E-146, E2E-146a, E2E-155, E2E-159, E2E-176, E2E-194, E2E-195 || Security | E2E-028, E2E-029, E2E-030, E2E-024J, E2E-024K, E2E-024M, E2E-049, E2E-068, E2E-086, E2E-102c, E2E-102d, E2E-102e, E2E-105, E2E-106, E2E-107, E2E-108, E2E-109, E2E-110, E2E-112, E2E-113, E2E-115, E2E-116, E2E-117, E2E-119, E2E-121, E2E-122, E2E-123, E2E-142, E2E-148, E2E-151, E2E-153, E2E-158, E2E-187, E2E-196c, E2E-196b, E2E-196, E2E-PLUGIN-fs-root-follows-the-calling-session |-| Quality | E2E-032, E2E-033, E2E-039, E2E-043, E2E-044, E2E-045, E2E-046, E2E-047, E2E-048, E2E-048A, E2E-049, E2E-050, E2E-053, E2E-055, E2E-056, E2E-057, E2E-058, E2E-059, E2E-060, E2E-061, E2E-062, E2E-063, E2E-064, E2E-065, E2E-066, E2E-067, E2E-068, E2E-069, E2E-070, E2E-071, E2E-072, E2E-073, E2E-074, E2E-075, E2E-076, E2E-077, E2E-078, E2E-079, E2E-080, E2E-081, E2E-082, E2E-083, E2E-084, E2E-085, E2E-086, E2E-092, E2E-093, E2E-094, E2E-095, E2E-096, E2E-097, E2E-098, E2E-099, E2E-100, E2E-101, E2E-102, E2E-102a, E2E-102b, E2E-102c, E2E-102d, E2E-102e, E2E-103, E2E-AGENTS-001, E2E-021a, E2E-024N, E2E-059a, E2E-060b, E2E-060c, E2E-061a, E2E-073a, E2E-111, E2E-114, E2E-117, E2E-118, E2E-119, E2E-120, E2E-122, E2E-123, E2E-142, E2E-143, E2E-144, E2E-145, E2E-146, E2E-147, E2E-148, E2E-150, E2E-151, E2E-153, E2E-155, E2E-158, E2E-159, E2E-160, E2E-161, E2E-162, E2E-163, E2E-168, E2E-172, E2E-173, E2E-174, E2E-011g, E2E-176, E2E-177, E2E-178, E2E-179, E2E-180, E2E-181, E2E-182, E2E-183, E2E-186, E2E-187, E2E-194, E2E-195, E2E-196a, E2E-196b, E2E-196c, E2E-198, E2E-199, E2E-200, E2E-196, E2E-201, E2E-204, E2E-202, E2E-203, E2E-205, E2E-206, E2E-207, E2E-208, E2E-209, E2E-210, E2E-218, E2E-219, E2E-250, E2E-252, E2E-102i, E2E-SUBAGENT-settlement-updates-before-parent-poll, E2E-PLUGIN-imported-pi-package-skills, E2E-PLUGIN-fs-root-follows-the-calling-session |+| Quality | E2E-032, E2E-033, E2E-039, E2E-043, E2E-044, E2E-045, E2E-046, E2E-047, E2E-048, E2E-048A, E2E-049, E2E-050, E2E-053, E2E-055, E2E-056, E2E-057, E2E-058, E2E-059, E2E-060, E2E-061, E2E-062, E2E-063, E2E-064, E2E-065, E2E-066, E2E-067, E2E-068, E2E-069, E2E-070, E2E-071, E2E-072, E2E-073, E2E-074, E2E-075, E2E-076, E2E-077, E2E-078, E2E-079, E2E-080, E2E-081, E2E-082, E2E-083, E2E-084, E2E-085, E2E-086, E2E-092, E2E-093, E2E-094, E2E-095, E2E-096, E2E-097, E2E-098, E2E-099, E2E-100, E2E-101, E2E-102, E2E-102a, E2E-102b, E2E-102c, E2E-102d, E2E-102e, E2E-103, E2E-AGENTS-001, E2E-021a, E2E-024N, E2E-059a, E2E-060b, E2E-060c, E2E-061a, E2E-073a, E2E-111, E2E-114, E2E-117, E2E-118, E2E-119, E2E-120, E2E-122, E2E-123, E2E-142, E2E-143, E2E-144, E2E-145, E2E-146, E2E-147, E2E-148, E2E-150, E2E-151, E2E-153, E2E-155, E2E-158, E2E-159, E2E-160, E2E-161, E2E-162, E2E-163, E2E-168, E2E-172, E2E-173, E2E-174, E2E-011g, E2E-176, E2E-177, E2E-178, E2E-179, E2E-180, E2E-181, E2E-182, E2E-183, E2E-186, E2E-187, E2E-194, E2E-195, E2E-196a, E2E-196b, E2E-196c, E2E-198, E2E-199, E2E-200, E2E-196, E2E-201, E2E-204, E2E-202, E2E-203, E2E-205, E2E-206, E2E-207, E2E-208, E2E-209, E2E-210, E2E-218, E2E-219, E2E-250, E2E-252, E2E-102i, E2E-SUBAGENT-settlement-updates-before-parent-poll, E2E-PLUGIN-imported-pi-package-skills, E2E-PLUGIN-fs-root-follows-the-calling-session, E2E-SUBAGENT-resume-a-settled-delegation || Quality (project ordering) | E2E-253 || C — Conversation & stream (IME slash alias) | E2E-255 || E — Tools & permissions (Skill residency) | E2E-254 |@@ -7536,7 +7536,7 @@ identify the platform validation still needed.| M2 (IME slash alias) | E2E-255 || M5 (Skill residency) | E2E-254 || M6 | E2E-104, E2E-105, E2E-106, E2E-107, E2E-108, E2E-109, E2E-110, E2E-111, E2E-112, E2E-113, E2E-114, E2E-115, E2E-116, E2E-117, E2E-118, E2E-119, E2E-120, E2E-103, E2E-172 |-| M6+ | E2E-121, E2E-122, E2E-148, E2E-150, E2E-151, E2E-154, E2E-155, E2E-158, E2E-159, E2E-160, E2E-161, E2E-162, E2E-163, E2E-166, E2E-168, E2E-173, E2E-174, E2E-176, E2E-179, E2E-196a, E2E-196b, E2E-196c, E2E-198, E2E-199, E2E-200, E2E-202, E2E-203, E2E-205, E2E-209, E2E-210, E2E-212, E2E-213, E2E-214, E2E-215, E2E-216, E2E-217, E2E-218, E2E-219, E2E-257, E2E-SUBAGENT-settlement-updates-before-parent-poll, E2E-PLUGIN-fs-root-follows-the-calling-session |+| M6+ | E2E-121, E2E-122, E2E-148, E2E-150, E2E-151, E2E-154, E2E-155, E2E-158, E2E-159, E2E-160, E2E-161, E2E-162, E2E-163, E2E-166, E2E-168, E2E-173, E2E-174, E2E-176, E2E-179, E2E-196a, E2E-196b, E2E-196c, E2E-198, E2E-199, E2E-200, E2E-202, E2E-203, E2E-205, E2E-209, E2E-210, E2E-212, E2E-213, E2E-214, E2E-215, E2E-216, E2E-217, E2E-218, E2E-219, E2E-257, E2E-SUBAGENT-settlement-updates-before-parent-poll, E2E-PLUGIN-fs-root-follows-the-calling-session, E2E-SUBAGENT-resume-a-settled-delegation || M6+ (Session Orchestrator) | E2E-PLUGIN-session-orchestrator-real-workers || M6+ (Session list responsiveness) | E2E-SESSION-list-refresh-keeps-desktop-responsive || M6+ (Independent session communication) | E2E-SESSION-independent-top-level-communication, E2E-SESSION-hover-card-model-and-links |@@ -9433,6 +9433,112 @@ This test plan spec is accepted when:- **Status**: Runtime event-order and renderer projection regressions automated;desktop journey documented. Required suites: `test:e2e`, `test:e2e:subagents`.+#### E2E-SUBAGENT-resume-a-settled-delegation++- **Preconditions**: An Agent session on a deterministic local transport that can+ complete, fail, stop, and hold a delegate open on request. Two user+ definitions, `~/.agents/subagents/scout.md` (read-only) and+ `~/.agents/subagents/fixer.md`; a workspace file `src/report.ts` whose+ conclusion is easy to locate by file and line; and a definition model binding+ that can be removed from the configuration. The parent catalog offers `Task`,+ `TaskWait`, `TaskList`, and `TaskStop`.+- **Steps**:+ 1. Delegate `scout` a brief that must end by naming one conclusion with its+ file and line number, and let it settle `completed`. Note the+ `delegationId` the Task result returns.+ 2. Send a turn that passes that id as `Task.resume` and asks for the same+ conclusion plus a second occurrence the first run never reached. Expand the+ delegation card, then inspect what the parent itself received.+ 3. Send a turn that only says "reuse what the scout already found", with no+ `resume` value.+ 4. Start a long-running `scout` delegation and call `Task.resume` for it while+ it works; then, while a resumed run of another chain is still working, call+ `Task.resume` for that chain again.+ 5. `TaskStop` one delegation, abort a second, and close the app while a third+ is still working. After relaunch, call `Task.resume` for each of those three+ ids as reported by `TaskWait`.+ 6. Let a delegation fail after one successful read, then call `Task.resume`+ for it.+ 7. Send one `Task` call that carries both `resume` and `model`.+ 8. Remove the chain's recorded model from the configuration, then `Task.resume`+ the chain and read its delegation lifecycle details and card.+ 9. Settle two `scout` chains, `resume` the older one, settle a third chain for+ the same definition, and read the reusable list the next prompt offers; then+ keep one chain running while two others settle for that definition.+ 10. Accumulate more than 50,000 lines of read-only tool output in one chain,+ then call `Task.resume` with its id.+ 11. Resume a `scout` chain while spelling `Task.agent` as `Explorer`, then as+ `explorer.md`, then as another definition's name.+ 12. Let one chain read more than eight files and send two further prompts in+ the same session, comparing the reusable list each prompt composes.+ 13. Relaunch the app and, without changing anything else, `Task.resume` a+ `completed` chain from before the restart.+ 14. From a fixture session that resolves a chain but no longer holds any of its+ delegate rows, call `Task.resume` with that id.+- **Expected**:+ - Step 2 resumes from the chain: the new run answers with the earlier+ conclusion's exact file and line, and its rows contain no fresh full read of+ that file. `Task` returns a new `delegationId`, and the parent's own context+ still holds one final report for that delegation and no delegate tool rows.+ - Step 3 is a cold start: a brand-new delegate with no earlier conclusion in+ its rows, a fresh `delegationId`, and no link to the earlier chain. Leaving+ the id out never inherits context, whatever the prompt says.+ - Step 4 fails twice as tool errors. The running delegation is reported as+ still running, with the instruction to converge through `TaskWait` first;+ nothing is started, nothing is queued, and the running delegate keeps+ working.+ - Step 5 refuses `stopped`, `aborted`, and the run the app closed while it was+ still working (which reads as `interrupted` after relaunch) as not+ resumable, each naming that reason and the fresh-delegation path instead. No+ run starts.+ - Step 6 resumes the failed chain like a completed one: the reads it already+ made seed the new run, and its failed assistant row is not replayed.+ - Step 7 is refused as a tool error: a resumed run keeps the chain's model, and+ the message points at starting a new delegation to change models.+ - Step 8 still resumes, on the binding the definition resolves to now, and the+ delegation's lifecycle details carry the previous model id as+ `modelChangedFrom`. The parent sees it through the lifecycle snapshot it+ polls and the card shows it with the run, so the switch is never silent.+ - Step 9 keeps at most two reusable chains per definition: the least recently+ active settled chain is evicted whole, so every id on it answers as an+ unknown delegation with the current reusable list, while a chain whose latest+ run is still working is never evicted — the group may sit over the bound+ rather than strand a live delegate.+ - Step 10 drops the over-budget chain from the reusable list without trimming+ its history: no later prompt offers it and a `resume` for it is refused as+ having read too much to resume cheaply, while an ordinary delegation for the+ same work still succeeds from cold.+ - Step 11 matches the definition name case-insensitively and with the document+ suffix — `Explorer` and `explorer.md` both resume the chain — while a+ different definition's name is a name mismatch that lists the agents that do+ have reusable chains.+ - Step 12 offers each chain's latest `delegationId`, its objective, and at most+ eight of the files it read, with a `(+N more)` suffix past that. A chain that+ just settled is already there in the same session, with no app restart and no+ new session; running, non-resumable, over-budget, and evicted chains never+ appear.+ - Step 13 rebuilds the chain relationship from the transcript, so the+ `completed` chain is offered again after relaunch and resumes as before.+ - Step 14 fails as having no recorded history, and that same id is not listed+ among the reusable ids in the error or in any later prompt: the chain leaves+ the reusable list.+ - Throughout, the transcript shows the chain as one continuous multi-turn+ conversation under its newest Task card, with no "resumed" marker, and the+ resumed run's counters start at 0 so its turn, tool, and usage numbers+ describe the new run while the earlier rounds stay readable above it.+- **Specs linked**: `03-runtime/02-agent-runtime.md` §5f, ADR 0279+- **Acceptance**: C (conversation), Quality+- **Milestone**: M6++- **Not covered (二期)**: reviving a `stopped`/`aborted` delegation, in-chain+ compaction, task queuing, and cross-session resumption.+- **Status**: Draft — chain resolution, resume validation, the reusable list, and+ transcript chain grouping are unit/regression covered+ (`packages/agent-runtime/src/delegation-chain.test.ts`,+ `delegation-history.test.ts`, `runtime.test.ts`,+ `apps/desktop/test/assistant-turns.test.mjs`); the desktop journey needs a+ capable environment. Required suites: `test:e2e`, `test:e2e:subagents`,+ `test:e2e:transcript`.+#### E2E-161: A delegation lifecycle row reads as a subagent row- **Preconditions**: A project-bound Agent session with a mocked provider streamdiff --git a/docs/zh-CN/adr/index.md b/docs/zh-CN/adr/index.mdindex 7e4a293fa..cf4e26076 100644--- a/docs/zh-CN/adr/index.md+++ b/docs/zh-CN/adr/index.md@@ -288,6 +288,7 @@ ADR 记录那些不应被静默改变的架构选择。中文入口与英文索| 0272 | [按请求实际会走的线路判定公网地址](/adr/0272-connection-time-public-network-route) | 已接受待实现(修订 ADR 0243;issue #419 / PR #473) || 0276 | [官方插件渠道与备份渠道](/adr/0276-official-plugin-channel-and-backup-channels) | 已接受待实现(修订 ADR 0102;D442) || 0278 | [规范应用 ID `net.aiuo.pi-desktop`](/adr/0278-canonical-application-id) | 已接受(D443;修订 D141 / D371 / ADR 0204;issue #524) |+| 0279 | [可恢复的子代理委托](/adr/0279-resumable-subagent-delegations) | 已接受待实现(修订 ADR 0062;ADR 0089;issue #513) |## 什么时候看 ADRdiff --git a/docs/zh-CN/spec/03-runtime/02-agent-runtime.md b/docs/zh-CN/spec/03-runtime/02-agent-runtime.mdindex 52ffe9104..e53e3e8f1 100644--- a/docs/zh-CN/spec/03-runtime/02-agent-runtime.md+++ b/docs/zh-CN/spec/03-runtime/02-agent-runtime.md@@ -602,6 +602,45 @@ Stop / 运行时销毁。主 Agent 用 `TaskStop` 判断要不要取消;运行父级终态错误还会中止残留委托、跳过续跑提示,并把会话恢复为空闲,这样“继续”不会变成 `AGENT_BUSY`(D352)。+**可恢复的委托(ADR 0279)。** `Task` 接受一个可选的 `resume` 参数,携带同一会话中+某个已结算委托的 `delegationId`。恢复后的委托是一个新的 `SubagentRun`,以该链此前的+消息为种子 —— 最初的 `task` 简述,加上这条链产出的每一行 —— 然后再以新的 `task`+提示它,于是一个已经读过或改过某个文件的委托会从那份上下文继续,而不是从零开始。+种子完全由 transcript 支撑:链的行恰好是那些 `parentToolCallId` 属于该链某个 `Task`+调用的行,它们用委托自己的绑定(固定的委托模型未必是会话模型)转换成 provider 消息。+不保活任何内存对象,也不引入新的事件类型、存储 schema 或工具参数。++一条链是共享同一个委托会话的那些 `Task` 调用的序列:第一次调用,加上此后每一个把更早+的 `delegationId` 当作 `resume` 传入的调用。运行时在启动时从持久化的 transcript 重建+链索引 —— 每个 `Task` 行都在 `toolResult.details` 里带着自己的 `delegationId` 与结算+状态、在 `toolArgs.resume` 里带着被恢复的 id,并在重建时归一化 agent 名 —— 因此可恢复性+能挺过一次 sidecar 重启。链的身份(`delegateSessionId`)始终留在内部;父级只会传+`delegationId`,由反向映射解析它。++只有 `completed` 与 `failed` 的链可恢复;`stopped` 和 `aborted` 的运行是终态,只能靠+新建委托重来;而应用在它还在工作时被关掉的那种运行会重建成 `interrupted`,同样不可+恢复。只读工具输出超过 `MAX_RESUMABLE_READ_LINES`(50000)的链会从可复用清单里消失,+且不做链内裁剪,因此恢复绝不会悄悄丢掉历史。注册表按定义名最多保留+`MAX_RESUMABLE_CHAINS_PER_AGENT`(2)条可复用链,并在每次委托结算时淘汰最久未活动的+那些;仍在工作的链永不淘汰,所以这个上限只算可复用链,活跃链可以让它暂时超出。++恢复严格限定在同一会话内,且从不排队:对正在运行的委托做恢复是一个工具错误,提示父级+先用 `TaskWait` 收敛;一条链在任何时刻最多只有一条活跃记录。`model` 与 `resume` 同时+给出会被拒绝,而恢复后的运行会沿用该链记录的绑定:优先使用链解析出的+`providerId/modelId` 键,从 transcript 重建的链则按模型 id 匹配;当什么都匹配不上时,+运行会继续使用定义当前的绑定,并把先前的模型 id 记进它生命周期 details 的+`modelChangedFrom`。有意换模型意味着新建一个委托。未知 id、属于另一个定义的 id、+不可恢复的状态、超出读预算的链,以及行已经不在的链,各自返回一个说明原因的工具错误;+对未知 id,还会一并列出当前可复用的 id。++父级通过系统提示发现可复用的链:那里列出每条链最新的 `delegationId`、它的目标,以及它+读过的文件最多 `MAX_RESUMABLE_LISTED_FILES`(8)个(超出部分带 `(+N more)` 后缀)。+清单会在委托结算时围绕既有的提示段落重新组装。对 `MAX_SUBAGENT_CONCURRENCY`、+`TaskWait`、`TaskList`、`TaskStop` 以及生命周期快照而言,恢复来的运行就是一个普通+委托。`Task` 的立即返回结果与生命周期 details 会增加 `resumedFrom` 以便追溯;+transcript 把一条链渲染成它最新 `Task` 卡片下的一段连续多轮对话,不带单独的+“已恢复”标记。+**模型引脚。** Frontmatter 中的 `model: <provider>/<model>` 在每次启动时于Electron main 里解析一次——凭据与 models.dev 快照都在那里——匹配提供商 id、厂商键或显示名称,且最多 `MAX_SUBAGENT_PROVIDERS`(8)个不同的提供商。无法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 aded241aa..6995eaf70 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@@ -4190,6 +4190,78 @@ IPC 请求无法关闭。- **状态**:草稿——单元测试覆盖在 `packages/shared`、`packages/agent-runtime`以及 host-core 的 `user_subagents` 回归测试中;完整的 UI 旅程需要具备条件的环境。+#### E2E-SUBAGENT-resume-a-settled-delegation++- **先决条件**:一个使用确定性本地传输的 Agent 会话,可以按需让委派完成、失败、被停止,或保持+ 运行。两份用户定义:`~/.agents/subagents/scout.md`(只读)与+ `~/.agents/subagents/fixer.md`;工作区文件 `src/report.ts`,其结论容易按文件与行号定位;以及+ 一个可以从当前配置中移除的模型绑定。父级目录提供 `Task`、`TaskWait`、`TaskList` 和+ `TaskStop`。+- **步骤**:+ 1. 把一份「结束时必须给出一个结论及其文件与行号」的任务委派给 `scout`,让它以 `completed`+ 结束。记下 Task 结果返回的 `delegationId`。+ 2. 发送一轮,把该 id 作为 `Task.resume` 传入,要求复述同一个结论,并找出第一次运行没有触及的+ 第二次出现。展开委派卡片,再检查父级自己收到的内容。+ 3. 发送一轮,只说「复用一下 scout 已经找到的东西」,不传 `resume`。+ 4. 启动一个长时间运行的 `scout` 委派,在它仍在运行时对它调用 `Task.resume`;然后,在另一条链+ 恢复后的运行仍未结束时,对该链再次调用 `Task.resume`。+ 5. 用 `TaskStop` 停止一个委派,终止第二个,并在第三个仍在工作时关闭应用。重启后,按+ `TaskWait` 报告的 id 对这三个逐个调用 `Task.resume`。+ 6. 让一个委派在成功读取一次后失败,然后对它调用 `Task.resume`。+ 7. 发送一次同时携带 `resume` 与 `model` 的 `Task` 调用。+ 8. 把该链记录的模型从当前配置中移除,然后 `Task.resume` 该链,并查看它的委派生命周期 details+ 与卡片。+ 9. 让 `scout` 的两条链先后结束,`resume` 较早的那条,再让同一定义的第三条链结束,读取下一次+ 提示给出的可复用清单;随后让一条链保持运行,同时同一定义另有两条链结束。+ 10. 让一条链累计超过 5 万行只读工具输出,然后用它的 id 调用 `Task.resume`。+ 11. 分别以 `Explorer`、`explorer.md`、另一个定义的名称作为 `Task.agent`,恢复一条 `scout` 链。+ 12. 让一条链读过超过八个文件,并在同一会话内再发两次提示,比较每次提示编排出的可复用清单。+ 13. 重启应用,在不改动其它任何设置的情况下 `Task.resume` 重启前那条 `completed` 的链。+ 14. 在一个能解析某条链、但已不再持有该链任何委派行的固定装置会话中,用该 id 调用+ `Task.resume`。+- **预期**:+ - 步骤 2 从该链继续:新的运行给出先前结论的确切文件与行号,且它的行里没有对那个文件的重新+ 整读。`Task` 返回一个新的 `delegationId`,而父级自身上下文里仍然只有该委派的一份最终报告,+ 也没有委派工具行。+ - 步骤 3 是冷启动:一个全新的委派,行里没有先前的结论,持有新的 `delegationId`,且与先前的链+ 没有关联。不传 id 就绝不继承上下文,无论提示怎么写。+ - 步骤 4 两次都以工具错误失败。仍在运行的委派被报告为仍在运行,并提示先用 `TaskWait` 收敛;+ 不会启动任何东西,也不会排队,运行中的委派继续工作。+ - 步骤 5 把 `stopped`、`aborted`,以及应用在它仍在工作时被关掉的运行(重启后读作+ `interrupted`)一律拒绝为不可恢复,各自说明该原因并指向新建委派;没有任何运行被启动。+ - 步骤 6 像 `completed` 一样恢复失败的链:它已经做出的读取成为新运行的种子,而它失败的助手行+ 不会被重放。+ - 步骤 7 以工具错误拒绝:恢复后的运行沿用链的模型,错误信息指向「换模型要新建委派」。+ - 步骤 8 仍然可以恢复,走定义现在解析到的绑定,并且该委派的生命周期 details 带上先前模型的 id+ 作为 `modelChangedFrom`。父级通过它轮询的生命周期快照看到它,卡片也随该运行显示它,因此这次+ 切换不是静默的。+ - 步骤 9 每个定义最多保留两条可复用链:最久未活动的已结束链被整条淘汰,因此它的每个 id 都按+ 未知委派作答并附上当前可复用清单;而最新运行仍在工作的链永不被淘汰——该组可以暂时超出上限,+ 也不会让一个仍在运行的委派搁浅。+ - 步骤 10 让超出读取预算的链静默离开可复用清单,且不裁剪它的历史:之后任何提示都不再提供它,+ 对它的 `resume` 被拒绝为「读取太多、恢复不划算」,而对同一件工作的一次普通委派仍然能从冷启动+ 成功。+ - 步骤 11 定义名不区分大小写并接受文档后缀——`Explorer` 与 `explorer.md` 都能恢复该链——而+ 另一个定义的名称会被判为名称不匹配,并列出确实拥有可复用链的智能体。+ - 步骤 12 每条链列出最新的 `delegationId`、它的目标,以及它读过的文件中的最多八个,超出部分带+ `(+N more)` 后缀。刚刚结束的链在同一会话里就已经在清单里,不需要重启应用,也不需要新会话;+ 运行中、不可恢复、超出预算以及已被淘汰的链从不出现。+ - 步骤 13 从转录重建链关系,因此那条 `completed` 的链在重启后又被提供,并且像之前一样可以恢复。+ - 步骤 14 以「没有可重放的历史记录」失败,且同一个 id 不会出现在错误的可用列表里,也不会出现+ 在任何后续提示里:该链从可复用清单中移除。+ - 全程中,转录把该链显示为最新 Task 卡片下的一段连续多轮对话,没有任何「已恢复」标记;恢复后的+ 运行计数器从 0 开始,因此它的轮次、工具与用量数字描述的是新的运行,而更早的轮次仍可读地留在+ 上方。+- **链接规格**:`03-runtime/02-agent-runtime.md` §5f、ADR 0279+- **验收**:C(对话)、品质+- **里程碑**:M6++- **不覆盖(二期)**:唤醒被 `stopped`/`aborted` 的委派、链内压缩、任务排队,以及跨会话恢复。+- **状态**:草稿——链解析、恢复校验、可复用清单与转录链分组已有单元/回归覆盖+ (`packages/agent-runtime/src/delegation-chain.test.ts`、+ `delegation-history.test.ts`、`runtime.test.ts`、+ `apps/desktop/test/assistant-turns.test.mjs`);桌面旅程需要具备条件的环境。必需套件:+ `test:e2e`、`test:e2e:subagents`、`test:e2e:transcript`。+#### E2E-145:工具结果读取为结构化块,从不 JSON- **先决条件**:项目绑定的 Agent 会话,具有允许的权限@@ -4942,7 +5014,7 @@ IPC 请求无法关闭。| B / F / Security — 提供商复制 | E2E-PROVIDER-copy-config-without-credentials || A — 应用程序启动 | E2E-001、E2E-002、E2E-003、E2E-004、E2E-067、E2E-076、E2E-079、E2E-092、E2E-097、E2E-143、E2E-150、E2E-168、E2E-204、E2E-217 || B——模型配置 | E2E-005、E2E-005G、E2E-006、E2E-007、E2E-038、E2E-050、E2E-052、E2E-055、E2E-066、E2E-080、E2E-082、E2E-151、E2E-005J、E2E-199、E2E-201、E2E-202、E2E-203、E2E-209、E2E-166 |-| C — 对话和直播 | E2E-008、E2E-008d、E2E-008a、E2E-009、E2E-010、E2E-011、E2E-011a、E2E-011b、E2E-031、E2E-040、E2E-047、E2E-048、E2E-048A、E2E-049、E2E-052、 E2E-053、E2E-054、E2E-055、E2E-059、E2E-059a、E2E-060c、E2E-060d、E2E-061、E2E-061a、E2E-062、E2E-064、E2E-065、E2E-068、E2E-071、 E2E-073、E2E-074、E2E-075、E2E-081、E2E-083、E2E-084、E2E-086、E2E-087、E2E-088、E2E-088b、E2E-089、E2E-090、E2E-094、E2E-095、E2E-096、 E2E-097、E2E-098、E2E-099、E2E-102、E2E-102a、E2E-102b、E2E-106、E2E-109、E2E-111、E2E-114、E2E-116、E2E-117、E2E-118、E2E-119、 E2E-120、E2E-121、E2E-代理-001、E2E-142、E2E-144、E2E-145、E2E-146、E2E-147、E2E-151、E2E-199、E2E-250、E2E-166 |+| C — 对话和直播 | E2E-008、E2E-008d、E2E-008a、E2E-009、E2E-010、E2E-011、E2E-011a、E2E-011b、E2E-031、E2E-040、E2E-047、E2E-048、E2E-048A、E2E-049、E2E-052、 E2E-053、E2E-054、E2E-055、E2E-059、E2E-059a、E2E-060c、E2E-060d、E2E-061、E2E-061a、E2E-062、E2E-064、E2E-065、E2E-068、E2E-071、 E2E-073、E2E-074、E2E-075、E2E-081、E2E-083、E2E-084、E2E-086、E2E-087、E2E-088、E2E-088b、E2E-089、E2E-090、E2E-094、E2E-095、E2E-096、 E2E-097、E2E-098、E2E-099、E2E-102、E2E-102a、E2E-102b、E2E-106、E2E-109、E2E-111、E2E-114、E2E-116、E2E-117、E2E-118、E2E-119、 E2E-120、E2E-121、E2E-代理-001、E2E-142、E2E-144、E2E-145、E2E-146、E2E-147、E2E-151、E2E-199、E2E-250、E2E-166、E2E-SUBAGENT-resume-a-settled-delegation || D——工作区 | E2E-012、E2E-013、E2E-022B、E2E-024I、E2E-047、E2E-049、E2E-057、E2E-058、E2E-060、E2E-068、E2E-075、E2E-078、E2E-153 || D——工作区(项目排序) | E2E-253 || E——工具和权限 | E2E-008a、E2E-014、E2E-015、E2E-016、E2E-017、E2E-018、E2E-019、E2E-024I、E2E-024K、E2E-040、E2E-049、E2E-074、E2E-093、E2E-097、 E2E-099、E2E-100、E2E-101、E2E-102、E2E-103、E2E-105、E2E-106、E2E-107、E2E-111、E2E-112、E2E-113、E2E-114、E2E-115、E2E-116、 E2E-119、E2E-121、E2E-122、E2E-123、E2E-142、E2E-145、E2E-147、E2E-PLUGIN-imported-pi-package-skills、E2E-166 |@@ -4951,7 +5023,7 @@ IPC 请求无法关闭。| G——插件 | E2E-022、E2E-022A、E2E-022B、E2E-022C、E2E-023、E2E-024、E2E-024B、E2E-024C、E2E-024D、E2E-024E、E2E-024W、E2E-024F、E2E-024G、E2E-024H、 E2E-024I、E2E-024J、E2E-024K、E2E-024L、E2E-024M、E2E-024N、E2E-024O、E2E-024P、E2E-025、E2E-026、E2E-105、E2E-117、E2E-120、E2E-122、E2E-123、E2E-148、E2E-153、E2E-PLUGIN-imported-pi-package-skills、E2E-PLUGIN-import-extension-installs-dependencies、E2E-PLUGIN-import-extension-reports-missing-dependency、E2E-PLUGIN-global-shortcut-owns-only-its-own-command、E2E-PLUGIN-permission-gate-for-real-time-capabilities、E2E-PLUGIN-background-audio-and-realtime-connection || H——诊断 | E2E-027、E2E-031、E2E-034、E2E-042、E2E-096、E2E-098、E2E-104、E2E-107、E2E-108、E2E-109、E2E-110、E2E-113、E2E-115、E2E-116、 E2E-118、E2E-121、E2E-146、E2E-194、E2E-195 || 安全性 | E2E-028、E2E-029、E2E-030、E2E-024J、E2E-024K、E2E-024M、E2E-049、E2E-068、E2E-086、E2E-105、E2E-106、E2E-107、E2E-108、E2E-109、 E2E-110、E2E-112、E2E-113、E2E-115、E2E-116、E2E-117、E2E-119、E2E-121、E2E-122、E2E-123、E2E-142、E2E-148、E2E-151、E2E-153 |-| 品质 | E2E-032、E2E-033、E2E-039、E2E-043、E2E-044、E2E-045、E2E-046、E2E-047、E2E-048、E2E-048A、E2E-049、E2E-050、E2E-053、E2E-055、 E2E-056、E2E-057、E2E-058、E2E-059、E2E-060、E2E-061、E2E-062、E2E-063、E2E-064、E2E-065、E2E-066、E2E-067、E2E-068、E2E-069、 E2E-070、E2E-071、E2E-072、E2E-073、E2E-074、E2E-075、E2E-076、E2E-077、E2E-078、E2E-079、E2E-080、E2E-081、E2E-082、E2E-083、 E2E-084、E2E-085、E2E-086、E2E-092、E2E-093、E2E-094、E2E-095、E2E-096、E2E-097、E2E-098、E2E-099、E2E-100、E2E-101、E2E-102、 E2E-102a、E2E-102b、E2E-103、E2E-AGENTS-001、E2E-024N、E2E-024O、E2E-059a、E2E-060b、E2E-060c、E2E-060d、E2E-061a、E2E-073a、E2E-111、 E2E-114、E2E-117、E2E-118、E2E-119、E2E-120、E2E-122、E2E-123、E2E-142、E2E-143、E2E-144、E2E-145、E2E-146、E2E-147、E2E-148、E2E-150、E2E-151、E2E-153、E2E-194、E2E-195、E2E-199、E2E-200、E2E-201、E2E-202、E2E-203、E2E-204、E2E-209、E2E-210、E2E-250、E2E-PLUGIN-imported-pi-package-skills |+| 品质 | E2E-032、E2E-033、E2E-039、E2E-043、E2E-044、E2E-045、E2E-046、E2E-047、E2E-048、E2E-048A、E2E-049、E2E-050、E2E-053、E2E-055、 E2E-056、E2E-057、E2E-058、E2E-059、E2E-060、E2E-061、E2E-062、E2E-063、E2E-064、E2E-065、E2E-066、E2E-067、E2E-068、E2E-069、 E2E-070、E2E-071、E2E-072、E2E-073、E2E-074、E2E-075、E2E-076、E2E-077、E2E-078、E2E-079、E2E-080、E2E-081、E2E-082、E2E-083、 E2E-084、E2E-085、E2E-086、E2E-092、E2E-093、E2E-094、E2E-095、E2E-096、E2E-097、E2E-098、E2E-099、E2E-100、E2E-101、E2E-102、 E2E-102a、E2E-102b、E2E-103、E2E-AGENTS-001、E2E-024N、E2E-024O、E2E-059a、E2E-060b、E2E-060c、E2E-060d、E2E-061a、E2E-073a、E2E-111、 E2E-114、E2E-117、E2E-118、E2E-119、E2E-120、E2E-122、E2E-123、E2E-142、E2E-143、E2E-144、E2E-145、E2E-146、E2E-147、E2E-148、E2E-150、E2E-151、E2E-153、E2E-194、E2E-195、E2E-199、E2E-200、E2E-201、E2E-202、E2E-203、E2E-204、E2E-209、E2E-210、E2E-250、E2E-PLUGIN-imported-pi-package-skills、E2E-SUBAGENT-resume-a-settled-delegation || 品质(项目排序) | E2E-253 || C — 对话和直播(输入法斜杠别名) | E2E-255 || E——工具和权限(Skill 常驻) | E2E-254 |@@ -5000,7 +5072,7 @@ IPC 请求无法关闭。| M2(输入法斜杠别名) | E2E-255 || M5(Skill 常驻) | E2E-254 || M6 | E2E-104、E2E-105、E2E-106、E2E-107、E2E-108、E2E-109、E2E-110、E2E-111、E2E-112、E2E-113、E2E-114、E2E-115、E2E-116、E2E-117、 E2E-118、E2E-119、E2E-120、E2E-103 |-| M6+ | E2E-121、E2E-122、E2E-123、E2E-142、E2E-148、E2E-150、E2E-151、E2E-168、E2E-199、E2E-200、E2E-202、E2E-203、E2E-209、E2E-211、E2E-212、E2E-213、E2E-214、E2E-215、E2E-216、E2E-217、E2E-257、E2E-166 |+| M6+ | E2E-121、E2E-122、E2E-123、E2E-142、E2E-148、E2E-150、E2E-151、E2E-168、E2E-199、E2E-200、E2E-202、E2E-203、E2E-209、E2E-211、E2E-212、E2E-213、E2E-214、E2E-215、E2E-216、E2E-217、E2E-257、E2E-166、E2E-SUBAGENT-resume-a-settled-delegation || M6+(Session Orchestrator) | E2E-PLUGIN-session-orchestrator-real-workers || M6+(会话列表响应性) | E2E-SESSION-list-refresh-keeps-desktop-responsive || M6+(独立会话通信) | E2E-SESSION-independent-top-level-communication、E2E-SESSION-hover-card-model-and-links |diff --git a/packages/agent-runtime/src/delegation-chain.test.ts b/packages/agent-runtime/src/delegation-chain.test.tsindex fcbf2041c..66634e54d 100644--- a/packages/agent-runtime/src/delegation-chain.test.ts+++ b/packages/agent-runtime/src/delegation-chain.test.ts@@ -438,7 +438,7 @@ describe("resume error messages", () => {it("never advertises the dropped id as reusable", () => {const registry = registryWithChain();- // The caller drops the chain before composing the message (ADR 0278 §4),+ // The caller drops the chain before composing the message (ADR 0279 §4),// so the id it names must not come back as its own suggestion.registry.drop("res-b");const list = registry.resumableList({ runningDelegationIds: NONE });diff --git a/packages/agent-runtime/src/delegation-chain.ts b/packages/agent-runtime/src/delegation-chain.tsindex 566e28b09..3c21f47ea 100644--- a/packages/agent-runtime/src/delegation-chain.ts+++ b/packages/agent-runtime/src/delegation-chain.ts@@ -1,5 +1,5 @@/**- * In-memory chain registry for resumable delegations (ADR 0278).+ * In-memory chain registry for resumable delegations (ADR 0279).** The registry is rebuilt from the session transcript at launch, then updated* as `Task` calls settle. It never appears in a tool parameter: the parent@@ -217,7 +217,7 @@ export class DelegationChainRegistry {* A chain resolved but has nothing left to replay: its rows are gone from the* transcript (a truncated branch, or a delegation that died before writing* any). The caller drops the chain first, so the id in the error can never- * also appear in its own "reusable" list (ADR 0278 §4).+ * also appear in its own "reusable" list (ADR 0279 §4).*/noHistoryResumeError(resume: string, list: readonly ResumableChain[]): string {const available = resumableSummary(list);@@ -244,7 +244,7 @@ export class DelegationChainRegistry {// A working chain is never evicted: dropping it would strand the delegate// still writing into it, and the bound counts reusable chains anyway. Any// overflow those chains caused is resolved the moment they settle,- // because `settle` runs this again (ADR 0278 §7).+ // because `settle` runs this again (ADR 0279 §7).const settled = group.filter((chain) => chain.latestStatus !== "running").sort((left, right) => right.lastActivityAt - left.lastActivityAt);diff --git a/packages/agent-runtime/src/delegation-history.test.ts b/packages/agent-runtime/src/delegation-history.test.tsindex a216b7949..998ee79c1 100644--- a/packages/agent-runtime/src/delegation-history.test.ts+++ b/packages/agent-runtime/src/delegation-history.test.ts@@ -470,7 +470,7 @@ function resolveRebuilt(});}-describe("rebuildChainsFromTranscript restart status (ADR 0278)", () => {+describe("rebuildChainsFromTranscript restart status (ADR 0279)", () => {it("keeps a completed or failed status a settled Task row recorded", () => {for (const status of ["completed", "failed"]) {const chains = rebuildChainsFromTranscript([@@ -546,7 +546,7 @@ describe("rebuildChainsFromTranscript restart status (ADR 0278)", () => {});});-describe("rebuildChainsFromTranscript agent normalization (ADR 0278)", () => {+describe("rebuildChainsFromTranscript agent normalization (ADR 0279)", () => {it("normalizes the recorded agent so a restarted session still selects its rows", () => {for (const recorded of ["Explorer", "explorer.md", "EXPLORER "]) {const task = restartedTaskRow(@@ -579,7 +579,7 @@ describe("rebuildChainsFromTranscript agent normalization (ADR 0278)", () => {});});-describe("rebuildChainsFromTranscript settled copies and replay (ADR 0278)", () => {+describe("rebuildChainsFromTranscript settled copies and replay (ADR 0279)", () => {it("rebuilds a Task call once and lets the settled copy win", () => {const immediate = restartedTaskRow("call-1", {delegationId: "d1",diff --git a/packages/agent-runtime/src/delegation-history.ts b/packages/agent-runtime/src/delegation-history.tsindex 90a9b6a2d..29faa37fe 100644--- a/packages/agent-runtime/src/delegation-history.ts+++ b/packages/agent-runtime/src/delegation-history.ts@@ -1,6 +1,6 @@/*** Rebuild a delegate's model context from its persisted transcript rows- * (ADR 0278).+ * (ADR 0279).** Every row a delegate emits lands in the session transcript with* `parentToolCallId` (the `Task` call that spawned it) and `agentName`. Those@@ -62,11 +62,11 @@ export type DelegationChain = {latestObjective?: string;/** Provider/model used by the latest run; resume must keep it. */latestModelId?: string;- /** `providerId/modelId` key the latest run resolved (ADR 0278 §4). */+ /** `providerId/modelId` key the latest run resolved (ADR 0279 §4). */latestModelKey?: string;/** Settled status of the latest run; `running` while it works. Owns the* resumability gate so pruning finished delegation records cannot make a- * stopped chain look reusable (ADR 0278). */+ * stopped chain look reusable (ADR 0279). */latestStatus?: string;/** Latest activity timestamp, used for LRU eviction. */lastActivityAt: number;@@ -406,7 +406,7 @@ export type RebuiltTaskCall = {status?: string;};/**- * Status a rebuilt chain carries after a restart (ADR 0278 §12). The settled+ * Status a rebuilt chain carries after a restart (ADR 0279 §12). The settled* status is the one the settlement projection wrote onto the `Task` row. A run* the app closed while it still worked never settled, and reads as* `interrupted` rather than staying open forever. A row that records no status@@ -429,7 +429,7 @@ function chainStatusFromDetail(/*** Scan persisted `Task` tool rows and group them into chains by their* `resume` links. Used at session launch so a restart does not lose- * resumability (ADR 0278 §12). Every call carries the status its own `Task`+ * resumability (ADR 0279 §12). Every call carries the status its own `Task`* row recorded, so a chain rebuilt here is resumable exactly when the live* registry would consider it resumable.*/@@ -455,7 +455,7 @@ export function rebuildChainsFromTranscript(if (!delegationId) continue;// `agentName` is compared against the definition name and against the// transcript rows' `agentName`, so it is normalized the same way the tool- // normalizes `Task.agent` (ADR 0278 §12).+ // normalizes `Task.agent` (ADR 0279 §12).const agentName = normalizeSubagentName(typeof args?.agent === "string"? args.agentdiff --git a/packages/agent-runtime/src/runtime.test.ts b/packages/agent-runtime/src/runtime.test.tsindex 11ad25b87..4a191cd3b 100644--- a/packages/agent-runtime/src/runtime.test.ts+++ b/packages/agent-runtime/src/runtime.test.ts@@ -6806,7 +6806,7 @@ describe("DesktopAgentRuntime subagents", () => {await runtime.dispose();});- describe("resume (ADR 0278)", () => {+ describe("resume (ADR 0279)", () => {/** Rows a delegate left in the transcript, tagged with its `Task` call. */function delegateRow(id: string,@@ -6903,7 +6903,7 @@ describe("DesktopAgentRuntime subagents", () => {const record = internals.delegations.get(delegationId);expect(record.resumedFrom).toBe("del-1");expect(record.delegateSessionId).toBe("del-1");- // The chain owns its calls now (ADR 0278); the id resolves to both.+ // The chain owns its calls now (ADR 0279); the id resolves to both.expect(internals.delegationChains.lookup(delegationId).toolCallIds).toEqual(["task-1","task-2",@@ -7360,7 +7360,7 @@ describe("DesktopAgentRuntime subagents", () => {expect(message).toContain('Delegation "del-1" has no recorded history');// The chain is dropped before the message is composed, so the id it- // names can never come back as its own suggestion (ADR 0278 §4).+ // names can never come back as its own suggestion (ADR 0279 §4).expect(message).not.toContain("Reusable: explorer / del-1");expect(message.split("Reusable: ")[1]).toBe("explorer / del-2.");expect(internals.delegationChains.lookup("del-1")).toBeUndefined();diff --git a/packages/agent-runtime/src/runtime.ts b/packages/agent-runtime/src/runtime.tsindex aafb70611..8e8ca661a 100644--- a/packages/agent-runtime/src/runtime.ts+++ b/packages/agent-runtime/src/runtime.ts@@ -398,11 +398,11 @@ export type DelegationRecord = {* `TaskWait` result or the resume-after-idle prompt. Auto-delivery is a* single shot per record. */reportDelivered: boolean;- /** Stable chain identity; never appears in a tool parameter (ADR 0278). */+ /** Stable chain identity; never appears in a tool parameter (ADR 0279). */delegateSessionId: string;/** Prior `delegationId` this run continues, when `Task.resume` was set. */resumedFrom?: string;- /** Model the run kept before the resume could not re-resolve it (ADR 0278+ /** Model the run kept before the resume could not re-resolve it (ADR 0279* §4): recorded so the parent can see that the delegate's binding moved. */modelChangedFrom?: string;/** `toolCallId`s of this run's calls that have not ended yet: dropped when the@@ -1471,7 +1471,7 @@ export class DesktopAgentRuntime {private delegations = new Map<string, DelegationRecord>();/** Resumable chains rebuilt from the transcript and updated as Task settles. */private readonly delegationChains = new DelegationChainRegistry();- /** Transcript rows used to rebuild a resumed delegate's context (ADR 0278):+ /** Transcript rows used to rebuild a resumed delegate's context (ADR 0279):* the seed history at launch plus every row this session's delegates emit. */private readonly transcriptHistory: UiMessage[];/** Row ids already in `transcriptHistory` from live delegate events, so a@@ -3728,7 +3728,7 @@ Delegation rules:/*** A chain resolved but has nothing to replay. The caller drops it first, so- * the id can never be advertised as reusable in its own error (ADR 0278 §4).+ * the id can never be advertised as reusable in its own error (ADR 0279 §4).*/private noHistoryResumeMessage(resume: string): string {return this.delegationChains.noHistoryResumeError(@@ -3740,7 +3740,7 @@ Delegation rules:}/**- * The binding a resumed run keeps (ADR 0278 §4). A live chain records the+ * The binding a resumed run keeps (ADR 0279 §4). A live chain records the* `providerId/modelId` key it resolved, which is preferred here; a chain* rebuilt from the transcript only knows the model id, matched against what* is configured in this session. `undefined` means the binding is gone.@@ -3981,7 +3981,7 @@ Delegation rules:return this.subagentToolError(toolCallId, resumeLookup.message);}const resumedChain = resumeLookup?.ok ? resumeLookup.chain : undefined;- // A resume keeps the chain's own binding (ADR 0278 §4): changing the+ // A resume keeps the chain's own binding (ADR 0279 §4): changing the// parent's session model must not strand a chain, and a delegate must// never swap models by accident. When the recorded binding is gone the// run continues on the definition's current one and says so in its@@ -4314,7 +4314,7 @@ Delegation rules:record.toolCalls += 1;this.touchDelegationPhase(record, "tool", event.toolName);// The row a later `resume` replays needs the call's arguments, and- // `tool_end` carries only the result (ADR 0278 §3).+ // `tool_end` carries only the result (ADR 0279 §3).this.delegateToolCalls.set(event.toolCallId, {name: event.toolName,args: (envelope.event as ToolStartEvent).args,diff --git a/packages/agent-runtime/src/subagent.ts b/packages/agent-runtime/src/subagent.tsindex 13a85c153..58247e346 100644--- a/packages/agent-runtime/src/subagent.ts+++ b/packages/agent-runtime/src/subagent.ts@@ -131,7 +131,7 @@ export type SubagentRunOptions = {) => SubagentToolOutcome | undefined;signal?: AbortSignal;/**- * Prior chain messages that seed this run (ADR 0276). Omitted for a cold+ * Prior chain messages that seed this run (ADR 0279). Omitted for a cold* start. The original `task` is still passed to `prompt()` as the new user* turn; these messages are everything that came before it.*/diff --git a/packages/shared/src/subagent-definition.ts b/packages/shared/src/subagent-definition.tsindex 664c966d5..a44d0db85 100644--- a/packages/shared/src/subagent-definition.ts+++ b/packages/shared/src/subagent-definition.ts@@ -209,10 +209,10 @@ export const MAX_SUBAGENT_PROVIDERS = 8;/** Running delegates per session, across batches (see ADR 0089). */export const MAX_SUBAGENT_CONCURRENCY = 10;/** Resumable chains kept per subagent name before the oldest is evicted- * (ADR 0276). A chain is one delegate session across any number of `resume`s. */+ * (ADR 0279). A chain is one delegate session across any number of `resume`s. */export const MAX_RESUMABLE_CHAINS_PER_AGENT = 2;/** Cumulative lines a chain's read-only tools may read before it leaves the- * resumable list and the next delegation for that work runs cold (ADR 0276). */+ * resumable list and the next delegation for that work runs cold (ADR 0279). */export const MAX_RESUMABLE_READ_LINES = 50_000;/** Files listed per chain in the parent's resumable-session prompt block. */export const MAX_RESUMABLE_LISTED_FILES = 8;