Skip to content

feat(side-chat): run read-only tools on the DeepSeek Harness backend - #19745

Merged
chenmingwei23 merged 2 commits into
mainfrom
feat/deepseek-side-readonly
Oct 17, 2026
Merged

chenmingwei23 merged 2 commits into
mainfrom
feat/deepseek-side-readonly

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: On the DeepSeek Harness backend, Side Chat and thread replies can read files and search the codebase, while changes stay impossible.

On agent.acp_backend: "deepseek" every Side Chat tool call is refused (REJECT_ALL), because ACP_BACKENDS_SIDE_READONLY names only kiro-cli and KAS. A side question asked while the main turn is busy is answered from memory, and the footer says tools are unavailable on this backend.

Why it matters

Side Chat exists for quick lookups while the main turn runs. On deepseek it cannot open the file the question is about, so the answer is a guess and the user has to wait for the main chat.

Not a goal

  • Read-only shell commands (ls, git status) in a deepseek side turn. dsh streams bash as kind: other, so no shell command is recovered for the gate to judge, and making it a shell call would change the main chat's shell tiers too. bash stays refused on side turns.
  • Web fetch / web search on deepseek side turns. Only read, grep and glob are mapped.
  • Changing which deny rules, spec hooks or governance rules match a deepseek call in the main chat. The mapped name is read on a READ_ONLY turn only.
  • Any harness other than deepseek. pi and opencode stay out.
  • Relative read targets on deepseek side turns. They are refused rather than resolved against the session's work dir; the model is told its working directory by dsh's own system prompt and can retry with an absolute path.

What changed (motivation → approach → change)

Safe scope, for review. What a deepseek side turn (Side Chat or thread reply, READ_ONLY) may run now:

Call on deepseek Side turn (READ_ONLY) Normal (main-chat) turn
read with an absolute file_path, grep/glob with an absolute path (~ allowed) runs (proved from the tool name its tool_call frame stated) unchanged: asks
grep/glob with no path, or any relative target (dsh resolves it against the session's work dir; the gate's path checks would resolve it against the gateway's) refused unchanged: asks
same, on a host sensitive path (~/.aws, ~/.ssh, Crew's secrets) refused by the sensitive-path tier, before the proof unchanged
same, matched by a deny rule or governance ceiling written in dsh's name (read) or kiro-cli's (fs_read) refused unchanged
write, edit, bash, any MCP tool, any other name refused unchanged: asks
two tool_call frames under one id in a turn refused (name left unknown) unchanged

Why deepseek can be a member (H6, on its own evidence). The tempting route, dsh's own DSH_PERMISSION_MODE read-only posture, is still wrong: it denies rather than asks, so no READ_ONLY decision is made. The route that works is the one every deepseek session already runs: Crew's gate plugin (kiro_crew_tool_gate.mjs) answers dsh's tools/pre-execute with ask for every call, keeps only the harness's own denies, and turns every downstream allow into ask. The per-launch patch pins approval.policy: ask, and the load marker proves the stock ACP bridge is the only answerer. dsh's approval service has no allow rules (ask / never only, allowed-once the only grant). So there is no harness-side pre-approval a call could ride past the gate on — the gap that keeps claude out until #19059.

Live capture on dsh 0.2.0-rc.2 with the plugin composed (test/fixtures/acp_frames/deepseek/side-read-only-live.jsonl): read, grep, glob, write, bash and an unknown mcp__probe__read each raised session/request_permission; the rejected write and bash left no file.

What the gate can prove. dsh's ACP bridge writes the dispatched tool name as the tool_call frame's title (kind: "other", no _meta) and the permission frame carries only toolCallId. Every dsh MCP tool is mcp__<server>__<tool>, so a bare read is never an MCP tool.

  • platform/tool_names.DEEPSEEK_READ_ONLY_TOOLS (the stdlib leaf the KAS table lives in) maps read/grep/glob → fs_read/grep/glob and names each tool's target parameter (file_path / path). Not a HARNESS_TOOL_TABLES row, so main-chat hook matching does not move.
  • _dispatch.build_permission_event fills AcpEvent.deepseek_tool_name with the cached first-frame name, on the deepseek backend only; providers/acp.py carries it across.
  • AcpClient: on deepseek, a second tool_call frame naming the same id differently in one turn leaves the name empty (dsh forwards the provider's id verbatim; tool-call-id-reuse-live.jsonl). The per-turn reset clears it.
  • gate_tiers reads the field under classifier_only only: dsh's name and its kiro-cli name are both deny targets and one governance identity (alias_groups, as KAS ids are), and _tier_read_only proves it via tool_identity._is_deepseek_read_only_builtin (server empty, target parameter an absolute path). The sensitive-path tier runs first, as on kiro-cli.
  • ACP_BACKENDS_SIDE_READONLY gains deepseek; its comment states the evidence and why pi is still out.

A name proves the tool only when stock dsh registered it. A plugin from the operator's own dsh config can register a tool called read (globally ahead of the stock one, or in a per-agent scope created after load). So the name is trusted only when the launch proves that stock dsh composes those tools:

  • The gate plugin's load marker gains composition. It lists every enabled loader entry (id, module, fiber state) from ctx.get("loader").entries(). For each of read/grep/glob it also records whether the global layer holds the name and whether a scoped layer shadows it. A shape the plugin cannot read is reported as null. The plugin digest is re-pinned.
  • tool_gate.deepseek_read_only_owner_issue returns "" only when all three checks pass:
    • Every entry is stock. That means a bare @deepseek-ai/… package that is not dsh-cordis-host-runner/client-runner, a loader built-in (cordis:include/cordis:group), or Crew's sealed gate.
    • The names are global and not shadowed.
    • The owning dsh-tool-fs/dsh-tool-fs-search is running (fiber state 2).
  • _record_deepseek_read_only_proof stores the verdict on the session during the launch read-back. The session runs either way.
  • A non-empty verdict rides every deepseek permission event as AcpEvent.deepseek_read_only_issue. llm_helpers then refuses every call on a READ_ONLY turn, so the side turn is REJECT_ALL with a deny notice and a launch warning. On that session deepseek_tool_name is also left empty. A client with no recorded proof is refused.
  • Live on dsh 0.2.0-rc.2 (isolated HOME, the new plugin):
    • The stock composition has 91 entries, all state 2. The three names are owned by include:tool-fs/include:tool-fs-search, and the verdict is "".
    • A plugin added through ~/.dsh/profiles/acp/cordis.patch.yml gives a verdict naming that entry, so the turn is REJECT_ALL.
  • Docs: side.md, harness-parity.md H6, feature-map row, the deepseek corpus README.

Backwards compatibility

Compatible: kiro-cli, KAS and every other backend build the same permission events and get the same verdicts; on deepseek the new field is read only on READ_ONLY turns, which ran REJECT_ALL before.

Tests

test/test_side_readonly_deepseek.py drives each frame through the real deepseek AcpClient, the provider conversion and the real HookManager:

  • (a) the captured read, grep and glob, their targets anchored to an absolute path, are approved on a side turn — fail on main, as do the membership pin and two field pins.
  • (b) the captured write and bash, and bash ls, are refused on a side turn; on a normal turn write, bash and read are all still asked and none auto-approved.
  • (c) spoofs refused: the captured mcp__probe__read; two calls under one id in either order; no preceding tool_call; a prose title; a mismatched id; an opencode frame titled read gets no mapping.
  • (d) read ~/.aws/credentials, grep ~/.ssh, glob ~/.aws refused; the captured pathless glob, a pathless grep, an empty path, the captured relative read note.txt and grep ., ../x/.env and an unexpanded $HOME refused; auto_deny_tools in either spelling and governance ceilings (tools deny read / fs_read / grep, a filesystem.read deny) refuse it, and an allow-mode ceiling naming only fs_read still admits it; a Node run of the shipped plugin shows a downstream allow becomes ask and a deny stays deny.

Mutations: dropping the duplicate-id clear reddens 2 of the 3 duplicate cases; dropping the absolute-target check reddens the no-target and relative-target cases; dropping the alias_groups identity reddens the 3 tools ceiling cases.

Ran locally on this head: the new file, test_backend_cards.py (deepseek core count 4 → 5), test_harness_parity.py, test_hooks.py (kwargs pins gain the field), test_side.py, test_side_readonly_kas.py, test_chat_threads.py, test_side_context.py, test_gate_tiers.py, test_acp_deepseek_backend.py, test_acp_client.py, test_acp_frame_replay.py, test_acp_frame_host_data.py, test_harness_tool_names.py, test_tool_permission.py and the spec-hook suites — all green. isort, flake8, black gate (pinned 26.3.1) and comment-history gate pass.

@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners October 13, 2026 06:45
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 7fdba6e
  • What rule changed: On a READ_ONLY (Side Chat / thread reply) turn on the deepseek backend, the read-only proof in _tier_read_only also accepts deepseek_builtin_tool (dsh read/grep/glob mapped to fs_read/grep/glob, server must be empty); the same name is added to the deny targets and the governance identity on that turn only. hooks.on_tool_call and ToolCall carry the new field.
  • Before -> after (what was allowed/blocked, now): Before, every deepseek side-turn call was refused (REJECT_ALL, and kind other proved nothing). Now dsh read, grep, glob are auto-approved on a side turn after the sensitive-path, deny-rule and governance tiers; write, edit, bash, MCP and every other name stay refused. Main-chat deepseek turns are unchanged: the field is read only under classifier_only.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a deepseek side turn reads a file it should not. Bounded by the sensitive-path tier, which runs before the proof on the call's own raw params, and by auto_deny_tools / governance now binding the mapped name. A write cannot be approved: only the three read names map, and two calls under one id leave the name empty.
  • Evidence checked (which sandbox result proves it): live capture on dsh 0.2.0-rc.2 with Crew's gate plugin composed (test/fixtures/acp_frames/deepseek/side-read-only-live.jsonl): all six calls (read, grep, glob, write, bash, unknown mcp__probe__read) raised session/request_permission; rejected write and bash left no file. Node run of the shipped plugin: downstream allow becomes ask, deny stays deny.
  • No regression:
    • Tools still work (which tools/commands were run, result): replayed captured read/grep/glob through the real deepseek AcpClient + HookManager: approved on side turns; write/bash/mcp refused; on HOOK_BASED turns all still ask.
    • Backward compatible (old config / old data / old callers still work, how checked): new keyword defaults to "" everywhere; test_hooks.py::TestHookGateKwargs completeness pins updated and green; kiro-cli/KAS side suites (test_side.py, test_side_readonly_kas.py) green.
    • Existing tests (which suites passed on this head): test_side_readonly_deepseek, test_hooks, test_gate_tiers, test_side, test_side_readonly_kas, test_chat_threads, test_acp_client, test_acp_deepseek_backend, test_backend_cards, test_harness_parity, test_tool_permission, test_acp_frame_replay.
  • How to undo: remove ACP_BACKEND_DEEPSEEK from ACP_BACKENDS_SIDE_READONLY; deepseek side turns return to REJECT_ALL and the mapped field is never read. Full revert is a single PR revert.

@iamwhatever
iamwhatever force-pushed the feat/deepseek-side-readonly branch from 7fdba6e to 33840e9 Compare October 13, 2026 07:39
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 33840e9
  • What rule changed: On a READ_ONLY (Side Chat / thread reply) turn on the deepseek backend, the read-only proof in _tier_read_only also accepts deepseek_builtin_tool (dsh read/grep/glob mapped to fs_read/grep/glob, server must be empty); the same name is added to the deny targets and the governance identity on that turn only. hooks.on_tool_call and ToolCall carry the new field.
  • Before -> after (what was allowed/blocked, now): Before, every deepseek side-turn call was refused (REJECT_ALL, and kind other proved nothing). Now dsh read, grep, glob are auto-approved on a side turn after the sensitive-path, deny-rule and governance tiers; write, edit, bash, MCP and every other name stay refused. Main-chat deepseek turns are unchanged: the field is read only under classifier_only.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a deepseek side turn reads a file it should not. Bounded by the sensitive-path tier, which runs before the proof on the call's own raw params, and by auto_deny_tools / governance now binding the mapped name. A write cannot be approved: only the three read names map, and two calls under one id leave the name empty.
  • Evidence checked (which sandbox result proves it): live capture on dsh 0.2.0-rc.2 with Crew's gate plugin composed (test/fixtures/acp_frames/deepseek/side-read-only-live.jsonl): all six calls (read, grep, glob, write, bash, unknown mcp__probe__read) raised session/request_permission; rejected write and bash left no file. Node run of the shipped plugin: downstream allow becomes ask, deny stays deny.
  • No regression:
    • Tools still work (which tools/commands were run, result): replayed captured read/grep/glob through the real deepseek AcpClient + HookManager: approved on side turns; write/bash/mcp refused; on HOOK_BASED turns all still ask.
    • Backward compatible (old config / old data / old callers still work, how checked): new keyword defaults to "" everywhere; test_hooks.py::TestHookGateKwargs completeness pins updated and green; kiro-cli/KAS side suites (test_side.py, test_side_readonly_kas.py) green.
    • Existing tests (which suites passed on this head): test_side_readonly_deepseek, test_hooks, test_gate_tiers, test_side, test_side_readonly_kas, test_chat_threads, test_acp_client, test_acp_deepseek_backend, test_backend_cards, test_harness_parity, test_tool_permission, test_acp_frame_replay.
  • How to undo: remove ACP_BACKEND_DEEPSEEK from ACP_BACKENDS_SIDE_READONLY; deepseek side turns return to REJECT_ALL and the mapped field is never read. Full revert is a single PR revert.

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/acp_tool_gate.py

  • src/kiro_crew/agent_sdk/tool_gate.py

  • src/kiro_crew/hook_runtime/gate_tiers.py

  • src/kiro_crew/hook_runtime/tool_identity.py

  • src/kiro_crew/hooks.py

  • @iamwhatever posted a complete reasoning template for 474ff86.

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

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 474ff8679aebf15b84f01ca62068dacda57c6bb6 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — 🟡 CONCERNS

Premise-level review of 474ff8679aebf15b84f01ca62068dacda57c6bb6 — 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/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

AcpEvent.deepseek_tool_name adds a second copy of harness_builtin_tool, the field claude and goose already use to carry a read built-in's mapped name to the read-only gate.

Not justified as shipped

  • Item 4 — duplicate of AcpEvent.harness_builtin_tool (acp/types.py; mapping tables in acp/harness_tool_names.py): both fields take the same path through the same 6 files (_dispatch, types, acp_turns, hooks, tool_identity, gate_tiers; I grepped each name). The new field brings a new deny-target branch, an alias_groups branch, _is_deepseek_read_only_builtin and deepseek_policy_alias. The claude and goose elif branches in build_permission_event already map a cached name to a kiro-cli name under side_read_only.
    Subtraction: delete deepseek_tool_name and its five carriers. Add a third deepseek elif beside the claude and goose branches that sets _harness_builtin_tool only when the absolute-target check passes and the owner issue is empty, and move DEEPSEEK_READ_ONLY_TOOLS next to GOOSE_READ_ONLY_BUILTINS.
    Clears when: the field is folded into harness_builtin_tool, or a test shows a deny rule written in dsh's own name (read) that only the separate field can bind.

What this change ships

Inventory (7 items) — 6 justified

Intent: let Side Chat on DeepSeek Harness read and search files while writes stay impossible. ADDITION.

  1. Side Chat on deepseek now runs read/grep/glob with absolute targets instead of refusing every call — justified
  2. Gate plugin load marker reports the loader composition and who owns each read name (plugin digest re-pinned) — justified
  3. A non-stock dsh composition makes every deepseek side turn reject all calls, with a launch warning — justified
  4. New permission-event field carrying dsh's tool name to the gate — duplicate of AcpEvent.harness_builtin_tool
  5. Two tool_call frames under one id leave the name unknown — justified
  6. Deny rules and governance ceilings bind both read and fs_read on deepseek side turns — justified
  7. Harness card capability count for deepseek goes from 4 to 5; spec and feature-map rows updated — justified

[FIRST-PRINCIPLES-REVIEWED] 474ff86

Description read

[DESCRIPTION-READ] 7c19bcdedc745809b735c86edf5bd0b2ac4551f9c1a57dff34edfecdc41297c3

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 Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — 🟡 CONCERNS

Design-level review of 474ff8679aebf15b84f01ca62068dacda57c6bb6 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: CONCERNS

The stock-composition proof trusts every @deepseek-ai/* package except two named runners. A future stock package that loads operator code would get the read grant without anyone deciding it should.

Watch

  • A deny-list decides the trust. In tool_gate.deepseek_read_only_owner_issue, any module matching _DSH_STOCK_MODULE counts as stock unless it is in _DSH_FOREIGN_CODE_HOSTS, and that set names only the host and client runners. Here is the chain. The docstring says "A per-agent scope is created after load and is not visible to the snapshot", so the only thing ruling out a scoped read shadow is that every composed module is stock. If a later dsh release adds another @deepseek-ai/ package that runs operator-supplied code (a skill or plugin loader), it passes the check. Code it loads can then register a scoped read the snapshot cannot see, and a READ_ONLY side turn auto-approves that call by name. This is the negative-membership shape H6 forbids, applied to a trust decision. It can be reversed, and it only fails open on a dsh upgrade.
    Clears when: the stock check is a positive allowlist of the module names in the captured 0.2.0-rc.2 composition (unknown modules count as foreign), or the proof is limited to a pinned dsh version range that is checked at launch.

Suggestions

  • The proof depends on undocumented dsh internals: ctx.tools.layers.scoped, loader.entries() and fiber state 2. Add a test that fails if _CORDIS_FIBER_ACTIVE or the marker shape drifts from the live fixture. Then a dsh upgrade that quietly turns every side turn back to REJECT_ALL shows up red instead of only as a launch warning.

[DESIGN-REVIEWED] 474ff86

Description read

[DESCRIPTION-READ] a3d6ec0ee049238ca00f6e2f96ebf24079767483a05282ce6ee9a473df89aee9

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 Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 474ff86

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable 474ff8679aebf15b84f01ca62068dacda57c6bb6: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 474ff86

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 474ff8679aebf15b84f01ca62068dacda57c6bb6: <one-sentence reason>

@iamwhatever
iamwhatever force-pushed the feat/deepseek-side-readonly branch from 33840e9 to 02c4eff Compare October 13, 2026 08:16
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 02c4eff
  • What rule changed: On a READ_ONLY (Side Chat / thread reply) turn on the deepseek backend, the read-only proof in _tier_read_only also accepts deepseek_tool_name when it is dsh read/grep/glob (mapped to fs_read/grep/glob), the server is empty and the call names its target (file_path / path); dsh's name and the kiro-cli name are both deny targets and one governance identity on that turn only. hooks.on_tool_call and ToolCall carry the new field.
  • Before -> after (what was allowed/blocked, now): Before, every deepseek side-turn call was refused (REJECT_ALL, and kind other proved nothing). Now dsh read, grep, glob that name their target are auto-approved on a side turn after the sensitive-path, deny-rule and governance tiers; write, edit, bash, MCP and every other name stay refused. Main-chat deepseek turns are unchanged: the field is read only under classifier_only.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a deepseek side turn reads a file it should not. Bounded by the sensitive-path tier, which runs before the proof on the call's own raw params, and by auto_deny_tools / governance now binding the mapped name. A write cannot be approved: only the three read names map, and two calls under one id leave the name empty.
  • Evidence checked (which sandbox result proves it): live capture on dsh 0.2.0-rc.2 with Crew's gate plugin composed (test/fixtures/acp_frames/deepseek/side-read-only-live.jsonl): all six calls (read, grep, glob, write, bash, unknown mcp__probe__read) raised session/request_permission; rejected write and bash left no file. Node run of the shipped plugin: downstream allow becomes ask, deny stays deny.
  • No regression:
    • Tools still work (which tools/commands were run, result): replayed captured read/grep/glob through the real deepseek AcpClient + HookManager: approved on side turns; write/bash/mcp refused; on HOOK_BASED turns all still ask.
    • Backward compatible (old config / old data / old callers still work, how checked): new keyword defaults to "" everywhere; test_hooks.py::TestHookGateKwargs completeness pins updated and green; kiro-cli/KAS side suites (test_side.py, test_side_readonly_kas.py) green.
    • Existing tests (which suites passed on this head): test_side_readonly_deepseek, test_hooks, test_gate_tiers, test_side, test_side_readonly_kas, test_chat_threads, test_acp_client, test_acp_deepseek_backend, test_backend_cards, test_harness_parity, test_tool_permission, test_acp_frame_replay.
  • How to undo: remove ACP_BACKEND_DEEPSEEK from ACP_BACKENDS_SIDE_READONLY; deepseek side turns return to REJECT_ALL and the mapped field is never read. Full revert is a single PR revert.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Disposition for the GPT 6.1 review of 33840e9eb9 — both findings verified in code and fixed in 02c4efff34.

1. _dispatch.py — native-name denies (fixed). Verified: a deepseek permission event's title is unknown (dsh's permission frame carries only toolCallId) and the event carried only the mapped fs_read, so auto_deny_tools: ["read"] / tools.deny: ["read"] matched nothing on a side turn. The event now carries dsh's own name (AcpEvent.deepseek_tool_name). On a READ_ONLY turn the gate adds both read and fs_read to the deny targets, and passes them to governance as one alias_groups identity, the shape KAS ids already use. A deny in either spelling refuses; an allow-mode list naming only fs_read still admits. Pinned by test_a_deny_rule_in_either_spelling_refuses_the_deepseek_read[read|fs_read], test_a_governance_ceiling_refuses_the_deepseek_read[tools_deny_read|tools_deny_fs_read|tools_deny_grep] and test_an_allow_mode_ceiling_naming_fs_read_admits_the_deepseek_read.

2. gate_tiers.py — pathless searches (fixed, fail-closed). Verified: dsh grep/glob default path to the session workspace, the gate cannot see that root, and the captured glob {"pattern": "*.txt"} reached the proof with no filesystem target. The proof now requires the tool's target parameter (DEEPSEEK_READ_ONLY_TOOLS: file_path for read, path for grep/glob) as a non-empty string. A call without one is refused, not approved, so the sensitive-path and filesystem.read checks always see the root of an approved read. Pinned by test_side_turn_refuses_a_read_that_names_no_target[live_glob|grep_no_path|glob_empty_path|read_no_file_path]. A glob that names path is still approved (test_side_turn_approves_a_glob_that_names_its_root).

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review -- 🟡 CONCERNS

Which legitimate operations does 474ff8679aebf15b84f01ca62068dacda57c6bb6 newly refuse? Updated in place on each push. A script-confirmed regression blocks; the model proposes candidates and never decides a refusal.

Verdict basis: the reviewer's own judgement; no confirmed regression.

Security scope review -- adjudicated candidates

  • macos-latest (platform posix): 11 classified, 0 newly refused, 11 still allowed.
  • ubuntu-latest (platform posix): 11 classified, 0 newly refused, 11 still allowed.
  • windows-latest (platform windows): 10 classified, 0 newly refused, 10 still allowed.

No candidate flipped from allowed to refused.

Scope-Verdict: CONCERNS

TIGHTENING: DeepSeek Harness READ_ONLY (Side Chat) permission resolution -- this change refuses a READ_ONLY turn on a dsh session whose launch did not prove that stock dsh owns the read/grep/glob tool names. The aim is to stop a non-stock or shadowing plugin from getting a tool auto-approved just because it is called read. Hunk (src/kiro_crew/llm_helpers.py): if policy == ToolApprovalPolicy.READ_ONLY and event.deepseek_read_only_issue: ... _log("rejected", metadata={"reason": "read_only_policy_unproven_composition"}) ... await provider.reject_tool(event.request_id). The issue string defaults to "the harness composition was not read back" in client_class.py. It is cleared only by tool_gate.deepseek_read_only_owner_issue, which requires every entry to match _DSH_STOCK_MODULE, to not be one of _DSH_FOREIGN_CODE_HOSTS, to be a loader built-in or the gate itself, and to have global is True / scoped is False for each name. A related change: client_tool_events.py blanks the cached name (_harness_name = "") when one toolCallId is restated under a different title.

ADJUDICATED: 16 candidates, 0 confirmed newly-refused
The shell deny composite (sensitive-bash, exfil, deny-rules) is not edited by this diff. The gate_tiers.py hunks add deepseek_tool_name and its policy alias to the deny targets and governance identity only when classifier_only is set. That field is empty on any shell row, so these rows are a control that the composite did not drift. They are not a measurement of the guard above.

PLATFORM COVERAGE: Candidates cover three spellings. The posix rows cover the gate-plugin seal recompute (sha256sum), the fixture read, the grep, the scrubbed-env pytest run, git diff and ls ~/.deepseek. The windows rows cover the same operations with drive-less \ paths, Get-FileHash, type, Select-String, .venv\Scripts\python.exe and %USERPROFILE%. The any rows cover the dsh launch dsh --profile acp, dsh --version, npm ls/npm view of the stock owners, and check_harness_parity.py. The diff's platform assumptions all live outside the shell composite, and no candidate row can probe them:

  • _same_spelling_entry handles only a file:// prefix and os.path.isabs.
  • _is_deepseek_read_only_builtin requires os.path.isabs(os.path.expanduser(target)).
  • _DSH_STOCK_MODULE is a lowercase-only bare npm specifier.

These are named under UNADJUDICATED.

UNADJUDICATED:

  • Guard 1, the composition owner proof (agent_sdk/tool_gate.deepseek_read_only_owner_issue). Call path: acp/harness/deepseek._verify_deepseek_gate → _record_deepseek_read_only_proof → sets session._deepseek_read_only_issue → acp/client_permissions._build_permission_event → _dispatch.build_permission_event → AcpEvent.deepseek_read_only_issue → providers/acp_turns._to_llm_event → llm_helpers._resolve_permission (REJECT_ALL). Legitimate inputs I would have submitted:

    • (a) A Windows marker where the gate entry's module arrives as file:///C:/Users/me/.../kiro_crew_tool_gate.mjs. url2pathname(module[7:]) gives \C:\... on Windows, or /C:/... elsewhere, and that may not compare equal to pi_mod._same_file_spelling(extension_path). If so, the gate counts as a non-stock plugin, and every Windows deepseek side turn becomes REJECT_ALL.
    • (b) A stock entry spelled with a version or subpath, such as @deepseek-ai/dsh-tool-fs@0.2.0 or @deepseek-ai/dsh_tool. These fail the [a-z0-9-]+ fullmatch.
    • (c) A stock composition with no cordis:include/cordis:group wrapper but some other loader built-in id.
    • (d) A scoped Map whose layers have no tools.has method. layer?.tools?.has?.(name) !== false evaluates undefined !== false, which is true, so the snapshot reports a shadow and the session is refused even with no shadow present.
  • Guard 2, the per-call absolute-target requirement (hook_runtime/tool_identity._is_deepseek_read_only_builtin). Call path: gate_tiers._tier_read_only. Legitimate inputs:

    • The live fixture's own read with {"file_path": "note.txt"}, which is relative.
    • grep/glob with no path, which dsh resolves against the work dir.
    • A Windows C:\repo\src or UNC \\server\share\repo target, which os.path.isabs accepts on the Windows host but not on posix.

    The first two most likely fall through to an approval ask rather than a hard refuse (ToolHookResult.allow()). Even so, they lose the read-only auto-approve that this PR describes as the feature.

  • Guard 3, the toolCallId name collision (client_tool_events._extract_tool_event). It blanks the name when one id is retitled within a turn. The tool-call-id-reuse-live.jsonl fixture shows dsh reusing call_0 ACROSS turns, and the cache is keyed by id. If the cache is not cleared between turns, then turn 2's read on call_0, after turn 1's bash on call_0, has its name blanked and is refused. I could not confirm from the diff where the cache is cleared.

None of these can be expressed as a shell command line, so no leg can give a verdict on them. This is a gap in what could be tested, not a confirmed regression.

[SCOPE-REVIEWED] 474ff86

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: c2531a2
  • What rule changed: On a READ_ONLY (Side Chat / thread reply) turn on the deepseek backend, the read-only proof in _tier_read_only also accepts deepseek_tool_name when it is dsh read/grep/glob (mapped to fs_read/grep/glob), the server is empty and the call names its target (file_path / path); dsh's name and the kiro-cli name are both deny targets and one governance identity on that turn only. hooks.on_tool_call and ToolCall carry the new field.
  • Before -> after (what was allowed/blocked, now): Before, every deepseek side-turn call was refused (REJECT_ALL, and kind other proved nothing). Now dsh read, grep, glob that name their target are auto-approved on a side turn after the sensitive-path, deny-rule and governance tiers; write, edit, bash, MCP and every other name stay refused. Main-chat deepseek turns are unchanged: the field is read only under classifier_only.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a deepseek side turn reads a file it should not. Bounded by the sensitive-path tier, which runs before the proof on the call's own raw params, and by auto_deny_tools / governance now binding the mapped name. A write cannot be approved: only the three read names map, and two calls under one id leave the name empty.
  • Evidence checked (which sandbox result proves it): live capture on dsh 0.2.0-rc.2 with Crew's gate plugin composed (test/fixtures/acp_frames/deepseek/side-read-only-live.jsonl): all six calls (read, grep, glob, write, bash, unknown mcp__probe__read) raised session/request_permission; rejected write and bash left no file. Node run of the shipped plugin: downstream allow becomes ask, deny stays deny.
  • No regression:
    • Tools still work (which tools/commands were run, result): replayed captured read/grep/glob through the real deepseek AcpClient + HookManager: approved on side turns; write/bash/mcp refused; on HOOK_BASED turns all still ask.
    • Backward compatible (old config / old data / old callers still work, how checked): new keyword defaults to "" everywhere; test_hooks.py::TestHookGateKwargs completeness pins updated and green; kiro-cli/KAS side suites (test_side.py, test_side_readonly_kas.py) green.
    • Existing tests (which suites passed on this head): test_side_readonly_deepseek, test_hooks, test_gate_tiers, test_side, test_side_readonly_kas, test_chat_threads, test_acp_client, test_acp_deepseek_backend, test_backend_cards, test_harness_parity, test_tool_permission, test_acp_frame_replay.
  • How to undo: remove ACP_BACKEND_DEEPSEEK from ACP_BACKENDS_SIDE_READONLY; deepseek side turns return to REJECT_ALL and the mapped field is never read. Full revert is a single PR revert.

@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 Oct 13, 2026
@iamwhatever
iamwhatever force-pushed the feat/deepseek-side-readonly branch from c2531a2 to a65373d Compare October 13, 2026 09:16
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: a65373d
  • What rule changed: On a READ_ONLY (Side Chat / thread reply) turn on the deepseek backend, the read-only proof in _tier_read_only also accepts deepseek_tool_name when it is dsh read/grep/glob (mapped to fs_read/grep/glob), the server is empty and the call names its target (file_path / path) as an absolute path; dsh's name and the kiro-cli name are both deny targets and one governance identity on that turn only. hooks.on_tool_call and ToolCall carry the new field.
  • Before -> after (what was allowed/blocked, now): Before, every deepseek side-turn call was refused (REJECT_ALL, and kind other proved nothing). Now dsh read, grep, glob that name their target are auto-approved on a side turn after the sensitive-path, deny-rule and governance tiers; write, edit, bash, MCP and every other name stay refused. Main-chat deepseek turns are unchanged: the field is read only under classifier_only.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a deepseek side turn reads a file it should not. Bounded by the sensitive-path tier, which runs before the proof on the call's own raw params, and by auto_deny_tools / governance now binding the mapped name. A write cannot be approved: only the three read names map, and two calls under one id leave the name empty.
  • Evidence checked (which sandbox result proves it): live capture on dsh 0.2.0-rc.2 with Crew's gate plugin composed (test/fixtures/acp_frames/deepseek/side-read-only-live.jsonl): all six calls (read, grep, glob, write, bash, unknown mcp__probe__read) raised session/request_permission; rejected write and bash left no file. Node run of the shipped plugin: downstream allow becomes ask, deny stays deny.
  • No regression:
    • Tools still work (which tools/commands were run, result): replayed captured read/grep/glob through the real deepseek AcpClient + HookManager: approved on side turns; write/bash/mcp refused; on HOOK_BASED turns all still ask.
    • Backward compatible (old config / old data / old callers still work, how checked): new keyword defaults to "" everywhere; test_hooks.py::TestHookGateKwargs completeness pins updated and green; kiro-cli/KAS side suites (test_side.py, test_side_readonly_kas.py) green.
    • Existing tests (which suites passed on this head): test_side_readonly_deepseek, test_hooks, test_gate_tiers, test_side, test_side_readonly_kas, test_chat_threads, test_acp_client, test_acp_deepseek_backend, test_backend_cards, test_harness_parity, test_tool_permission, test_acp_frame_replay.
  • How to undo: remove ACP_BACKEND_DEEPSEEK from ACP_BACKENDS_SIDE_READONLY; deepseek side turns return to REJECT_ALL and the mapped field is never read. Full revert is a single PR revert.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Disposition for the Opus 5.5 review of c2531a25e2 — verified in code and fixed in a65373db60.

Relative DeepSeek targets (fixed, fail-closed). Verified: _tier_param_paths (hook_runtime/gate_tiers.py) hands each raw-param path to sensitive_path_refusal with no base dir, so a relative file_path is resolved against the gateway's cwd, while dsh resolves it against the session's work dir. Before the fix, a probe replaying read {"file_path": "../../.aws/credentials"} through the deepseek transport was approved. _is_deepseek_read_only_builtin now proves a call only when its target parameter is an absolute path after ~ expansion (os.path.isabs(os.path.expanduser(target))). Env vars are not expanded, so $HOME/... stays relative and is refused. A missing, empty or relative target, path: "." included, is no longer proof, and the side turn refuses it. Pinned by test_side_turn_refuses_a_read_that_names_no_target[live_read_relative|live_grep_dot|read_parent_relative|grep_unexpanded_var] beside the pathless cases. The approval and governance tests now anchor the captured frames' targets under tmp_path, so each deny test is refused by its own rule and not by the path check.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 13, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: e4833be
  • What rule changed: On a READ_ONLY (Side Chat / thread reply) turn on the deepseek backend, the read-only proof in _tier_read_only also accepts deepseek_tool_name when it is dsh read/grep/glob (mapped to fs_read/grep/glob), the server is empty and the call names its target (file_path / path) as an absolute path; dsh's name and the kiro-cli name are both deny targets and one governance identity on that turn only. hooks.on_tool_call and ToolCall carry the new field.
  • Before -> after (what was allowed/blocked, now): Before, every deepseek side-turn call was refused (REJECT_ALL, and kind other proved nothing). Now dsh read, grep, glob that name their target are auto-approved on a side turn after the sensitive-path, deny-rule and governance tiers; write, edit, bash, MCP and every other name stay refused. Main-chat deepseek turns are unchanged: the field is read only under classifier_only.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a deepseek side turn reads a file it should not. Bounded by the sensitive-path tier, which runs before the proof on the call's own raw params, and by auto_deny_tools / governance now binding the mapped name. A write cannot be approved: only the three read names map, and two calls under one id leave the name empty.
  • Evidence checked (which sandbox result proves it): live capture on dsh 0.2.0-rc.2 with Crew's gate plugin composed (test/fixtures/acp_frames/deepseek/side-read-only-live.jsonl): all six calls (read, grep, glob, write, bash, unknown mcp__probe__read) raised session/request_permission; rejected write and bash left no file. Node run of the shipped plugin: downstream allow becomes ask, deny stays deny.
  • No regression:
    • Tools still work (which tools/commands were run, result): replayed captured read/grep/glob through the real deepseek AcpClient + HookManager: approved on side turns; write/bash/mcp refused; on HOOK_BASED turns all still ask.
    • Backward compatible (old config / old data / old callers still work, how checked): new keyword defaults to "" everywhere; test_hooks.py::TestHookGateKwargs completeness pins updated and green; kiro-cli/KAS side suites (test_side.py, test_side_readonly_kas.py) green.
    • Existing tests (which suites passed on this head): test_side_readonly_deepseek, test_hooks, test_gate_tiers, test_side, test_side_readonly_kas, test_chat_threads, test_acp_client, test_acp_deepseek_backend, test_backend_cards, test_harness_parity, test_tool_permission, test_acp_frame_replay.
  • How to undo: remove ACP_BACKEND_DEEPSEEK from ACP_BACKENDS_SIDE_READONLY; deepseek side turns return to REJECT_ALL and the mapped field is never read. Full revert is a single PR revert.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 13, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 14, 2026
@iamwhatever
iamwhatever requested a review from buluoray October 14, 2026 09:33
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 14, 2026
@iamwhatever
iamwhatever force-pushed the feat/deepseek-side-readonly branch from ab3cec7 to 1c046a5 Compare October 14, 2026 15:57
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 1c046a5
  • What rule changed: DeepSeek Harness Side Chat may auto-approve stock dsh read, grep, and glob only after launch proves stock ownership. Unknown owners, non-stock plugins, scoped shadows, missing tools, and unreadable composition keep the whole side turn at REJECT_ALL. Claude and goose Side Chat support from main remain intact.
  • Before -> after (what was allowed/blocked, now): This head rebases the same two commits onto 989a43dfc8, after feat(side-chat): run read-only tools on the goose backend #20173 (goose Side Chat read-only) merged. The conflict resolution keeps both: ACP_BACKENDS_SIDE_READONLY now holds kiro, KAS, claude, goose and deepseek, and the goose (extension, tool) proof and the deepseek tool-name read sit side by side in build_permission_event. The prior owner proof is preserved. No DeepSeek or goose grant widened.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): A stock dsh layout may lose Side Chat reads. It fails closed to REJECT_ALL. It cannot grant writes, commands, MCP calls, unknown owners, or shadowed reads.
  • Evidence checked (which sandbox result proves it): The real gate plugin is loaded by the owner tests. A stock composition proves the three read tools. A non-stock shadow plugin makes the live read reject. Missing, malformed, unknown, and scoped owner states also reject. The goose live-frame suite passes beside it.
  • No regression:
    • Tools still work (which tools/commands were run, result): The live read, grep, and glob frames pass with stock ownership. DeepSeek write, bash, MCP, unknown-owner, and shadowed-owner calls reject. Claude, KAS and goose Side Chat read suites pass on this tree.
    • Backward compatible (old config / old data / old callers still work, how checked): The new event field defaults to an unproved composition, which keeps old callers fail-closed. Non-DeepSeek backends carry no DeepSeek issue.
    • Existing tests (which suites passed on this head): With the worktree's src confirmed loaded: all test_side_readonly*, test_side*, test_backend_cards, test_hooks (676 passed); dispatch, gate-tier, parity, deepseek, goose and tool-gate suites (2192 passed). flake8, black, isort, acp-frame-host-data and agent-sdk-boundary gates pass.
  • How to undo: Revert both PR commits to restore REJECT_ALL for DeepSeek Side Chat. Reverting only the second commit restores unsafe name-only proof and must not be used.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

@buluoray ready for re-review at 1c046a57db, rebased onto 989a43dfc8 after #20173 (goose Side Chat read-only) merged. Still two commits.

Your review on e4833be748, disposition unchanged:

  • Blocking (name-only read proof): fixed in fix(side-chat): approve dsh reads only when stock dsh owns the tools. Reads are approved only when the load marker proves stock dsh owns read/grep/glob; any other owner keeps the side turn REJECT_ALL. Full disposition: feat(side-chat): run read-only tools on the DeepSeek Harness backend #19745 (comment)
  • Follow-up (same-id test used a relative path): fixed. test_two_calls_under_one_id_are_not_read_as_the_read now uses an absolute target, so only the same-id blanking refuses the call.

Conflict resolution keeps both backends: ACP_BACKENDS_SIDE_READONLY now lists goose and deepseek, and the goose pair proof and the deepseek name read sit side by side in build_permission_event. Side Chat, dispatch, gate and parity suites pass on this head (676 + 2192 tests).

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 14, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 991fb77
  • What rule changed: DeepSeek Harness Side Chat may auto-approve stock dsh read, grep, and glob only after launch proves stock ownership. Unknown owners, non-stock plugins, scoped shadows, missing tools, and unreadable composition keep the whole side turn at REJECT_ALL. Claude and goose Side Chat support from main remain intact.
  • Before -> after (what was allowed/blocked, now): This head rebases the same two commits onto b88cb580ca, after feat(side-chat): run read-only tools on the goose backend #20173 (goose Side Chat read-only) merged. The conflict resolution keeps both: ACP_BACKENDS_SIDE_READONLY now holds kiro, KAS, claude, goose and deepseek, and the goose (extension, tool) proof and the deepseek tool-name read sit side by side in build_permission_event. The prior owner proof is preserved. No DeepSeek or goose grant widened.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): A stock dsh layout may lose Side Chat reads. It fails closed to REJECT_ALL. It cannot grant writes, commands, MCP calls, unknown owners, or shadowed reads.
  • Evidence checked (which sandbox result proves it): The real gate plugin is loaded by the owner tests. A stock composition proves the three read tools. A non-stock shadow plugin makes the live read reject. Missing, malformed, unknown, and scoped owner states also reject. The goose live-frame suite passes beside it.
  • No regression:
    • Tools still work (which tools/commands were run, result): The live read, grep, and glob frames pass with stock ownership. DeepSeek write, bash, MCP, unknown-owner, and shadowed-owner calls reject. Claude, KAS and goose Side Chat read suites pass on this tree.
    • Backward compatible (old config / old data / old callers still work, how checked): The new event field defaults to an unproved composition, which keeps old callers fail-closed. Non-DeepSeek backends carry no DeepSeek issue.
    • Existing tests (which suites passed on this head): With the worktree's src confirmed loaded: all test_side_readonly*, test_side*, test_backend_cards, test_hooks (676 passed); dispatch, gate-tier, parity, deepseek, goose and tool-gate suites (2192 passed). flake8, black, isort, acp-frame-host-data and agent-sdk-boundary gates pass.
  • How to undo: Revert both PR commits to restore REJECT_ALL for DeepSeek Side Chat. Reverting only the second commit restores unsafe name-only proof and must not be used.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

@buluoray current head is 991fb77664, rebased outside this session onto b88cb580ca after goose Side Chat support merged. The owner-verification fix is unchanged: only stock dsh-owned read/grep/glob may auto-approve; unknown, non-stock, or shadowed owners keep every DeepSeek side call at REJECT_ALL. The current-head SCR records 676 Side Chat tests and 2192 dispatch/gate/parity tests passing: #19745 (comment). Full owner-proof disposition: #19745 (comment). Please re-review this head when the two infra reruns clear.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 4e7b1a9
  • What rule changed: DeepSeek Harness Side Chat may auto-approve stock dsh read, grep, and glob only after launch proves stock ownership. Unknown owners, non-stock plugins, scoped shadows, missing tools, and unreadable composition keep the whole side turn at REJECT_ALL. Claude and goose Side Chat support from main remain intact.
  • Before -> after (what was allowed/blocked, now): This head rebases the same two patches onto fbca1a17ef. The latest main moved permission-event construction into acp/client_permissions.py; the DeepSeek owner verdict now flows through that owner. The old duplicate method was not restored. No DeepSeek, goose, or Claude grant widened.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): A stock dsh layout may lose Side Chat reads. It fails closed to REJECT_ALL. It cannot grant writes, commands, MCP calls, unknown owners, or shadowed reads.
  • Evidence checked (which sandbox result proves it): The real gate plugin is loaded by the owner tests. A stock composition proves the three read tools. A non-stock shadow plugin makes the live read reject. Missing, malformed, unknown, and scoped owner states also reject.
  • No regression:
    • Tools still work (which tools/commands were run, result): Live read, grep, and glob frames pass with stock ownership. DeepSeek write, bash, MCP, unknown-owner, and shadowed-owner calls reject. The moved permission helper builds the same events.
    • Backward compatible (old config / old data / old callers still work, how checked): The new event field defaults to an unproved composition, keeping old callers fail-closed. Non-DeepSeek backends carry no DeepSeek issue. The latest client facade tests pass.
    • Existing tests (which suites passed on this head): 553 DeepSeek Side Chat, backend-card, permission-event, and ACP facade tests passed. Black, harness parity, docs lint, and diff checks passed.
  • How to undo: Revert both PR commits to restore REJECT_ALL for DeepSeek Side Chat. Reverting only the second commit restores unsafe name-only proof and must not be used.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

@buluoray current head is 4e7b1a92d9, rebased onto fbca1a17ef. The stock-owner proof is unchanged: only dsh-owned read/grep/glob may auto-approve; unknown, non-stock, or shadowed owners keep every DeepSeek side call at REJECT_ALL. Latest main moved permission-event building into acp/client_permissions.py; the owner verdict now flows there, without restoring the old duplicate method. Fresh run: 553 owner, card, event, and facade tests passed. Full owner-proof disposition: #19745 (comment). Please re-review this head after CI turns green.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 076828c
  • What rule changed: DeepSeek Harness Side Chat may auto-approve stock dsh read, grep, and glob only after launch proves stock ownership. Unknown owners, non-stock plugins, scoped shadows, missing tools, and unreadable composition keep the whole side turn at REJECT_ALL. Claude and goose Side Chat support from main remain intact.
  • Before -> after (what was allowed/blocked, now): This head keeps the same behavior as 4e7b1a92d9. It restores the DeepSeek proof field initialization lost during the client refactor rebase, and lists the moved helper field in its binding contract. No tool grant changed.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): A stock dsh layout may lose Side Chat reads. It fails closed to REJECT_ALL. It cannot grant writes, commands, MCP calls, unknown owners, or shadowed reads.
  • Evidence checked (which sandbox result proves it): The real gate plugin is loaded by the owner tests. A stock composition proves the three read tools. A non-stock shadow plugin makes the live read reject. Missing, malformed, unknown, and scoped owner states also reject.
  • No regression:
    • Tools still work (which tools/commands were run, result): Live read, grep, and glob frames pass with stock ownership. DeepSeek write, bash, MCP, unknown-owner, and shadowed-owner calls reject. The moved permission helper builds the same events.
    • Backward compatible (old config / old data / old callers still work, how checked): The event field defaults to an unproved composition, keeping old callers fail-closed. Non-DeepSeek backends carry no DeepSeek issue. The client protocol now declares the field again.
    • Existing tests (which suites passed on this head): 54 DeepSeek Side Chat and client-binding tests passed after the fix. Targeted mypy and Black checks pass. The prior head also passed 553 owner, card, event, and facade tests.
  • How to undo: Revert both PR commits to restore REJECT_ALL for DeepSeek Side Chat. Reverting only the second commit restores unsafe name-only proof and must not be used.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

@buluoray current head is 076828c247. The stock-owner proof is unchanged: only dsh-owned read/grep/glob may auto-approve; unknown, non-stock, or shadowed owners remain REJECT_ALL. This push fixes two rebase-only client-split gaps: _deepseek_read_only_issue is initialized on AcpClient, and client_permissions.py lists that field in its owner contract. Fresh checks: 54 focused tests, targeted mypy, and Black pass. Full owner-proof disposition: #19745 (comment). Please re-review this head after CI turns green.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 375fa72
  • What rule changed: DeepSeek Harness Side Chat may auto-approve stock dsh read, grep, and glob only after launch proves stock ownership. Unknown owners, non-stock plugins, scoped shadows, missing tools, and unreadable composition keep the whole side turn at REJECT_ALL. Claude, KAS and goose Side Chat support from main remain intact.
  • Before -> after (what was allowed/blocked, now): Same behavior as 076828c247. Rebased onto e6e88d78a7, where main moved _extract_tool_event from acp/client.py into acp/client_tool_events.py; the PR's same-id blanking for dsh tool-call ids is carried into the moved function unchanged. No tool grant changed.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): A stock dsh layout may lose Side Chat reads. It fails closed to REJECT_ALL. It cannot grant writes, commands, MCP calls, unknown owners, or shadowed reads.
  • Evidence checked (which sandbox result proves it): The real gate plugin is loaded by the owner tests. A stock composition proves the three read tools; a non-stock shadow plugin makes the live read reject; missing, malformed, unknown and scoped owner states reject. Removing the same-id blanking in the moved function makes test_two_calls_under_one_id_are_not_read_as_the_read[write-read] and [bash-grep] fail, so the port is pinned.
  • No regression:
    • Tools still work (which tools/commands were run, result): Live read, grep, and glob frames pass with stock ownership. DeepSeek write, bash, MCP, unknown-owner and shadowed-owner calls reject.
    • Backward compatible (old config / old data / old callers still work, how checked): Non-DeepSeek backends never reach the blanking branch; the client-tool-event suite passes on this head.
    • Existing tests (which suites passed on this head): 787 targeted tests (side_readonly deepseek/kas/goose, backend_cards, harness_parity, acp_client_tool_events, acp_deepseek_backend, harness_tool_names, hooks). Black, file-line-cap, comment-history, sync-io, subprocess-encoding, harness-parity, feature-map and docs_lint gates pass.
  • How to undo: Revert both PR commits to restore REJECT_ALL for DeepSeek Side Chat. Reverting only the second commit restores unsafe name-only proof and must not be used.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

@buluoray current head is 375fa72394, rebased onto e6e88d78a7. Your review on e4833be748 (no inline threads; all points are in the review body), point by point:

  • Blocking (name-only read proof): fixed in fix(side-chat): approve dsh reads only when stock dsh owns the tools. The gate's load marker now records the composition (every loader entry and module, plus where each of read/grep/glob is registered). tool_gate.deepseek_read_only_owner_issue allows READ_ONLY only when every composed entry is stock dsh code (or a loader built-in, or Crew's gate), each name is held by the global layer with no scoped layer, and the stock package that registers it is active. Any non-stock plugin, scoped shadow, missing tool or unreadable field keeps the side turn on REJECT_ALL. A per-agent scope is invisible at load, so the rule is "stock-only composition", as you suggested.
  • Non-blocking (same-id blanking unpinned): test_two_calls_under_one_id_are_not_read_as_the_read now uses absolute targets. I re-checked on this head: with the blanking removed, both [write-read] and [bash-grep] fail.
  • This rebase: main moved _extract_tool_event into acp/client_tool_events.py; the blanking hunk is ported there unchanged. No other behavior change.
  • Not verified (unchanged): no live dsh session on this host; frame shapes come from the committed capture.

Ready for your re-review.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 09aa02e
  • What rule changed: DeepSeek Harness Side Chat may auto-approve stock dsh read, grep, and glob only after launch proves stock ownership. Unknown owners, non-stock plugins, scoped shadows, missing tools, and unreadable composition keep the whole side turn at REJECT_ALL. Claude, KAS and goose Side Chat support from main remain intact.
  • Before -> after (what was allowed/blocked, now): Same behavior as 375fa72394. Clean rebase onto 213339f671 (ci: fix two reds on main (codeql max-parallel, test import) #20702, which fixes main's codeql max-parallel red); no file overlap with main's new commits. No tool grant changed.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): A stock dsh layout may lose Side Chat reads. It fails closed to REJECT_ALL. It cannot grant writes, commands, MCP calls, unknown owners, or shadowed reads.
  • Evidence checked (which sandbox result proves it): The real gate plugin is loaded by the owner tests. A stock composition proves the three read tools; a non-stock shadow plugin makes the live read reject; missing, malformed, unknown and scoped owner states reject. The same-id blanking in acp/client_tool_events.py is pinned by test_two_calls_under_one_id_are_not_read_as_the_read (fails with the blanking removed).
  • No regression:
    • Tools still work (which tools/commands were run, result): Live read, grep, and glob frames pass with stock ownership. DeepSeek write, bash, MCP, unknown-owner and shadowed-owner calls reject.
    • Backward compatible (old config / old data / old callers still work, how checked): Non-DeepSeek backends never reach the DeepSeek branches; the client-tool-event suite passes on this head.
    • Existing tests (which suites passed on this head): 396 targeted tests (side_readonly_deepseek, backend_cards, harness_parity, acp_client_tool_events, acp_deepseek_backend, workflow_matrix_max_parallel).
  • How to undo: Revert both PR commits to restore REJECT_ALL for DeepSeek Side Chat. Reverting only the second commit restores unsafe name-only proof and must not be used.

buluoray
buluoray previously approved these changes Oct 15, 2026

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

Verdict: APPROVE at 09aa02e223 (re-review of my CHANGES_REQUESTED on e4833be748)

What it does for users

Side Chat on the DeepSeek Harness can now run file reads and searches (read, grep, glob on an absolute path). Before this, every call was refused. Anything that changes something is still refused.

My blocking finding is fixed

On e4833be748 the read-only proof trusted only the tool's name. A plugin composed from the operator's own dsh config could register its own read and get it approved. Now:

  • The gate plugin's load marker records the composition after appReady, once every loader entry has settled. That means every enabled loader entry (id, module, fiber state), plus, for each read name, whether the global layer holds it and whether any scoped layer shadows it (kiro_crew_tool_gate.mjs:153-187, written at :335). Any shape the plugin cannot read is recorded as null. An unknown scoped-layer shape counts as a shadow (has?.(name) !== false).
  • deepseek_read_only_owner_issue (agent_sdk/tool_gate.py:1015-1067) returns an issue unless all of the following hold:
    • every entry is a bare @deepseek-ai/ package that is not one of the two code-hosting runners, a loader built-in, or Crew's own gate;
    • each name is held globally and not shadowed in any scoped layer;
    • its stock owner (platform/tool_names.py:228-232) is composed and active.
  • The result is recorded per launch (acp/harness/deepseek.py:456-478, called at :635, after the existing marker check and only when it passes). The client default is non-empty (acp/client.py:849), so a session that never recorded a proof refuses. A marker that is not a dict already fails gate_marker_issue.
  • When there is an issue, two independent guards refuse:
    • build_permission_event leaves deepseek_tool_name empty (acp/_dispatch.py:2632-2637);
    • _resolve_permission rejects the call outright on a READ_ONLY turn, before any other read-only proof (llm_helpers.py:3520-3533). The provider carries the field across (providers/acp.py:2680-2682).
  • Every path fails closed: missing fields, a non-stock entry, a shadow, an inactive owner, an unread composition.

Mutations (one at a time, restored and git status clean between runs)

Removed Red test
whole owner check (return "") 11 tests, including test_a_shadowing_plugin_keeps_the_side_turn_reject_all and all test_the_read_proof_refuses_a_composition_it_cannot_vouch_for[*]
code-host-runner exclusion ...cannot_vouch_for[host_runner]
stock-scope regex [path_plugin], [dotdot_spec], [host_runner], test_a_shadowing_plugin_keeps_the_side_turn_reject_all
scoped-shadow check [scoped]
owner-active check [owner_failed]
recording the issue at launch the same 11 as the whole owner check
non-empty client default test_an_unproved_session_refuses_every_side_turn_call[read]
llm_helpers refusal and _dispatch blanking together test_a_shadowing_plugin_keeps_the_side_turn_reject_all, test_an_unproved_session_refuses_every_side_turn_call[read]

The composition tests load the real gate plugin under node, so node must be on PATH. Without node they are skipped, not failed.

Nothing else regressed

  • 1078 passed across test_side_readonly_{deepseek,kas,goose,claude}.py, test_acp_deepseek_backend.py, test_hooks.py, test_backend_cards.py, test_harness_parity.py, test_acp_tool_gate.py, test_llm_helpers_tool_gate.py, test_member_mount_deepseek.py. I confirmed the worktree's tool_gate.py was the one imported.
  • The first commit's range-diff against a65373db60 is only the rebase: it moved into client_tool_events.py and merged with the claude harness_builtin_tool field. The gate_tiers.py change in the fix commit is formatting only. The plugin digest pin was updated together with the plugin (deepseek.py:105).
  • My earlier follow-up is done: the same-id test now uses an absolute target (test_side_readonly_deepseek.py:313).
  • Spec updated in the same PR: side.md (ownership rule, REJECT_ALL fallback) and H6 in harness-parity.md.

Non-blocking follow-ups

  • The llm_helpers refusal and the _dispatch name blanking cover each other. Removing either one alone keeps the suite green, and only removing both goes red. A test that drives one guard without the other would pin each separately.
  • The composition is proved on the read-back probe boot, not on the session's own boot. Any config change between the two goes unseen. The gate proof on main has the same gap, so this PR does not widen it.

Not verified

  • dsh is not installed on the review host. I did not check against real dsh:
    • which stock @deepseek-ai/ packages can run operator-supplied code, beyond the two runners the PR excludes;
    • that entry.options.name is always the specifier the loader resolved;
    • that a bare @deepseek-ai/* specifier cannot resolve to a file the operator controls.
      The proof rests on these.
  • No live dsh session was run. Frame shapes come from the committed capture.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: f32d7f6
  • What rule changed: DeepSeek Harness Side Chat may auto-approve stock dsh read, grep, and glob only after launch proves stock ownership. Unknown owners, non-stock plugins, scoped shadows, missing tools, and unreadable composition keep the whole side turn at REJECT_ALL. Claude, KAS and goose Side Chat support from main remain intact.
  • Before -> after (what was allowed/blocked, now): Same behavior as 09aa02e223. Rebased onto 0694e63a87 (includes test(providers): list approval_withdrawable and approve_tool's new signature #20902 and refactor(providers): bind AcpProvider members from five owner modules #20838). refactor(providers): bind AcpProvider members from five owner modules #20838 moved AcpProvider's event conversion from providers/acp.py into providers/acp_turns.py (_to_llm_event), so the PR's two forwarded fields (deepseek_tool_name, deepseek_read_only_issue) now sit there; providers/acp.py is identical to main. The two docs conflicts (feature map Side chat row, harness-parity H6) keep main's new module paths plus the PR's DeepSeek wording. No tool grant changed.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): A stock dsh layout may lose Side Chat reads. It fails closed to REJECT_ALL. It cannot grant writes, commands, MCP calls, unknown owners, or shadowed reads.
  • Evidence checked (which sandbox result proves it): The real gate plugin is loaded by the owner tests. A stock composition proves the three read tools; a non-stock shadow plugin makes the live read reject; missing, malformed, unknown and scoped owner states reject. test_side_readonly_deepseek.py passes on this head, which proves both fields still reach the gate through the moved conversion.
  • No regression:
    • Tools still work (which tools/commands were run, result): Live read, grep, and glob frames pass with stock ownership. DeepSeek write, bash, MCP, unknown-owner and shadowed-owner calls reject.
    • Backward compatible (old config / old data / old callers still work, how checked): Non-DeepSeek backends never reach the DeepSeek branches; the new event field defaults to an unproved composition, so old callers stay fail-closed.
    • Existing tests (which suites passed on this head): test_side_readonly_deepseek, test_hooks, test_backend_cards, test_harness_parity, test_acp_bindings (615 passed); test_gate_tiers, test_tool_gate_queue_bound, all test_llm_helpers*, all test_side_readonly* (752 passed, 1 skipped). ruff clean on touched Python files.
  • How to undo: Revert both PR commits to restore REJECT_ALL for DeepSeek Side Chat. Reverting only the second commit restores unsafe name-only proof and must not be used.

buluoray
buluoray previously approved these changes Oct 15, 2026

@buluoray buluoray 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 after the rebase. Compared against the head I approved (09aa02e): the deepseek ownership gate is unchanged. The deepseek_tool_name / deepseek_read_only_issue copies moved with main's split into providers/acp_turns.py and still sit in the same event-forwarding call beside kas_builtin_ids (acp_turns.py:93-96), so a side turn still carries both fields. The other differences are feature-map and H6 context from main. CI is green.

Joe Guo added 2 commits October 16, 2026 19:35
A READ_ONLY turn approved any non-MCP dsh tool named read, grep or
glob on its name alone. A plugin from the operator's own dsh config can
register a tool under one of those names, so the name proved nothing.

The gate plugin's load marker now lists every enabled loader entry and
where each read name is registered. The launch records whether every
entry is stock dsh code and the stock tool packages own the names.
Until that holds, every deepseek side turn is REJECT_ALL.
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 474ff86
  • What rule changed: DeepSeek Harness Side Chat may auto-approve stock dsh read, grep, and glob only after launch proves stock ownership. Unknown owners, non-stock plugins, scoped shadows, missing tools, and unreadable composition keep the whole side turn at REJECT_ALL. Claude, KAS and goose Side Chat support from main remain intact.
  • Before -> after (what was allowed/blocked, now): Same behavior as f32d7f6287. Rebased onto e7b47fe3a6 and dropped the merge commit, so the PR is two commits again. Main moved the AcpClient class body from acp/client.py into acp/client_class.py, so the PR's _deepseek_read_only_issue default (fail-closed string) now sits there beside _deepseek_gate_nonce; acp/client.py is identical to main. The harness-parity H6 conflict keeps main's new opencode steer text plus the PR's DeepSeek wording. No tool grant changed.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): A stock dsh layout may lose Side Chat reads. It fails closed to REJECT_ALL. It cannot grant writes, commands, MCP calls, unknown owners, or shadowed reads.
  • Evidence checked (which sandbox result proves it): The real gate plugin is loaded by the owner tests. A stock composition proves the three read tools; a non-stock shadow plugin makes the live read reject; missing, malformed, unknown and scoped owner states reject. test_side_readonly_deepseek.py passes on this head, which proves the moved client default still reaches the gate.
  • No regression:
    • Tools still work (which tools/commands were run, result): Live read, grep, and glob frames pass with stock ownership. DeepSeek write, bash, MCP, unknown-owner and shadowed-owner calls reject.
    • Backward compatible (old config / old data / old callers still work, how checked): Non-DeepSeek backends never reach the DeepSeek branches; the client default is an unproved composition, so old callers stay fail-closed.
    • Existing tests (which suites passed on this head): test_side_readonly_deepseek, test_backend_cards, test_hooks, test_harness_parity (468 passed); every test matching client_class, acp_client, line_budget, module_size (890 passed, 2 skipped).
  • How to undo: Revert both PR commits to restore REJECT_ALL for DeepSeek Side Chat. Reverting only the second commit restores unsafe name-only proof and must not be used.

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

Approved via bulk merge run: no failing checks on the current revision.

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.

3 participants