Repository navigation
fix(assistant): limit discovery session tools to a read-only set - #6253
florianaltendorfer wants to merge 3 commits into
Conversation
Astro-Han
left a comment
There was a problem hiding this comment.
Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.
Reviewed 61873698bd60eb9e9095ad577018ac99ad24e658 against a509747d6779b27ee60e4d1ff044bc6ba8fcc5ca (5 files, +81/−2). I found no P0–P2 issues in this change.
The discovery-session filter now runs over the complete tool catalog in both execution composition and tool-name listing, after built-in, client and dynamic plugin tools have been assembled. In assistant/index-initiative/host.ts, assistant tools are limited to DISCOVERY_TOOLS; other tools use the existing Plan-mode read/web-read classification. The restriction is scoped to the stored discovery Session and retains its report/context tools.
Fresh dependencies and patches, normal root npm run build:test, 54 assistant/composer tests, changed-file Biome checks, ASF headers, and the protocol guard passed (epoch 227, no protocol/schema changes). The actual assistant-service/composer regression includes built-in Bash/Edit/Write plus foreign read, mutating and untyped tools. Restoring either the base composer or base initiative module exposes forbidden tools and prevents that regression from completing. This verifies catalog enforcement; I did not run an adversarial live model or a real third-party plugin.
The exact-head CI run required workflow authorization; after checking this source/test-only diff, I authorized that workflow run. Its test result is still pending, so this review does not claim CI is green.
CI update for I reran the failed job once. Attempt 3 has now passed on this same commit. The earlier pending-CI limitation is resolved; the first failure's cause has not been independently reproduced on main. |
6187369 to
2097d05
Compare
Astro-Han
left a comment
There was a problem hiding this comment.
Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.
Reviewed the complete five-file diff at 2097d051717f51c2b4345ce245812310ab506204 against current main 15d0a0dd1 (84 additions, 7 deletions), and compared the rebased commit series with 61873698. The previous merge conflict is resolved. The rebase preserves main's mandatory filter registration and DISCOVERY_EXCLUDED_TOOLS restriction, then applies the complete-catalog read-only filter. It also retains MatterOverview, whose existing implementation is a read operation, alongside the discovery report/context and permitted Memory tools.
I found no new P0–P2 issue in this revision. The actual assistant service and interactive composer produce a discovery catalog containing Read/Grep/Glob, the foreign read tool, MatterOverview and the allowed report/Memory tools, while excluding Bash/Edit/Write, mutating or untyped foreign tools and assistant mutation tools. Loading only main's composer or only main's initiative module re-exposes Bash and other prohibited tools and makes the same catalog check fail. Those checks run outside the worker callback so a forbidden catalog produces a direct assertion failure rather than a caught callback error followed by a timeout.
A fresh patched install and the normal clean root build:test passed. Of 114 assistant, initiative-boundary, execution-composition, composer and Matter-settlement tests, 113 passed. The remaining live Bash sandbox case fails because this environment reports Command sandbox is required but unavailable on platform linux. An isolated rerun with main's execution-composition implementation produces the same error; this does not establish a regression caused by the PR. Changed-file Biome, diff checks and the protocol guard passed. There is no protocol/schema change, and the current epoch remains 228. The static merge is clean.
Current-head CI 40064218014 initially required fork-workflow authorization. After checking this source/test-only diff, I authorized that CI workflow; its test job is now running. This review does not claim CI success or release readiness. I did not run a live discovery model, a real third-party plugin, native Desktop E2E or the full workspace suite. Plugin tool classification still trusts the declared category, as Plan mode does.
5aa45ba to
fe8b646
Compare
|
Automated reply from the contributor's coding agent. Rebased onto main (conflict in |
fe8b646 to
bc30236
Compare
Generated-by: Claude Code
Generated-by: Claude Code
Generated-by: Claude Code
bc30236 to
98f3293
Compare
Summary
Closes #6250.
The discovery session is registered as a background session and has no tool ceiling. On main,
DISCOVERY_EXCLUDED_TOOLSalready drops the known assistant write and control tools (MatterAdopt,MatterControl,MemoryIndexWrite, ...). That list is only applied to the assistant catalog, though, and only removes names that are on it. The composer still gives the session the full default Host catalog, including Bash, Edit, Write, subagents and mutating plugin tools.The fix applies a read-only allowlist to the complete catalog in the Host:
filterToolsand applies it to the complete composed catalog, built-in tools included.execution-compositionwiresPersonalAssistantService.filterToolsinto it and into the tool-name listing. Most existing assistant filters only drop assistant names, so those sessions are unchanged. The exception is the quick-discovery worker. Its existing filter keeps onlyreadtools and a few named ones, and it now applies to the built-in tools too. That worker therefore also loses Bash, Edit, Write, AskUserQuestion, Skill, the todo tools and other untyped or mutating built-ins. This matches its read-only role.DISCOVERY_EXCLUDED_TOOLScheck and also limits assistant tools to the newDISCOVERY_TOOLSallowlist:DiscoveryContext,DiscoveryDraft,MatterOverviewand the read-only Memory tools. All other tools go through the same read-only rule as Plan mode (read/web_readcategory). Read, Grep, Glob, WebFetch, WebSearch and plugin tools declared asreadstay. Bash, Edit, Write, subagents, client capabilities and untyped or mutating plugin tools are removed.operations.jsondraft, and the heartbeat would fail before judgement. The newDiscoveryDrafttool takes{ notes }and writes only the current heartbeat's exploration result file. It rejects calls from any session other than the discovery session, and calls made while no discovery draft is open. The exploration wake prompt now points to it.memory_remember/memory_extractafter the composed catalog, so the session filter never saw them.PersonalAssistantService.admitsMemoryTriggersruns those two names through the same session filter.execution-compositiononly passesmemoryExtractionto the backend when the filter keeps them, so discovery (and the quick-discovery worker, whose filter also drops untyped tools) gets no memory write triggers.Verification
Extended the existing discovery test in
assistant-bot.test.ts. It builds the real interactive composer with the built-in shell and edit tools plus foreign read, mutating and untyped tools, then checks the discovery session's catalog. Bash, Edit, Write and the foreign mutating tools are present without the filter and absent with it. Read, Grep, Glob, the foreign read tool and exactlyDISCOVERY_TOOLSremain. The discovery heartbeat then submits its draft throughDiscoveryDraftinstead of writing the file directly, and the run reaches judgement and delivery. The test also checks that the discovery session does not admit the memory triggers, that the owner conversation still does, and thatDiscoveryDraftis rejected outside an open discovery draft. The test fails without the change (including whenDiscoveryDraftis dropped from the allowlist) and passes with it. Runtime-host build andtypecheck, biome lint and format,npm run test:assistant, andnode --testonassistant-bot,assistant-initiative-boundary,execution-model-composition,interactive-run-composerandmatter-settlement-contextall pass.Not checked: a real desktop discovery session. Plugin tools are classified by their declared
categoryHint, the same trust Plan mode uses.AI use
Select exactly one:
Tool(s) and scope: Claude Code (Claude Opus) traced the root cause and wrote the change and test.
Checklist
Does this PR entail a change in behavior?