Allow async user messages through code mode (#63730)

## Why

Agents could send async user messages only through a top-level tool call, even in code mode.

## What changed

Set `features.send_message_to_user_async.direct_only` to `false` to make the tool follow the session's tool mode. Direct mode exposes it as a top-level tool, code mode allows both top-level and nested calls, and code-mode-only sessions require nested calls and reject direct calls. The default keeps the tool top-level only. Existing agent opt-ins still apply.

## Testing

Add integration coverage for tool visibility, call results, and message delivery across all three tool modes with both values of `direct_only`. Improve failure diagnostics in the multiline shell snapshot test and paste `/status` as a single input event in the daemon compatibility test.

GitOrigin-RevId: c69bb2fba8bf776eff01382d8869fc869fc9d479
This commit is contained in:
surajs-oai
2026-11-24 19:56:22 +00:00
committed by copyberry
parent 7015377ecd
commit 7a24022794
8 changed files with 158 additions and 17 deletions
+5 -1
View File
@@ -5070,8 +5070,12 @@
},
"SendMessageToUserAsyncConfigToml": {
"additionalProperties": false,
"description": "Controls which agents can send async user messages.",
"description": "Controls which agents can send async user messages and how they call the tool.",
"properties": {
"direct_only": {
"description": "Keep async user messages top-level only (default). Set to false to follow the session's tool mode.",
"type": "boolean"
},
"root_agent": {
"description": "Sets the root agent's feature flag, just like the plain boolean shorthand. The model catalog can still enable the tool for the root when this is false.",
"type": "boolean"