# When an agent is waiting on you

An agent that asks you a question, wants a permission, or shows a plan to approve stops until you answer. Other agents
that send it work meanwhile used to pile their messages into its queue, unseen, and the whole chain stood still behind
one question nobody had noticed. Fleetlayer now refuses those messages by default, tells the sender what the agent is
waiting on, and shows you that others are waiting too.

## What the sender sees

A message to a session waiting on its person is refused (`fleetlayer msg send` exits with code 75; the MCP tool
`msg_send` answers with the same text; the protocol code is `-32017` "blocked"):

```
fleetlayer: infra@agents is waiting on its person since 09:30 UTC: a Bash permission prompt (`terraform apply`).
Your message wasn't sent. You can: send it anyway, to wait in its queue (--queue, or queue: true); hear when it frees
up (fleetlayer watch --session infra@agents --status idle,done,working); or, if the work can't wait, start a session
with a similar role (fleetlayer session start, briefed, in its own worktree or on other files so the two don't
overlap) and leave this one a note of what you handed off (--queue), so it doesn't do it again.
```

- **Send it anyway:** `fleetlayer msg send --queue …` (MCP: `queue: true`). It waits in the session's queue and goes in
  once the session takes input again, as every message used to.
- **Wait for it:** `fleetlayer watch --session infra@agents --status idle,done,working` tells you once it's moving.
- **Hand the work to another session:** when it can't wait, start a session with a similar role and brief it. Keep the
  two apart (another worktree, other files) and leave the waiting session a note (`--queue`) of what was handed off.

What isn't refused:

- **Your own words.** What you type, say from the phone, a page's chat or the dashboard, and your answers to its
  prompts, always go in.
- **What a session asked for itself:** a watch it set firing, a notice that a session it started is done.
- **Messages a plugin relays from a person** (a Slack mention): they wait in its queue.

Events on channels the session subscribes to (CI results, alerts) aren't queued behind the question either: they're
kept as missed, and `fleetlayer events` catches it up once it's free. A scheduler entry that fires meanwhile waits and
tries again every minute, as for any session busy with its person (an entry can say to skip instead).

## How you hear about it

The session's prompt shows on the deck, the phone and the dashboard, with what it asks and who asks (a subagent, a
fork). When others have been refused meanwhile, the session says so (`meta.refusedWhileBlocked`: how many, from whom
last, and when), so you can see the prompt holds up more than one agent. Answer it there, or in its terminal.

## Turn it off for a node or a role

A role is a Unix user with a node of its own, so the setting is per node, in its `node.yaml`:

```yaml
blocked_messages: queue    # refuse (the default) or queue: typed in to wait, as before
```

## Stop agents asking blocking questions at all

Most stuck chains start with a question the agent didn't need to ask. Take the tool away:

- **Claude Code:** deny its question tool in the settings it loads (`~/.claude/settings.json` for everything, or a
  project's `.claude/settings.json`):

  ```json
  { "permissions": { "deny": ["AskUserQuestion"] } }
  ```

  The tool is then not loaded at all, and the agent asks in plain text and ends its turn (checked on Claude Code
  2.1.333: asked to use the tool, the agent says it isn't available and asks in its reply). A session that ended its
  turn reads as idle or done, not blocked, so messages to it go in. `ExitPlanMode` (a plan to approve) can be denied
  the same way.
- **Permission prompts** are the other half: an agent in Claude Code's default mode asks before most commands. Allow
  what your agents run all the time (`permissions.allow`), use auto mode, or give an unattended role bypass mode with
  a guard hook ([Unattended agents](https://fleetlayer.ai/docs/guides/unattended-agents.md)).
- **pi and Codex:** their permission prompts follow their own settings (approval policies, allowed commands). If your
  version has a tool that stops a turn to ask you something, turn it off in its settings the same way; the
  instructions below work whatever the harness.
- **Instructions:** tell your agents, in their CLAUDE.md or AGENTS.md, to make common-sense decisions themselves and
  ask only what only you can decide, in their reply rather than with a question tool. It's softer than a deny rule, but
  it works for every harness.
