Compare commits

...

2 Commits

Author SHA1 Message Date
Jiang Bohan
3b75d1ad92 refactor(daemon): drop CLAUDE.md AskUserQuestion guidance, rely on --disallowedTools
The --disallowedTools flag already prevents Claude from invoking
AskUserQuestion, so duplicating the rule in the runtime brief just bloats
the prompt without changing behavior. Removes the section and its
regression test; the argv-level test in pkg/agent already pins the flag.

Co-authored-by: multica-agent <github@multica.ai>
2026-05-15 12:41:16 +08:00
Jiang Bohan
5a7c238421 fix(daemon): disable Claude AskUserQuestion in non-interactive mode (MUL-2244)
GitHub #2588: when Claude Code calls its built-in AskUserQuestion tool
inside the daemon's stream-json runtime, the question never reaches the
user — there's no UI to render it — so the SDK returns an empty answer
and the agent silently "infers" and continues. From the issue's
perspective, execution looks stuck while the agent is actually charging
ahead on its own guess.

Two-part fix:

- `buildClaudeArgs` now passes `--disallowedTools AskUserQuestion` so
  the tool is not exposed to the model at all.
- The Claude-specific runtime brief tells the agent to use a `blocked`
  issue comment for genuine clarification, or to state an explicit
  assumption and proceed.

Adds a regression test that pins both: AskUserQuestion is forbidden in
CLAUDE.md and is NOT mentioned in the AGENTS.md emitted for non-Claude
providers (the tool is Claude-specific).

Co-authored-by: multica-agent <github@multica.ai>
2026-05-15 12:29:22 +08:00
2 changed files with 8 additions and 0 deletions

View File

@@ -421,6 +421,13 @@ func buildClaudeArgs(opts ExecOptions, logger *slog.Logger) []string {
"--verbose",
"--strict-mcp-config",
"--permission-mode", "bypassPermissions",
// AskUserQuestion is Claude Code's built-in interactive question tool.
// The daemon runs Claude in non-interactive stream-json mode and has
// no UI for the prompt to render in, so a call returns an empty
// answer and the agent ends up "inferring" silently — the user
// never sees the question (see GitHub #2588). User-facing
// clarification belongs in an issue comment instead.
"--disallowedTools", "AskUserQuestion",
}
if opts.Model != "" {
args = append(args, "--model", opts.Model)

View File

@@ -210,6 +210,7 @@ func TestBuildClaudeArgsIncludesStrictMCPConfig(t *testing.T) {
"--verbose",
"--strict-mcp-config",
"--permission-mode", "bypassPermissions",
"--disallowedTools", "AskUserQuestion",
}
if len(args) != len(expected) {