Repository navigation
feat(acp): let clients turn tools off per session through _meta - #1915
Conversation
A client can send _meta {"nanocoder/disabledTools": [...]} on session/new, session/load and session/resume. The names are merged with the user's global disabledTools for that session only: the tools are left out of the tool list and system prompt, a forced call to one is refused before anything runs, and the session's subagents get the same list. The effective list is reported back in the response _meta, unknown names are ignored with a debug log, and nothing is persisted or written to the user's config.
nc-review: comments — 2 important, 1 nit@addyCooks — a few things worth a look, none blocking. The PR adds a per-session disabled-tools list for ACP clients, delivered through 🟠 important ·
for (const name of session.disabledTools) {
if (!this.initContext.toolManager.hasTool(name)) {
logger.debug(`ACP session ${session.sessionId}: ignoring unknown disabled tool "${name}"`);
}
}
return {[ACP_DISABLED_TOOLS_META]: session.effectiveDisabledTools()};
🟠 important · In the new test 'AcpAgent - an unknown or malformed disabled tool is ignored, with a debug log', this assertion is flaky: t.false(lines.some(line => line.includes('42')));The captured line is the one The assertion also does not test what it claims: the ⚪ nit ·
🔴 blocking · 🟠 a reviewer would ask for a change · ⚪ optional Automated code review — correctness, security, design, tests, plus duplicates and scope. A human still decides; this is not a substitute for review and is not exhaustive. The required status checks separately cover lint, formatting, types, unused dependencies, the test suite and the build. This bot never merges. Maintainers can rerun with |
Resolves the conflicts with Nano-Collective#1913 (subagent lifecycle events), which touched the same ACP agent, subagent executor and spec files. The subagent now reads the session's mode and disabled tools from one bridge lookup before it announces itself. Also addresses the nc-review comments: the response reports only the tools actually in effect (unknown names are logged and left out), the unknown-tool test no longer matches a substring of a random UUID, and the refusal re-reads the session's list live, as the mode is.
Resolves the conflicts with the per-session tool registry (Nano-Collective#1914) and disabled tools (Nano-Collective#1915) on main: a session now builds its prompt with its own tool manager, provider and model, and keeps its disabled tools when it is created or loaded. Also addresses the nc-review comments: aggressive compaction is now a per-session preset passed to auto-compact instead of the process-wide one, so one session switching provider cannot change when another compacts; switching to a provider that lists no models gives the session that provider's (empty) model instead of the previous provider's, and does not record it as the last-used selection; and the mid-turn test now observes the prompt rebuild directly.
Description
Closes #1890
An ACP client can now turn tools off for a single session by sending
_meta: {"nanocoder/disabledTools": [...]}onsession/new,session/loadorsession/resume.disabledTools. It never replaces it.Error: <tool> is disabled in this sessionand nothing runs. Before this, the loop only checked that the tool existed, so a forced call would have run._metaunder the same key, so a client can confirm it was honoured.getAlwaysAllowedTools(the approval policy reported in the same responses) now takes the session's list, so a client is not told a tool is pre-approved in a session where it is disabled.docs/features/acp.mdanddocs/configuration/index.md.Type of Change
Changeset
.changeset/acp-session-disabled-tools.md, minor)Testing
Automated:
acp-capabilities.spec.ts)._meta(acp-agent.spec.ts).acp-conversation.spec.ts).subagent-executor.spec.ts).acp-approval.spec.ts).mainin this Windows environment.Manual:
Checklist
biome check .is clean)main