73 lines
3.1 KiB
Markdown
73 lines
3.1 KiB
Markdown
---
|
|
summary: "The tea CLI's `comment` and `issues edit --description` subcommands hang indefinitely in non-interactive contexts unless stdin is closed; the Forgejo REST API is a robust bypass."
|
|
tags:
|
|
- type/reference
|
|
- tool/tea
|
|
- tool/forgejo
|
|
scope: global
|
|
source: cc-os
|
|
date: 2026-07-14
|
|
last_updated: 2026-07-15
|
|
---
|
|
|
|
# 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.
|
|
|
|
**Update 2026-07-15 (cc-os wayfinder charting):**
|
|
|
|
- `tea issues edit <N> --description "<body>"` **also hangs** without the guard — observed
|
|
as the same silent 2-minute timeout in a bash script. (Note `edit --add-assignees`
|
|
returned normally on 2026-07-14, so the hang seems tied to body-carrying flags, fitting
|
|
the stdin hypothesis.) Not retried with `< /dev/null`; the API route below was used instead.
|
|
- `tea issues create --repo ... --title ... --description "$(cat file)"` completed normally
|
|
**nine times in a row** inside a bash script without the guard — create appears safe.
|
|
- `tea issues close` remains untested without the guard.
|
|
|
|
**Robust bypass — the Forgejo REST API.** When a tea subcommand hangs (or for anything
|
|
scripted), PATCH/POST directly with tea's own token, read in-process and never printed:
|
|
|
|
```python
|
|
token = re.search(r'token:\s*(\S+)', open('~/.config/tea/config.yml').read()).group(1)
|
|
# PATCH /api/v1/repos/{owner}/{repo}/issues/{n} {"body": ...} — edit body
|
|
# PATCH ... /issues/{n} {"state": "closed"} — close
|
|
# POST ... /issues/{n}/comments {"body": ...} — comment
|
|
```
|
|
|
|
All three returned 201 and behaved correctly where `tea issues edit` had hung.
|
|
|
|
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.
|