blog /

Coding Agent Idle vs Blocked: What Status Means

Say you have three agents running while you review a pull request. One terminal has gone quiet for six minutes. Is that agent done and waiting for your next prompt, or is it stuck on a permission question it will never answer alone? The coding agent idle vs blocked distinction is exactly this: idle means the turn ended and nothing needs you, blocked means progress has stopped until you answer. You tell them apart with hook events, not by staring at output.

Why idle and blocked look the same

A quiet terminal proves nothing. An agent can sit silent because it finished the turn, because a long tool call is still running, because the model API returned an error, or because a permission prompt is open and the run cannot continue. All four look identical from across the room: no new lines, a cursor that does not move.

That is why output polling misleads. The screen churns while an agent works, and a pause between steps can look like completion. You need a signal from the agent loop itself: one event that fires when the turn ends, and a different event that fires when the agent waits on you.

So define the two states by what happens next without you:

StateMeaningWhat happens if you do nothing
IdleThe turn ended. The agent waits for your next prompt.Nothing breaks. The work sits until you continue it.
BlockedThe agent waits on you: a permission ask, an approval, a question.Nothing progresses. The run stays parked until you answer.

Two more states round out the picture: working (a turn is active) and failed (the turn ended on an error). Your routing rule is simple. Working and idle never page you. Blocked and failed do.

How to detect the right event in practice

Each major agent exposes hook or plugin events that mark turn end and permission wait as separate facts. Wire one handler per fact, and never derive blocked from quiet minutes.

A minimal setup has three parts:

  1. A turn-end handler that records idle with the session id and timestamp. In Claude Code that event is Stop, in Codex it is also Stop, in OpenCode it is session.idle, and the Codex notify command currently fires only for agent-turn-complete.
  2. A permission-wait handler that records blocked with the question or command shown. In Claude Code that is PermissionRequest plus the Notification matcher permission_prompt, in Codex it is PermissionRequest, in OpenCode it is permission.asked, in Gemini CLI the Notification hook carries the alert but cannot grant anything.
  3. A resume rule: any new prompt or tool start moves the state back to working, which is the next PreToolUse or BeforeTool firing after your answer.

If you only build one of the two handlers, build the blocked one. A missing idle event costs you a glance at a finished agent. A missing blocked event costs you an agent parked for an hour. For the finished side, how to tell whether a coding agent is actually done covers verifying completion beyond the event.

Coding agent idle vs blocked in four vendor signals

The coding agent idle vs blocked split maps onto different event names per tool. Every name below comes from that tool's own docs.

AgentIdle signal (turn ended, needs nothing)Blocked signal (waits on you)Notes and limits
Claude CodeStop fires when Claude finishes respondingPermissionRequest fires when a tool call needs a permission decision; Notification matcher permission_prompt fires after a prompt has waited about six seconds; idle_prompt fires about 60 seconds after Claude finished when you have not typedagent_needs_input and agent_completed fire only while agent view is open.
Codex CLIStop at turn end; user-level notify command fires for agent-turn-completePermissionRequest runs when Codex is about to ask for approval; allow it, deny it, or stay silent and the normal prompt appears; any deny winsnotify receives the JSON payload as one command-line argument, not on stdin, and it cannot report an approval request.
Gemini CLIAfterAgent fires after the model generates its final response; the notifications setting reports "Session complete"The notifications setting reports "Action required" when the model waits for input or tool approval; the Notification hook observes the alertNotifications are experimental and off by default; set general.enableNotifications to true in settings.json. Delivery uses the OSC 9 escape with a terminal bell fallback.
OpenCodesession.idle event; a plugin event handler can notify on itpermission.asked event; throwing inside tool.execute.before blocks the callThe last matching permission rule wins. doom_loop and external_directory default to ask, .env reads ask by default, and --auto approves what would ask while explicit denies still hold.

Two shapes carry most of this. A Claude Code desktop ping on any notification:

{
  "hooks": {
    "Notification": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "osascript -e 'display notification \"Claude Code needs your attention\" with title \"Claude Code\"'"
          }
        ]
      }
    ]
  }
}

And an OpenCode plugin that separates the two facts onto two branches:

export const IdleVsBlocked = async ({ $, directory, worktree }) => {
  return {
    event: async ({ event }) => {
      if (event.type === "session.idle") {
        await $`osascript -e 'display notification "Session completed, nothing needs you" with title "opencode"'`;
      }
      if (event.type === "permission.asked") {
        await $`osascript -e 'display notification "opencode is blocked on a permission" with title "opencode"'`;
      }
    }
  }
}

Keep each vendor's handler in its own file. When a vendor renames an event, you edit one adapter instead of reworking shared logic.

What can go wrong: false positives and missing events

The events are trustworthy; your reading of them may not be. Four traps cause most wrong pages:

  1. Turn end is not task done. Stop, session.idle, and AfterAgent all mean the agent stopped writing, not that the goal is met. An agent that gave up or hit a rate limit also goes idle. Confirm against outside facts (tests, diff, the pull request) before treating idle as finished.
  2. A blocked handler that crashes fails toward the wrong side. In Claude Code a hook that exits with anything other than 2 lets the action proceed, in Gemini CLI any other exit code is a non-fatal warning and the CLI continues, and in Codex an unsupported PreToolUse answer marks the run failed and continues the call. So a guard script must trap its own errors into a block (exit 2, reason on stderr) and check that jq exists before parsing.
  3. Some signals never fire where you listen. Claude Code agent_needs_input stays silent unless agent view is open. Codex notify never reports approvals, so paging only on notify misses every permission wait. Gemini CLI notifications stay off until you flip enableNotifications.
  4. Prompt-cancel can leave stale blocked. If your latch sets blocked on permission.asked but no event reaches it when the prompt is dismissed by cancelling, the mark sticks forever. Heal it: clear a blocked mark when you next focus that pane, or when a fresh tool call starts in the same session.

One more quiet failure: duplicate pages during flapping. Debounce by waiting about a second and rechecking the state before paging, and merge several agents finishing together into one note.

When a notification should become a decision

Not every blocked event deserves an immediate answer. Sort by reversibility and blast radius:

The agent wantsYour moveWhy
Read-only or in-repo reversible stepAnswer yes, or pre-approve the patternNothing outside the repo changes
A question with the facts on screenAnswer and resumeA minute of context saves an hour parked
Anything destructive, external, or money-shapedDecide yourself, every timeThese cannot be unrun
The same ask repeatingStop the loop, then answer onceApproving one instance feeds the next

Write this as a short policy your handlers can share: fast yes for the reversible half, a human for the rest, halt before approving anything repeating. OpenCode already encodes part of this split (.env reads asking by default, doom_loop asking by default); mirror the rest in your own rules rather than assuming any supervisor covers the routine half. For the triage of which waits need a person at all, how to know when a coding agent is waiting for input walks through the questions to ask.

Seeing idle and blocked side by side with qoop

After the events are wired, the remaining chore is watching four terminals without camping on them. qoop keeps each agent in its own tab with a shape-coded mark (pulsing while the turn runs, hollow when the agent asks for you, a filled square at the finish, a single dot at rest), and names the agent waiting for an answer in a top row you can jump to. Every agent is read from its screen, with a hook fitted for Claude Code, Codex, Gemini CLI, and OpenCode, so the mark flips the moment the state changes instead of after your next glance.

The paging matches the rule this post argues for. When a tab turns blocked, failed, or finished, its row lights up and a desktop note names the agent and what happened, with a bell as backup where no desktop note can be delivered. Notes only fire when you look elsewhere, the display pauses about a second and looks again before sounding, and several agents landing together produce a single combined note.

The routine half can go one step further with qass, the supervisor tab you start with a single command. When an agent halts, qass looks at that terminal's task record plus the plan and repo rules, settles the read-only, in-repo, reversible steps on its own, and turns what truly needs your word into cards on a small board. It never takes an always-allow option on a permission menu, and anything destructive, external, or money-shaped always lands on your side.

If three quiet terminals are your normal afternoon, sign up and let the blocked one find you instead of the other way around.