qoder agents sdk “canUseTool” is not invoked for observed tool_use with permissionMode: "default"`

Issue Description

When using the public @qoder-ai/qoder-agent-sdk, a tool call can occur without invoking the configured canUseTool callback.

This blocks safe ACP integration: an ACP client cannot receive a permission request, approve or deny the operation, or correlate the operation with
Qoder’s toolUseID.

The reproduction uses:

  • permissionMode: “default”
  • settingSources:
  • tools: [“Read”]
  • canUseTool configured to deny every tool call
  • A disposable temporary workspace containing only a random UUID

No project files, credentials, tool inputs, or tool outputs are logged.

Steps to Reproduce

Create a Node.js project with:

npm install @qoder-ai/qoder-agent-sdk@1.0.50
Ensure local Qoder CLI authentication is available.
Run this script:

import { randomUUID } from “node:crypto”;
import { mkdtemp, rm, writeFile } from “node:fs/promises”;
import { tmpdir } from “node:os”;
import { join } from “node:path”;
import { qodercliAuth, query } from “@qoder-ai/qoder-agent-sdk”;

const cwd = await mkdtemp(join(tmpdir(), “qoder-permission-”));
await writeFile(join(cwd, “probe.txt”), randomUUID(), “utf8”);

let permissionRequested = false;
let resultSubtype: string | undefined;
const eventTypes: Record<string, number> = {};
const blockTypes: Record<string, number> = {};

try {
for await (const message of query({
prompt: [
“Use the Read tool to read the unpredictable UUID in probe.txt,”,
“then return that UUID exactly. Do not use any other tool.”,
].join(" "),
options: {
auth: qodercliAuth(),
cwd,
settingSources: ,
permissionMode: “default”,
tools: [“Read”],
maxTurns: 2,
canUseTool: async (_toolName, _input, options) => {
permissionRequested = Boolean(options.toolUseID);

       return {
         behavior: "deny",
         message: "probe",
         toolUseID: options.toolUseID,
       };
     },
   },
 })) {
   eventTypes[message.type] = (eventTypes[message.type] ?? 0) + 1;

   if (message.type === "assistant" && Array.isArray(message.message.content)) {
     for (const block of message.message.content) {
       blockTypes[block.type] = (blockTypes[block.type] ?? 0) + 1;
     }
   }

   if (message.type === "result") {
     resultSubtype = message.subtype;
   }
 }

} finally {
await rm(cwd, { recursive: true, force: true });
}

console.log({
permissionRequested,
resultSubtype,
eventTypes,
blockTypes,
});

Expected Behavior

Because permissionMode is set to “default” and canUseTool is provided:

  1. Qoder should invoke canUseTool(“Read”, input, options) before executing Read.
  2. options.toolUseID should be a nonempty string.
  3. The callback’s deny response should prevent the tool execution.
  4. The host application should be able to surface this decision to its own permission UI.

Actual Behavior

The SDK emits an assistant tool_use block, proving a tool call occurred, but canUseTool is never invoked.

Observed safe event summary:
{
“permissionRequested”: false,
“resultSubtype”: “success”,
“eventTypes”: {
“system”: 6,
“command_lifecycle”: 3,
“assistant”: 5,
“user”: 1,
“result”: 1
},
“blockTypes”: {
“thinking”: 2,
“text”: 2,
“tool_use”: 1
}
}
This occurred with isolated settings (settingSources: ), so it is not caused by inherited user, project, or local permission rules.

Screenshots / Screen Recordings

Not applicable. This is a programmatic SDK reproduction.

Operating System

macOS, arm64

Current Qoder Version (Menu → About Qoder → Copy)

  • Qoder CLI: 1.1.65
  • Qoder Agent SDK: @qoder-ai/qoder-agent-sdk@1.0.50
  • Node.js: 22.22.2