Skip to content

feat(acp): let deepseek dashboard chats share one ACP process, switch off by default - #37646

Merged
bolichen97 merged 1 commit into
mainfrom
feat/deepseek-chat-sharing
Nov 16, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
feat/deepseek-chat-sharing

Conversation

@chenmingwei23

@chenmingwei23 chenmingwei23 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: with the ACP runtime sharing preview on and the new "Chats using DeepSeek Harness" switch on, deepseek dashboard chats in the same tree and folder share one dsh process; with the switch off (the default) nothing changes.

Every deepseek dashboard chat starts its own dsh --profile acp Node process today. DeepseekHarness (#37643) can drive one process for several sessions, but no chat is routed to it.

Why it matters

A busy session tree on deepseek (a lead and its workers) pays one dsh process per chat. Sharing one process per tree and folder saves that memory, as KAS, codex, claude and goose already can. The switch keeps it opt-in.

Stack and merge order: one commit on main. #37641, #37562, #37643 (DeepseekHarness), #37540 (claude chat sharing) and #37567 (goose switch) are merged.

Not a goal

What changed (motivation -> approach -> change)

No deepseek chat reached the shared harness -> make deepseek a chat-sharing member served by the shared runtime only for a chat that shares, and key its placement on the provider key the process holds -> membership rows, an account era, a switch.

  • Membership (agent_sdk/backends_sessions.py): deepseek joins ACP_BACKENDS_CHAT_RUNTIME_SHARING, ACP_BACKENDS_SHARED_RUNTIME_ONLY_FOR_CHATS and CHAT_RUNTIME_SHARING_HARNESSES (default off), so a deepseek chat takes the shared runtime only when its placement exists, through the routing feat(acp): let claude dashboard chats share one ACP process, switch off by default #37540 added.
  • Account era (providers/chat_share.py:deepseek_spawn_identity): the dsh home, the agent.deepseek_env mapping, and the vault revision of each referenced secret (SecretVault.list_items, read from the store without decrypting; every write changes it). A rotated key, a remapped name or another dsh home founds a new process instead of joining one that holds the old key; the key itself is never read for this.
  • Environment keys never share. A provider key the child would take from its inherited environment (DEEPSEEK_API_KEY, or any apiKeyEnv the dsh home's config layers name, that the mapping does not set) cannot be told rotated without reading it, so the era is "" and such a chat gets a key nothing matches. So does a mapping Crew refuses, an unnamed home, or an unreadable config or vault.
  • Switch: "Chats using DeepSeek Harness" under Settings > Developer > Feature previews > ACP runtime sharing (the name the Agent Harness page uses), 13 locale files, the config help text, config-baseline.json and the configuration doc.
  • DeepseekHarness.prepare_session takes the per-session options the claude routing passes and refuses a Side Chat.

Backwards compatibility

Compatible: the switch defaults off, and with it off, or the preview off, a deepseek chat starts exactly as before.

Tests

  • test_chat_runtime_sharing.py: a deepseek chat shares only from the dashboard with its switch on (switched off and side: origins are refused); the loader's defaults carry deepseek: false.
  • test_chat_runtime_sharing_deepseek_era.py (new; kept out of test_chat_runtime_sharing_cleanup.py, which is near the 2,000-line cap): the era follows the vault entry, not the key (same entry joins, a vault write, another home or a remapped secret founds a new process, a literal key fails closed); the era never decrypts the vault (every decrypting reader patched to fail); a key from the environment, including one the dsh config names via apiKeyEnv, never shares, while the same name fed from the vault does; an unparsable config layer fails closed.
  • test_deepseek_shared_runtime.py: a Side Chat session is refused a shared process.
  • test_config_all_settings.py: the new key is a reviewed editable setting. chatRuntimeSharingHarnessRows.test.tsx: the DeepSeek row shows off with nothing stored and writes its own key.
  • Run locally, serial, one file at a time: the files above plus test_goose_shared_runtime.py, test_claude_shared_runtime.py, test_acp_harness_contract.py, test_client_bindings.py, test_harness_parity.py, test_session_handle_bindings.py, test_acp_runtime_load_session.py, test_acp_deepseek_backend_session.py: all pass. Source gates, check-i18n-keys and black, isort, flake8, mypy on the changed files are clean.

Proof: not provable -- other: placement and era are unit-tested here; the pod run with real chats comes with this PR's manual verification

Manual verification

Pod run with a real session tree on deepseek, switch on and off, process counts and memory: to follow on this PR.

Screenshots / video

To follow on this PR.

Related Issues

Part of #5033

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

dsh-switch-off

dsh-switch-on

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of d63741887532d70c835ba07b9d49316310aef63d — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks: the new row copies its sibling rows exactly. Both screenshots show it, and the blind reader correctly identified both states as the same switch.

[UX-REVIEWED] d637418

Description read

[DESCRIPTION-READ] b737105a396d958e02e55e1ac3b8aa4a2b208c5dc4b8d0b9e374c4a61abc153c

That sha256 names everything this verdict read: the PR description, plus the 5 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of d63741887532d70c835ba07b9d49316310aef63d — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: deepseek is added as one more row in the existing chat-sharing membership, the switch is off by default, and turning it off restores the previous behaviour.

Notes

  • deepseek_spawn_identity decides whether a key comes from the environment by reading dsh's config format (apiKeyEnv in three named layers). If a dsh release adds another way to supply a key, chats would still share a process holding the old key after a rotation. Pin the dsh version this was checked against in the docstring or a test, so a dsh bump has to re-check it.

[DESIGN-REVIEWED] d637418

Description read

[DESCRIPTION-READ] 050a171d5bca2556c6fc0b0ea0922fdeb5577df93c48a9daca4fbbb353050ff1

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of d63741887532d70c835ba07b9d49316310aef63d — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing to check. Every item is an opt-in that defaults off, sits beside the existing per-chat process and reuses the routing and placement the claude and goose chats already use.

What this change ships

Inventory (6 items) — 6 justified

Intent: let operators who opt in run a busy deepseek session tree on one dsh process per tree and folder instead of one per chat, to save memory. ADDITION.

  1. New "Chats using DeepSeek Harness" switch under Settings > Developer > Feature previews > ACP runtime sharing, off by default, in 13 languages — justified
  2. With the preview and the switch both on, deepseek dashboard chats in the same tree and folder share one dsh process — justified
  3. New config key agent.chat_runtime_sharing_harnesses.deepseek (default false), plus its help text and baseline row — justified
  4. A rotated vault key, a remapped name or another dsh home starts a new process instead of joining the old one — justified
  5. A chat whose provider key comes from the inherited environment (including an apiKeyEnv name from the dsh config) never shares — justified
  6. A shared deepseek process refuses a Side Chat session — justified

[FIRST-PRINCIPLES-REVIEWED] d637418

Description read

[DESCRIPTION-READ] 5546ec3d0ffc1612264a1133c745deee43f9c904f436839f1205bc96af8b1deb

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of d63741887532d70c835ba07b9d49316310aef63d and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] d637418

False positive or not applicable? A repository writer can comment:
/ai-review override gpt d63741887532d70c835ba07b9d49316310aef63d false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed d63741887532d70c835ba07b9d49316310aef63d — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] d637418

Verdict parsed from the review's SHA-scoped output markers for commit d63741887532d70c835ba07b9d49316310aef63d.

False positive or not applicable? A repository writer can comment:
/ai-review override fable d63741887532d70c835ba07b9d49316310aef63d false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 15, 2026
@KiroCrewCaptain

KiroCrewCaptain commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider thinks the change is probably fine but estimates a 25% chance that this change introduces a defect, above the 12% limit for approving on its own.

The deepseek-specific change is sound: membership rows put deepseek on the shared runtime only for chats that share, behind a switch that defaults off and a dashboard-only origin rule; prepare_session refuses Side Chats; and the account era is built from the dsh home, the mapping and the vault revisions without decrypting, failing closed on environment-sourced keys, unreadable config or vault, and refused mappings. Tests cover the era cases, the placement gating and the setting. The earlier GPT finding about MCP pruning is fixed at this head. What remains (stacked commits, merge conflict, missing screenshots and manual proof) is process, not a code defect in this change.

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit e4cd529569 · 6278 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@chenmingwei23
chenmingwei23 force-pushed the feat/deepseek-chat-sharing branch from a1211d4 to 918fae6 Compare November 15, 2026 17:34
@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 15, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/deepseek-chat-sharing branch 3 times, most recently from f089e52 to e4cd529 Compare November 15, 2026 18:24
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 15, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/deepseek-chat-sharing branch 2 times, most recently from 3603c5b to 0a64eb9 Compare November 15, 2026 19:22
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 15, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/deepseek-chat-sharing branch from 0a64eb9 to 6240bf1 Compare November 15, 2026 19:39
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 15, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/deepseek-chat-sharing branch 2 times, most recently from 61f4d1f to d639cdb Compare November 15, 2026 20:17
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Nov 15, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/deepseek-chat-sharing branch from 4ceceed to 09495a7 Compare November 16, 2026 00:05
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Backend Tests (3.12, 1) fails on test/test_wakatime_handlers.py::test_status_loads_config_off_the_event_loop. That test fails on main as well (reproduced on a clean main checkout); this PR does not touch wakatime. The fix is #37726; this branch will be rebased once it lands.

@chenmingwei23
chenmingwei23 force-pushed the feat/deepseek-chat-sharing branch 3 times, most recently from d25bf55 to 7526a18 Compare November 16, 2026 02:03
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 16, 2026
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 16, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/deepseek-chat-sharing branch from 7526a18 to b2af8be Compare November 16, 2026 03:42
@chenmingwei23 chenmingwei23 reopened this Nov 16, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention labels Nov 16, 2026
bolichen97
bolichen97 previously approved these changes Nov 16, 2026

@bolichen97 bolichen97 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.

Reviewed head b2af8be as two parts. The goose commit (7c08c0c) is identical to #37567, reviewed and approved there. This review covers the deepseek commit on top of it. I checked it against #37567 and the claude route from #37540 on main.

Consistent with goose and claude. It adds the same three membership rows (backends_sessions.py), default off, and the same prepare_session refusal of side_read_only (harness/deepseek.py). The switch, config help, baseline, configuration doc and locale rows follow the same pattern. The era has the same random token per distinct value shape.

Switch off (the default): same as main. A deepseek chat now asks resolve_chat_share first. With the preview or the deepseek switch off, it is refused (sharing_disabled / harness_switched_off) before deepseek_spawn_identity runs. The start then takes the per-chat DeepseekAcpClient arm as before.

Switch on: isolation. cwd, extra_env, model, effort, sandbox tier and agent are in ChatRuntimeKey. The era adds the dsh home, the agent.deepseek_env mapping and the vault revision of each referenced secret. SecretVault.list_items reads those without decrypting. A key the child would inherit from its environment (DEEPSEEK_API_KEY or a config-named apiKeyEnv the mapping does not set) gives "", so that chat never shares. The same is true for a relative DSH_HOME, an unreadable layer, a refused mapping or a missing vault entry. That is stricter than goose, and right for a key Crew cannot see rotate. Approvals stay per session: the gate plugin asks through session/request_permission, which names the session. The tripwire ledger is per session (_DeepseekSession). A gate bypass fails the whole runtime (permission_state_issue_ends_process). The era runs inside _read_placement_inputs under asyncio.to_thread, so the config and vault reads stay off the loop. No new regex in product code.

Tests. Ran locally on this head: the goose set from #37567 plus test_chat_runtime_sharing_deepseek_era.py and test_deepseek_shared_runtime.py. Result: 1872 passed. CI still has Backend Tests shards pending on this head, so auto merge waits for them.

Non-blocking:

  • Rebase onto main once #37567 lands, so the squash carries only the deepseek rows. The body already says you will do this.
  • "Manual verification" still says "to follow". The pod run with process counts on and off is the only proof that real dsh sessions share one process. Please attach it.
  • _DSH_CONFIG_FILES (chat_share.py) mirrors dsh's config layout. If a dsh release adds a layer that names apiKeyEnv, that key is not seen. Pinning the list with a dsh-version note or a contract test would catch that.
  • #37567 states the process-wide KIROCREW_SESSION_KEY limit. If a shared dsh child also carries no per-chat key, stating it here too would keep the two PRs consistent.

Approving.

AI-assisted, sent by Bolin Review bot

@bolichen97
bolichen97 enabled auto-merge (squash) November 16, 2026 04:46
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 16, 2026
… off by default

dsh 0.2.0-rc.2 keeps a record per session in one process, runs their
turns in parallel, mounts each session's MCP servers on that session
alone, and restores a closed session with session/resume. DeepseekHarness
(the previous step) composes Crew's gate once per process and keeps each
session's tripwire ledger, but no chat reached it.

deepseek joins ACP_BACKENDS_CHAT_RUNTIME_SHARING and
ACP_BACKENDS_SHARED_RUNTIME_ONLY_FOR_CHATS, so a deepseek dashboard chat
takes the shared runtime only when its placement exists, and every other
deepseek session keeps its own process on DeepseekAcpClient. Its switch
under ACP runtime sharing defaults off ("Chats using DeepSeek Harness",
13 languages).

A deepseek placement keys on deepseek_spawn_identity: the dsh home, the
agent.deepseek_env mapping and the vault revision of each referenced
secret, read without decrypting, so a rotated key, a remapped name or
another home founds a new process. A provider key the child would take
from its inherited environment cannot be told rotated without reading
it, so such a chat never shares. A Side Chat never shares: its origin is
not the dashboard, and DeepseekHarness.prepare_session refuses one too.
@chenmingwei23
chenmingwei23 force-pushed the feat/deepseek-chat-sharing branch from b2af8be to d637418 Compare November 16, 2026 04:48
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 16, 2026

@bolichen97 bolichen97 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.

Re-approving d637418875. It is the same deepseek commit I approved on b2af8bec7e, rebased onto main after #37567 merged (git range-diff shows it unchanged), so my earlier review holds.

Backend Tests (macOS) (3) is red on this head; its log is not readable until the run finishes, so I can't yet say whether it is this PR or a flaky shard. Auto merge waits for it either way.

AI-assisted, sent by Bolin Review bot

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 16, 2026
@bolichen97
bolichen97 merged commit 66be1f3 into main Nov 16, 2026
117 of 118 checks passed
@bolichen97
bolichen97 deleted the feat/deepseek-chat-sharing branch November 16, 2026 06:28
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 16, 2026
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.

4 participants