Azure / Azure/azure-dev

[ext-agents] Interactive agent-service picker hangs silently in non-TTY contexts instead of failing fast

Open
#8,584 0 comments 0 reactions 1 assignee Claimed by @glharper View on GitHub
area/ux bug ext-agents
Dominant language
Go
Stars
569
Forks
364
Avg merge
2d 19h
Merged PRs (30d)
136

Description

## Summary

Several `azd ai agent` subcommands render an interactive "Select an agent service" picker when the target agent is ambiguous (a multi-service `azure.yaml` with more than one `azure.ai.agent` block). When stdout/stderr is not a TTY -- CI, an agent harness, or anything piping through `tee`/`tail` -- the picker is invisible and the process blocks forever waiting on stdin that never arrives. There is no error, spinner, or banner; only `Ctrl+C` recovers.

This is the shared root cause behind multiple multi-service hangs (for example `invoke --local` and `files upload`).

## Repro

In any project with >= 2 `azure.ai.agent` services in `azure.yaml`, run a command that must resolve an agent without passing the name, in a non-TTY context:

```bash
azd ai agent invoke --local "hi" | tee out.log # picker renders into piped stdout -> hangs
azd ai agent files upload my-agent -f ./contract.txt 2>&1 | tail # same
```

`pstree` / `wchan` shows the extension child blocked in `do_epoll_wait` on the local gRPC pipe back to the parent `azd`; no Azure sockets are opened.

## Expected

1. Detect a non-TTY stdin/stdout and fail fast instead of rendering the picker, for example:
`cannot prompt for agent selection in a non-interactive context; pass the agent name (or --agent-name) or use --no-prompt`.
`--no-prompt` already does this for some paths; the picker itself should also be TTY-aware.
2. Even in TTY mode, print a one-line banner to stderr before the picker (for example `azd is waiting for your selection below`). When the picker is visible this is harmless; when stdout is piped the banner at least shows up in `tail`/`tee`/CI logs and explains why `azd` is blocked.

Either mitigation turns a multi-minute silent hang into an immediate, diagnosable signal.

## Environment

- azd 1.25.4; `azure.ai.agents` 0.1.36-preview (also reproduced on 0.1.38-preview)
- Linux (Ubuntu via WSL2)
- Project shape: 1 root `azure.yaml`, 6 `azure.ai.agent` service blocks, shared `.azure//`

## Related

- #7928 -- pass the agent name with `--local` (one of the commands that falls through to this picker)
- #8411 -- `agent run` / `invoke --local` timing

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.