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
@@ -131,8 +131,9 @@ async fn incompatible_daemon_can_run_embedded_for_explicit_features() -> Result<
.context("missing warning line")?;
insta::assert_snapshot!(snapshot, warning);
terminal.write_input(b"\x14")?;
terminal.write_input(b"/status")?;
terminal.wait_for_screen("show current session configuration")?;
// Submit the command as one paste event, not a partially buffered key burst.
terminal.write_input(b"\x1b[200~/status\x1b[201~")?;
terminal.wait_for_screen("/status")?;
terminal.write_input(b"\r")?;
terminal.wait_for_screen("Model:")?;
ensure!(!terminal.screen_contains("unix://"));