Repository navigation
refactor(acp): move the deepseek session code off AcpClient into DeepseekAcpClient - #37641
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The DeepSeek array still goes out in the same place in the Notes
[DESIGN-REVIEWED] 481cdd9 Description read[DESCRIPTION-READ] 4d49be91c4709f28b59ffaa3f9f1a67115fc1b7701946c603d3b56ea080a3681 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks: a refactor that moves deepseek-only code off the shared client into its own class. Every default stays where it was, and each new hook replaces one backend check. What this change shipsInventory (7 items) — 7 justifiedIntent: let a deepseek session keep its state in its own client class, so the shared runtime can later hold that state per session. This is a FIX-free refactor (an ADDITION of structure with no behaviour change).
[FIRST-PRINCIPLES-REVIEWED] 481cdd9 Description read[DESCRIPTION-READ] 3f23b5014fea8eb7b509519c6bd33aa06c43fab77537652ad7a9b57746e08414 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
…seekAcpClient AcpClient carried the DeepSeek Harness session contract: the gate nonce and the READ_ONLY proof its launch records, its MCP array, the tripwire remedy behind an `_is_deepseek` branch, and a deepseek check in the tool-event path for the provider tool-call id dsh forwards verbatim. DeepseekAcpClient (acp/client_deepseek.py) now holds all of it, bound from the new owner module client_deepseek_session. AcpClient keeps one hook per step (`_harness_session_mcp_servers`, `_gate_tripwire_remedy`, `_tool_call_ids_repeat_in_turn`) with the behaviour every other backend already had, and the subclass fills it. The process adapter no longer asks a deepseek seam, and the launch types its session as DeepseekProcessSession. AcpClient(acp_backend="deepseek") builds DeepseekAcpClient, so no caller changes. Behaviour is unchanged. The tests follow the members to the new class; the tripwire test now also pins the deepseek remedy.
9bd08a8 to
481cdd9
Compare
Code change approver recommendation: ApproveWhy: the decider estimates an 8% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes. A refactor that moves the DeepSeek Harness code into DeepseekAcpClient, following the existing goose, claude and opencode subclass pattern, with no behaviour change found. The registry in AcpClient.new picks the subclass for acp_backend="deepseek", and the facade imports the module, so it is registered. The MCP array is unchanged: the harness and adapter hooks are spliced next to each other in client_start on both session/new and resume. The gate nonce and READ_ONLY proof are set only on the subclass, and every reader uses getattr with a fail-closed default. The tripwire remedy and the tool-call-id flag are class attributes, and only the deepseek class overrides them. Existing deepseek tool-call-id tests build the client through AcpClient(acp_backend=deepseek), so they go through the subclass. The tripwire test now checks the deepseek remedy text, and the parity tests would catch DeepseekLaunch overriding the MCP method again. 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 |
bolichen97
left a comment
There was a problem hiding this comment.
Approving. I read the whole diff on this head: the new client_deepseek.py and client_deepseek_session.py, the removals in client_class.py, client_mcp_array.py, client_permissions.py, client_tool_events.py, harness/base.py and harness/deepseek.py, and every changed test. I did not run tests locally. All 97 checks are green.
This is a pure move with the same shape as the goose split. Behavior is unchanged, and I checked these points on main:
- MCP array order. On main a deepseek session got its servers from
DeepseekLaunch.session_mcp_serversthrough_adapter_session_mcp_servers, which sits after_harness_session_mcp_serversand before the pooled servers inclient_start.py. Now the same list comes fromDeepseekAcpClient._harness_session_mcp_serversand the adapter hook is empty for deepseek, so the array is the same, in the same order, forsession/newandsession/load. - Fields that moved off the base class.
_deepseek_gate_nonceand_deepseek_read_only_issueare no longer set onAcpClient. Every read on main inclient_permissions.py(lines 1043, 1402 and 1488) usesgetattrwith the old default, and_dispatch_parts/permission_requests.pyonly uses a local variable of that name, so a non deepseek client still reads the empty defaults. - Class selection.
AcpClient.__new__picks the class fromacp_backendthrough_client_class_by_backend, so every deepseek client built the normal way is aDeepseekAcpClient. The tests that build a bare client now passacp_backend, andtest_the_backend_picks_the_client_classpins the choice. - Tripwire remedy. The base class default is the pi text and the deepseek class overrides it, which gives the same two texts as the old
if self._is_deepseekbranch. The new assertion checks the deepseek text and that the pi text is absent. - Repeated tool call ids. The old
backend == deepseektest is now a class flag that is true only onDeepseekAcpClient, false elsewhere. - Removed
_is_deepseek. I searched main for other users. The matches inhooks.py,gate_tiers.pyandtool_identity.pyare a different helper (_is_deepseek_read_only_builtin), and the two strings intest_acp_launch_goldens.pyare source snippets, not calls.
There is no new refusal, no security change and no regex in product code.
Not checked: I did not read the surrounding code of harness/deepseek.py beyond the changed hunks, and mergeable was still UNKNOWN when I ran the gate. The author already holds auto merge, so I left it as it is.
Problem / Motivation
Goal:
AcpClientholds no DeepSeek Harness-only code; a deepseek session runs exactly as before from a class of its own.AcpClientis the per-session client every non-KAS backend shares, and it carried the DeepSeek Harness session contract: the gate nonce and the READ_ONLY proof the deepseek launch records on the session, the session's MCP array, the remedy text of the completed-unasked tripwire (behind an_is_deepseekbranch), and a deepseek check in the tool-event path for the provider tool-call id dsh forwards verbatim. The process adapter also asked a deepseek-only MCP seam on the session.Why it matters
deepseek dashboard chats are next to share one ACP process, the way KAS, codex, claude and goose chats can. That needs deepseek's per-session state to be a unit the shared runtime can hold per session. This is the first of three PRs, split the way goose was (#37535, #37562, #37567). Users see no change from this PR.
Not a goal
client_permissions: pi and MiMo Code share it, and only its deepseek remedy moves.ACP_BACKENDS_*capability sets (ACP_BACKENDS_RESUME_WITHOUT_LOADkeeps deepseek).What changed (motivation -> approach -> change)
deepseek code was spread across the shared client -> it now lives in
DeepseekAcpClient(AcpClient)(acp/client_deepseek.py), bound from one owner module (acp/client_deepseek_session.py) ->AcpClientkeeps one hook per step with what every other backend already did, and the subclass fills it.AcpClient(acp_backend="deepseek", ...)builds aDeepseekAcpClientthrough the__init_subclass__(serves=...)registry, so no caller changes. Its__init__sets_deepseek_gate_nonceand_deepseek_read_only_issue, which the shared__init__no longer sets; every reader already reads them withgetattrand a fail-closed default.AcpClient._gate_tripwire_remedy(pi's text, which every non-deepseek tripwire already used) and_tool_call_ids_repeat_in_turn(False). The tripwire reads the first, the tool-event path the second, so kiro-cli and every other backend take the same branch as before._deepseek_session_mcp_serversmoves verbatim fromclient_mcp_arrayand fills the existing_harness_session_mcp_servershook in place of the seam onDeepseekLaunch, so the array sent onsession/newandsession/resumeis unchanged._is_deepseekis removed.ProcessSessionno longer lists the two deepseek fields or the deepseek MCP seam; the launch types its session asDeepseekProcessSession(theClaudeProcessSessionpattern).Backwards compatibility
Compatible:
AcpClient(acp_backend="deepseek")still builds a deepseek client, and the launch, tripwire, read-only proof and MCP array run the same code in the same order.Reader: src/kiro_crew/acp/harness/deepseek.py:DeepseekLaunch.session_mcp_servers -- removed; the array now comes from
DeepseekAcpClient._harness_session_mcp_serverson the same two call sites -- test_only_the_claude_goose_and_deepseek_clients_fill_the_harness_mcp_seamReader: src/kiro_crew/acp/client_class.py:AcpClient._is_deepseek -- removed; its one reader was the tripwire remedy, now
_gate_tripwire_remedy-- test_a_completed_call_the_gate_never_asked_about_stops_the_sessionTests
test_client_bindings.py: aDeepseekAcpClientinventory, each member bound fromclient_deepseek_session; the two new hooks join theAcpClientinventory;AcpClient(acp_backend="deepseek")buildsDeepseekAcpClient.test_acp_deepseek_backend_enforcement.py: the tripwire tests build the class the backend builds, and the stop test now pins the deepseek remedy (red when the subclass keeps pi's text: checked by swapping the override back).test_harness_parity.py:DeepseekAcpClientfills_harness_session_mcp_serverswith its own array;DeepseekLaunchasks no MCP seam.test_member_mount_deepseek.py: builds the class the backend builds.test_acp_mcp_startable.py,test_acp_launch_goldens.py,test_side_readonly_deepseek.py,test_crew_oauth_bridge_harnesses.py,test_acp_deepseek_backend.py,test_acp_deepseek_backend_vault.py,test_acp_harness_contract.py: 1123 passed. black, isort, flake8 and mypy on the changed files are clean.Proof: not provable -- other: refactor with no behaviour change; tests follow the moved members
Manual verification
N/A -- no behaviour change; unit coverage of the moved members is sufficient. deepseek chat sharing, which these hooks prepare for, gets a real dsh run in the PR that routes it.
Related Issues
Part of #5033
Checklist