Skip to content

fix(agent): multi-agent host isolation and session lifecycle#1963

Merged
zerob13 merged 8 commits into
devfrom
fix/agent-multi-agent-isolation
Jul 14, 2026
Merged

fix(agent): multi-agent host isolation and session lifecycle#1963
zerob13 merged 8 commits into
devfrom
fix/agent-multi-agent-isolation

Conversation

@zhangmo8

@zhangmo8 zhangmo8 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Enforce per-host-agent isolation for DeepChat runtime: MCP allow-lists, cross-session workspace allow dirs, transfer permission/skill reset, and cross-agent subagent policy resolution.
  • Improve multi-agent UX and lifecycle safety: ACP tool progress no longer looks like permissions, Plugins Hub clarifies global vs agent-scoped pages, parent permission approvals inherit into subagents, and chat/session timeouts plus best-effort deletion avoid zombie sessions.
  • i18n for Plugins Hub scope banners is complete across locales with native strings (zh/en/de/fr/ja/…); pnpm run i18n clean.

Key changes

  • MCP allow-list runtime: pass enabledMcpServerIds into catalog/fingerprint/call/deferred paths
  • Workspace isolation: stop merging last-synced workdir across concurrent sessions
  • Transfer rebind: clear permissions/plan/runtime skills; refilter active skills to target policy
  • Subagent target policy: cross-agent children use target permissionMode/tools/systemPrompt/skill allow-list; keep parent workdir/model
  • Subagent approvals: clone parent session permission approvals; clearer waiting progress with child sessionId
  • ACP projection: tool progress emits reasoning only (no pseudo tool_call_permission blocks)
  • Plugins Hub: scope banner for global plugins vs current-agent Skills/MCP policy (localized for en/de/fr/ja/ko/…)
  • Chat/Session: remove fake stream lock; longer create/list timeouts; deletion continues row cleanup after partial failures

Test plan

  • pnpm run i18n — no missing/invalid keys
  • pnpm run format / pnpm run lint (incl. architecture guards)
  • Focused vitest for agent runtime, assignment policy, chatService, acpContentMapper, deletion, subagent
  • Manual: Agent A/B MCP allow-list catalog differs
  • Manual: transfer A→B resets approvals and skills
  • Manual: cross-agent subagent uses target policy
  • Manual: Plugins Hub banners in zh-CN / en-US / de-DE / fr-FR / ja-JP
  • Manual: ACP tool progress has no permission-style cards

Summary by CodeRabbit

  • New Features

    • Added clearer plugin scope messaging across supported languages.
    • Improved subagent handling with agent-specific policies, permissions, skills, and workspace behavior.
    • Added contextual progress guidance when subagent actions require attention.
  • Bug Fixes

    • Strengthened isolation between agents and concurrent sessions for MCP tools, file access, permissions, and skills.
    • Prevented unavailable tools from executing and corrected permission-retry handling.
    • ACP tool progress now appears as reasoning instead of a misleading permission prompt.
    • Session deletion and stream cancellation now continue cleanup after partial failures.
  • Documentation

    • Added architecture specifications and implementation plans for multi-agent and subagent isolation.

zhangmo8 added 5 commits July 14, 2026 10:03
Wire per-agent MCP allow-lists into catalog/call paths, stop
cross-session workspace allow-list leaks, and reset permissions
and skills when rebinding a session to another host agent.
Resolve permission mode, disabled tools, system prompt, and skill
allow-lists from the target host agent while keeping parent workdir
and model for delegated subagent sessions.
Stop ACP tool progress from looking like permissions, clarify
Plugins Hub global vs agent policy scope, inherit parent approvals
into subagents with clearer waiting guidance, and make chat/session
timeouts and deletion best-effort instead of zombie-prone.
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: af55ef06-7d37-4833-a375-884657ac33b5

📥 Commits

Reviewing files that changed from the base of the PR and between 563015c and b183f50.

📒 Files selected for processing (24)
  • src/main/presenter/index.ts
  • src/main/routes/index.ts
  • src/renderer/src/i18n/da-DK/settings.json
  • src/renderer/src/i18n/de-DE/settings.json
  • src/renderer/src/i18n/en-US/settings.json
  • src/renderer/src/i18n/es-ES/settings.json
  • src/renderer/src/i18n/fa-IR/settings.json
  • src/renderer/src/i18n/fr-FR/settings.json
  • src/renderer/src/i18n/he-IL/settings.json
  • src/renderer/src/i18n/id-ID/settings.json
  • src/renderer/src/i18n/it-IT/settings.json
  • src/renderer/src/i18n/ja-JP/settings.json
  • src/renderer/src/i18n/ko-KR/settings.json
  • src/renderer/src/i18n/ms-MY/settings.json
  • src/renderer/src/i18n/pl-PL/settings.json
  • src/renderer/src/i18n/pt-BR/settings.json
  • src/renderer/src/i18n/ru-RU/settings.json
  • src/renderer/src/i18n/tr-TR/settings.json
  • src/renderer/src/i18n/vi-VN/settings.json
  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/i18n/zh-HK/settings.json
  • src/renderer/src/i18n/zh-TW/settings.json
  • src/shared/types/presenters/core.presenter.d.ts
  • test/main/presenter/sessionApplication/sessionApplication.integration.test.ts
🚧 Files skipped from review as they are similar to previous changes (21)
  • src/shared/types/presenters/core.presenter.d.ts
  • src/main/routes/index.ts
  • src/renderer/src/i18n/he-IL/settings.json
  • src/renderer/src/i18n/es-ES/settings.json
  • src/renderer/src/i18n/ru-RU/settings.json
  • src/renderer/src/i18n/vi-VN/settings.json
  • src/renderer/src/i18n/de-DE/settings.json
  • src/renderer/src/i18n/ms-MY/settings.json
  • src/renderer/src/i18n/tr-TR/settings.json
  • src/renderer/src/i18n/zh-TW/settings.json
  • src/renderer/src/i18n/zh-HK/settings.json
  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/i18n/en-US/settings.json
  • src/renderer/src/i18n/ja-JP/settings.json
  • src/renderer/src/i18n/pt-BR/settings.json
  • src/renderer/src/i18n/fr-FR/settings.json
  • src/renderer/src/i18n/id-ID/settings.json
  • src/renderer/src/i18n/pl-PL/settings.json
  • src/main/presenter/index.ts
  • src/renderer/src/i18n/da-DK/settings.json
  • src/renderer/src/i18n/it-IT/settings.json

📝 Walkthrough

Walkthrough

The changes define agent-isolation contracts and implement MCP policy propagation, workspace isolation, session transfer resets, subagent host-policy resolution, lifecycle cleanup, ACP progress mapping, and plugin scope messaging.

Changes

Agent isolation enforcement

Layer / File(s) Summary
Isolation contracts and validation
docs/architecture/..., docs/issues/...
Documents define MCP, skill, workspace, transfer, and lifecycle isolation behavior and validation criteria.
MCP policy and tool execution
src/main/presenter/agentRuntimePresenter/..., test/main/presenter/agentRuntimePresenter/...
Resolved MCP allow-lists flow through catalog resolution, fingerprints, execution, deferred calls, rebinding, and dispatch validation.
Workspace isolation
src/main/presenter/toolPresenter/agentTools/agentToolManager.ts, test/main/presenter/toolPresenter/...
Filesystem allow-lists use call-scoped workspaces or isolated defaults rather than stale synchronized state.

Subagent host policy

Layer / File(s) Summary
Policy resolution and lifecycle wiring
src/main/presenter/sessionApplication/..., src/main/presenter/toolPresenter/agentTools/..., test/main/presenter/sessionApplication/...
Subagent creation propagates parent-agent context and resolves self-target versus cross-agent permission, tool, prompt, and skill policy.
Permission inheritance
src/main/presenter/permission/..., src/main/presenter/index.ts, src/main/presenter/mcpPresenter/...
Session-scoped command, file, and settings approvals can be cloned; MCP temporary approvals are cleared and not inherited.

Session lifecycle and routing

Layer / File(s) Summary
Chat acceptance and cancellation
src/main/routes/chat/chatService.ts, test/main/routes/chatService.test.ts
Concurrent accept paths are tracked independently, stop aborts all in-flight accepts, cleanup is bounded, and cancellation failures are reported.
Deletion and operation timeouts
src/main/presenter/sessionApplication/..., src/main/routes/sessions/sessionService.ts, test/main/...
Deletion proceeds through partial cleanup failures, session creation avoids a non-cancelling timeout race, and listing uses a dedicated timeout.

ACP progress mapping

Layer / File(s) Summary
Reasoning-only tool progress
src/main/agent/acp/runtime/acpContentMapper.ts, test/main/agent/acp/runtime/...
Tool progress remains a reasoning event and no longer emits a pseudo-permission action block.

Plugin scope messaging

Layer / File(s) Summary
Plugins Hub scope banner and localization
src/renderer/src/pages/plugins/PluginsHubPage.vue, src/renderer/src/i18n/*/settings.json
The Plugins Hub displays global or current-agent scope text with localized labels and agent-name fallback handling.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

Suggested reviewers: zerob13

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main change: multi-agent host isolation and session lifecycle handling.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/agent-multi-agent-isolation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/routes/chat/chatService.ts (1)

146-175: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

stopStream's outer scheduler.timeout isn't guarded, contradicting the "honest stop result" contract.

The wrapped task uses Promise.allSettled(...), which never rejects on its own, so the only way this scheduler.timeout call can throw is via the scheduler's own timeout/abort path — and that throw isn't caught here. stopStream is documented (spec.md) to give an "honest stop result" via { stopped: boolean }, but a scheduler-level timeout here would instead reject the whole stopStream() call.

🛠️ Suggested fix
-    let cancelFailed = false
-    await this.deps.scheduler.timeout({
+    let cancelFailed = false
+    try {
+      await this.deps.scheduler.timeout({
       task: Promise.allSettled([...]).then((results) => { ... }),
       ms: CHAT_STOP_TIMEOUT_MS,
       reason: `chat.stopStream:${targetSessionId}`
-    })
+      })
+    } catch {
+      cancelFailed = true
+    }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/routes/chat/chatService.ts` around lines 146 - 175, Guard the outer
scheduler.timeout call in stopStream so scheduler-level timeout or abort errors
are caught instead of rejecting the method. Preserve the existing rejection
handling for clearSessionPermissions and cancelGeneration, set cancelFailed when
the scheduler operation fails, and always return the documented { stopped:
!cancelFailed } result.
🧹 Nitpick comments (2)
test/main/agent/acp/runtime/acpContentMapper.test.ts (1)

43-49: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover tool_call_update as well as the initial tool_call.

These assertions only protect the start path, while the mapper also emits reasoning for status-changing updates. Add a regression case that verifies update events likewise produce no tool_call_permission action block.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/main/agent/acp/runtime/acpContentMapper.test.ts` around lines 43 - 49,
Add a regression test alongside the existing start-path assertions in the ACP
content mapper tests covering a status-changing tool_call_update event. Verify
the mapped update output contains no action block with action_type
tool_call_permission, while preserving the existing initial tool_call coverage.
src/main/presenter/agentRuntimePresenter/index.ts (1)

7530-7535: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider renaming normalizeSkillNames for generic usage.

Using normalizeSkillNames to normalize MCP server IDs is functionally correct because the method simply deduplicates, trims, and sorts an array of strings. However, for clarity, consider renaming normalizeSkillNames to a more generic name like normalizeStringList or normalizeIdentifiers if it is going to be reused across different identifier domains.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/presenter/agentRuntimePresenter/index.ts` around lines 7530 - 7535,
Rename normalizeSkillNames to a generic name such as normalizeStringList,
updating its declaration and every call site including
toToolDefinitionMcpServerIds. Preserve the existing deduplication, trimming,
sorting, and return behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/main/routes/chat/chatService.ts`:
- Around line 86-88: Bound bestEffortCancel with the scheduler timeout so
cleanup cannot block sendMessage indefinitely when turn.cancelGeneration or
sessionPermissionPort.clearSessionPermissions never settles. Apply the same
bounded-cleanup behavior to the additional bestEffortCancel usage around lines
190–209, while preserving propagation of the original send TimeoutError.
- Line 40: Update ChatService’s acceptControllers lifecycle to retain all
concurrent AbortControllers per session, allowing stopStream() to abort every
active accept path instead of overwriting earlier ones. Bound bestEffortCancel()
with a timeout covering clearSessionPermissions() and cancelGeneration(), and
ensure stopStream() converts scheduler.timeout cleanup failures into { stopped:
false } rather than propagating the error.

In `@src/renderer/src/i18n/zh-CN/settings.json`:
- Line 2778: Update the scopeCurrentAgent translation to clarify that this
setting only affects the selected agent’s available Skills/MCP and does not
change global plugin installation or status, matching the wording used by other
locales.

---

Outside diff comments:
In `@src/main/routes/chat/chatService.ts`:
- Around line 146-175: Guard the outer scheduler.timeout call in stopStream so
scheduler-level timeout or abort errors are caught instead of rejecting the
method. Preserve the existing rejection handling for clearSessionPermissions and
cancelGeneration, set cancelFailed when the scheduler operation fails, and
always return the documented { stopped: !cancelFailed } result.

---

Nitpick comments:
In `@src/main/presenter/agentRuntimePresenter/index.ts`:
- Around line 7530-7535: Rename normalizeSkillNames to a generic name such as
normalizeStringList, updating its declaration and every call site including
toToolDefinitionMcpServerIds. Preserve the existing deduplication, trimming,
sorting, and return behavior.

In `@test/main/agent/acp/runtime/acpContentMapper.test.ts`:
- Around line 43-49: Add a regression test alongside the existing start-path
assertions in the ACP content mapper tests covering a status-changing
tool_call_update event. Verify the mapped update output contains no action block
with action_type tool_call_permission, while preserving the existing initial
tool_call coverage.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b62d8fb3-3f1f-460c-92a9-2243ffa873e3

📥 Commits

Reviewing files that changed from the base of the PR and between 750f229 and 546ec9f.

📒 Files selected for processing (62)
  • docs/architecture/agent-scoped-extensions/spec.md
  • docs/architecture/multi-agent-isolation/plan.md
  • docs/architecture/multi-agent-isolation/spec.md
  • docs/architecture/multi-agent-isolation/tasks.md
  • docs/architecture/subagent-host-policy-isolation/plan.md
  • docs/architecture/subagent-host-policy-isolation/spec.md
  • docs/architecture/subagent-host-policy-isolation/tasks.md
  • docs/issues/acp-tool-progress-permission-ui/spec.md
  • docs/issues/agent-mcp-allowlist-runtime-enforce/spec.md
  • docs/issues/agent-tool-workspace-cross-session-leak/spec.md
  • docs/issues/agent-transfer-permission-skill-reset/spec.md
  • docs/issues/chat-generation-lifecycle-timeouts/spec.md
  • src/main/agent/acp/runtime/acpContentMapper.ts
  • src/main/presenter/agentRuntimePresenter/dispatch.ts
  • src/main/presenter/agentRuntimePresenter/index.ts
  • src/main/presenter/agentRuntimePresenter/types.ts
  • src/main/presenter/index.ts
  • src/main/presenter/permission/commandPermissionCache.ts
  • src/main/presenter/permission/commandPermissionService.ts
  • src/main/presenter/permission/filePermissionService.ts
  • src/main/presenter/permission/settingsPermissionService.ts
  • src/main/presenter/runtimePorts.ts
  • src/main/presenter/sessionApplication/agentAssignmentPolicy.ts
  • src/main/presenter/sessionApplication/lifecycleCoordinator.ts
  • src/main/presenter/sessionApplication/lifecycleDeletionTransaction.ts
  • src/main/presenter/sessionApplication/ports.ts
  • src/main/presenter/toolPresenter/agentTools/agentToolManager.ts
  • src/main/presenter/toolPresenter/agentTools/subagentOrchestratorTool.ts
  • src/main/presenter/toolPresenter/runtimePorts.ts
  • src/main/routes/chat/chatService.ts
  • src/main/routes/index.ts
  • src/main/routes/sessions/sessionService.ts
  • src/renderer/src/i18n/da-DK/settings.json
  • src/renderer/src/i18n/de-DE/settings.json
  • src/renderer/src/i18n/en-US/settings.json
  • src/renderer/src/i18n/es-ES/settings.json
  • src/renderer/src/i18n/fa-IR/settings.json
  • src/renderer/src/i18n/fr-FR/settings.json
  • src/renderer/src/i18n/he-IL/settings.json
  • src/renderer/src/i18n/id-ID/settings.json
  • src/renderer/src/i18n/it-IT/settings.json
  • src/renderer/src/i18n/ja-JP/settings.json
  • src/renderer/src/i18n/ko-KR/settings.json
  • src/renderer/src/i18n/ms-MY/settings.json
  • src/renderer/src/i18n/pl-PL/settings.json
  • src/renderer/src/i18n/pt-BR/settings.json
  • src/renderer/src/i18n/ru-RU/settings.json
  • src/renderer/src/i18n/tr-TR/settings.json
  • src/renderer/src/i18n/vi-VN/settings.json
  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/i18n/zh-HK/settings.json
  • src/renderer/src/i18n/zh-TW/settings.json
  • src/renderer/src/pages/plugins/PluginsHubPage.vue
  • test/main/agent/acp/runtime/acpContentMapper.test.ts
  • test/main/presenter/agentRuntimePresenter/agentRuntimePresenter.test.ts
  • test/main/presenter/agentRuntimePresenter/dispatch.test.ts
  • test/main/presenter/agentSessionPresenter/agentSessionPresenter.test.ts
  • test/main/presenter/sessionApplication/agentAssignmentPolicy.test.ts
  • test/main/presenter/sessionApplication/lifecycleCoordinator.test.ts
  • test/main/presenter/sessionApplication/lifecycleDeletionTransaction.test.ts
  • test/main/presenter/toolPresenter/agentTools/subagentOrchestratorTool.test.ts
  • test/main/routes/chatService.test.ts
💤 Files with no reviewable changes (1)
  • src/main/routes/index.ts

Comment thread src/main/routes/chat/chatService.ts Outdated
Comment thread src/main/routes/chat/chatService.ts
Comment thread src/renderer/src/i18n/zh-CN/settings.json Outdated

@zerob13 zerob13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes for runtime isolation gaps and a confirmed test failure. I verified the branch at ef44dc2; typecheck, lint, format check, i18n, and the PluginsHub renderer test pass, while the main test suite fails in sessionService.test.ts.

Comment thread src/main/presenter/toolPresenter/agentTools/agentToolManager.ts
Comment thread src/main/presenter/index.ts
Comment thread src/main/presenter/sessionApplication/lifecycleCoordinator.ts Outdated
Comment thread src/main/presenter/sessionApplication/agentAssignmentPolicy.ts
Comment thread src/main/routes/sessions/sessionService.ts Outdated
Comment thread src/main/routes/sessions/sessionService.ts Outdated
Comment thread src/main/routes/chat/chatService.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/main/routes/chat/chatService.ts (1)

150-193: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Resolves prior AbortController/timeout issues; consider deduplicating cleanup logic.

Aborting the full Set<AbortController> and bounding cleanup with scheduler.timeout correctly addresses the earlier "single overwritten controller" and "unbounded cleanup" issues. However, this cleanup block (allSettled + per-result logging + timeout catch) is nearly identical to bestEffortCancel (Lines 218-249), just inlined with an extra cancelFailed flag. Consider extracting a shared private helper that both stopStream and bestEffortCancel call, returning per-operation failure flags, to avoid maintaining two copies of the same cleanup semantics.

♻️ Sketch of a shared helper
+  private async runCleanupTasks(
+    sessionId: string,
+    timeoutReason: string
+  ): Promise<{ permissionsFailed: boolean; generationFailed: boolean }> {
+    const results = await this.deps.scheduler.timeout({
+      task: Promise.allSettled([
+        Promise.resolve().then(() => this.deps.sessionPermissionPort.clearSessionPermissions(sessionId)),
+        Promise.resolve().then(() => this.deps.turn.cancelGeneration(sessionId))
+      ]),
+      ms: CHAT_STOP_TIMEOUT_MS,
+      reason: timeoutReason
+    })
+    return {
+      permissionsFailed: results[0]?.status === 'rejected',
+      generationFailed: results[1]?.status === 'rejected'
+    }
+  }

Both stopStream and bestEffortCancel can then call this helper and only differ in logging wording / how they use the returned flags.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/routes/chat/chatService.ts` around lines 150 - 193, Deduplicate the
session cleanup logic shared by stopStream and bestEffortCancel by extracting a
private helper that performs the allSettled operations, per-operation logging,
and scheduler.timeout handling. Have the helper return the cancellation failure
status (and any other required operation flags), then update both callers to use
it while preserving their existing logging wording and return behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/main/routes/chat/chatService.ts`:
- Around line 150-193: Deduplicate the session cleanup logic shared by
stopStream and bestEffortCancel by extracting a private helper that performs the
allSettled operations, per-operation logging, and scheduler.timeout handling.
Have the helper return the cancellation failure status (and any other required
operation flags), then update both callers to use it while preserving their
existing logging wording and return behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b84336f5-bf86-4ed0-99c9-ddc5d37af722

📥 Commits

Reviewing files that changed from the base of the PR and between ef44dc2 and 563015c.

📒 Files selected for processing (27)
  • docs/architecture/multi-agent-isolation/plan.md
  • docs/architecture/multi-agent-isolation/spec.md
  • docs/architecture/multi-agent-isolation/tasks.md
  • docs/architecture/subagent-host-policy-isolation/plan.md
  • docs/architecture/subagent-host-policy-isolation/spec.md
  • docs/architecture/subagent-host-policy-isolation/tasks.md
  • docs/issues/agent-tool-workspace-cross-session-leak/spec.md
  • docs/issues/agent-transfer-permission-skill-reset/spec.md
  • docs/issues/chat-generation-lifecycle-timeouts/spec.md
  • src/main/presenter/agentRuntimePresenter/dispatch.ts
  • src/main/presenter/agentRuntimePresenter/index.ts
  • src/main/presenter/index.ts
  • src/main/presenter/mcpPresenter/index.ts
  • src/main/presenter/runtimePorts.ts
  • src/main/presenter/sessionApplication/lifecycleCoordinator.ts
  • src/main/presenter/toolPresenter/agentTools/agentToolManager.ts
  • src/main/routes/chat/chatService.ts
  • src/main/routes/sessions/sessionService.ts
  • src/renderer/src/i18n/zh-CN/settings.json
  • src/shared/types/presenters/core.presenter.d.ts
  • test/main/agent/acp/runtime/acpContentMapper.test.ts
  • test/main/presenter/agentRuntimePresenter/dispatch.test.ts
  • test/main/presenter/mcpPresenter.test.ts
  • test/main/presenter/sessionApplication/lifecycleCoordinator.test.ts
  • test/main/presenter/toolPresenter/agentTools/agentToolManagerRead.test.ts
  • test/main/routes/chatService.test.ts
  • test/main/routes/sessionService.test.ts
🚧 Files skipped from review as they are similar to previous changes (14)
  • docs/architecture/subagent-host-policy-isolation/tasks.md
  • test/main/agent/acp/runtime/acpContentMapper.test.ts
  • src/main/presenter/runtimePorts.ts
  • docs/architecture/subagent-host-policy-isolation/spec.md
  • src/main/presenter/index.ts
  • docs/architecture/multi-agent-isolation/tasks.md
  • docs/issues/agent-tool-workspace-cross-session-leak/spec.md
  • src/main/presenter/agentRuntimePresenter/dispatch.ts
  • docs/architecture/multi-agent-isolation/plan.md
  • docs/architecture/multi-agent-isolation/spec.md
  • src/main/presenter/sessionApplication/lifecycleCoordinator.ts
  • src/renderer/src/i18n/zh-CN/settings.json
  • test/main/routes/chatService.test.ts
  • src/main/presenter/agentRuntimePresenter/index.ts

…isolation

# Conflicts:
#	test/main/presenter/sessionApplication/sessionApplication.integration.test.ts
@zerob13 zerob13 merged commit 8682413 into dev Jul 14, 2026
4 checks passed
@zhangmo8 zhangmo8 deleted the fix/agent-multi-agent-isolation branch July 14, 2026 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants