SecondBrain/reference/tea-cli-comment-blocks-on-s...

52 lines
2.0 KiB
Markdown

---
summary: The tea CLI's `comment` subcommand hangs indefinitely unless stdin is closed, even when the comment body is passed as a positional argument.
tags:
- type/reference
- tool/tea
- tool/forgejo
scope: global
source: cc-os
date: 2026-07-14
last_updated: 2026-07-14
---
# tea CLI: `comment` blocks on stdin
`tea comment <N> --repo <owner>/<repo> "<body>"` **hangs indefinitely** — it blocks reading
stdin even though the body was supplied as a positional argument. Observed as a 2-minute
timeout in an agent session; the request never reached the server (no comment was posted).
The fix is to close stdin explicitly:
```bash
tea comment 45 --repo jared/cc-os "$(cat body.md)" < /dev/null
```
The identical command with `< /dev/null` appended completed in seconds and posted correctly.
## Scope of the behavior — do not over-generalize
Only `tea comment` was observed hanging. In the same session, these ran **without**
`< /dev/null` and returned normally:
- `tea issues list --repo ...`
- `tea issues <N> --repo ...` (view)
- `tea issues edit <N> --repo ... --add-assignees <user>`
So this is **not** a blanket property of every `tea` subcommand. `tea issues create` and
`tea issues close` were never tested without the guard, so their behavior is unknown.
Cheap defensive habit for any agent scripting tea: append `< /dev/null` to tea calls in
non-interactive contexts. It is harmless where it isn't needed, and it converts a silent
2-minute hang into a normal completion.
## Why it matters
An agent scripting Forgejo issue updates will appear to hang with no error and no output.
The cause is non-obvious (the body *was* provided, so there is no apparent reason to read
stdin) and the tea docs do not mention stdin behavior for `comment`. Without knowing this,
the natural next move is to retry the command — which hangs again.
Evidence is one reproduction plus one successful retry differing only in the redirect; the
stdin hypothesis is strong but not proven against tea's source.