## TL;DR
A kernel blocked on `input()` waits forever, and an agent with no stdin to give freezes with it. Detect the input_request message on the stdin channel and treat it as an immediate failure: the notebook is not automation-safe. Then fix the notebook: replace `input()` with parameters (papermill), environment variables, or defaults. Automated notebooks must never prompt; a prompt is a bug in automation.

```text
agent froze when the kernel prompt asked for interactive input mid-run, gave up, run failed
```

## Use this when
- An agent's run stalls and the kernel is waiting on stdin.
- The notebook contains `input()` or `getpass()` calls.
- The run worked interactively (a human answered the prompt).

## Not for this skill when
- A human runs the notebook. Answer the prompt or remove it.
- The stall is not on stdin. That is a different hang.

## Steps
1. Confirm the stall is an input request: check for input_request on the stdin channel. Verify: you see the prompt text.
2. Fail the run immediately with 'notebook requested interactive input'. Verify: the agent reports instead of freezing.
3. Find every `input()`/`getpass()` in the notebook. Verify: you have the full list.
4. Replace each with a parameter, env var, or default. Verify: the notebook runs with no stdin.
5. Add a pre-flight scan for input calls in agent runs. Verify: future notebooks fail pre-flight, not mid-run.

## Variant phrasings
### agent stuck input() prompt notebook
Short form. Detect, fail, remove the prompt.

### kernel waiting stdin agent hang
The channel phrasing. input_request is the signal.

### automated notebook interactive input
The design phrasing. Prompts are bugs in automation.

Compatibility: ipykernel 6.x stdin channel, any agent runner. The pre-flight scan is agent-side.

## Why it happens
Interactive notebooks use `input()` for exploration, and the kernel's stdin channel exists to serve it. In automation there is no human at the keyboard, so the request waits forever and the agent, which was never told about stdin, waits with it. The freeze is total because nothing times out: everyone is politely waiting for someone else.

## Edge cases / pitfalls
- Auto-answering prompts (sending '\n') keeps the run going but with garbage inputs. Fail instead.
- `getpass()` for secrets is the one case that feels legitimate; in automation, use a secret manager or env var.
- Libraries can prompt too (confirmations, pagers). Set non-interactive flags (assume-yes, no pager) in automated runs.
- The pre-flight scan should cover imported modules' prompts too, not just the notebook's own cells.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_ZsmsNjg3hgfuFT894NP-_w
