fix(coding-agent): corrected tool resolution and conditional auto-qa session config

- Replaced getTool with getExecutableTool in CursorExecBridgeOptions to prioritize mounted-device permission wrappers over canonical tools.
- Updated createAgentSession to check isAutoQaEnabled against restricted tool filtering when configuring system prompts.
- Added test coverage verifying execution overrides preserve approval gates and restricted sessions omit auto-qa guidance.
This commit is contained in:
can1357
2026-07-28 03:41:04 +02:00
parent 78ac03f30b
commit e7558e37e7
5 changed files with 36 additions and 9 deletions
@@ -149,8 +149,8 @@ describe("CursorExecHandlers mounted tool bridge", () => {
};
const handlers = new CursorExecHandlers({
cwd: ".",
tools: new Map(),
getTool: name => (name === mountedTool.name ? mountedTool : undefined),
tools: new Map([[mountedTool.name, mountedTool]]),
getExecutableTool: name => (name === mountedTool.name ? mountedTool : undefined),
});
const result = await handlers.mcp({
@@ -187,8 +187,10 @@ describe("CursorExecHandlers mounted tool bridge", () => {
const settings = Settings.isolated({ "tools.approval": { ast_edit: "deny" } });
const handlers = new CursorExecHandlers({
cwd: ".",
tools: new Map(),
getTool: name => (name === device.name ? (wrapped as unknown as AgentTool) : undefined),
// The canonical map contains the undecorated mounted tool. The execution
// override must win or Cursor bypasses the approval gate.
tools: new Map([[device.name, device]]),
getExecutableTool: name => (name === device.name ? (wrapped as unknown as AgentTool) : undefined),
getToolContext: () => ({ settings }) as AgentToolContext,
});