Skip to content

fix(todo): never hang todo context on an unclosed stdin; accept the body as arguments - #405

Open
jacklau04 wants to merge 1 commit into
TheWeiHu:mainfrom
jacklau04:fix/todo-context-body-args
Open

jacklau04 wants to merge 1 commit into
TheWeiHu:mainfrom
jacklau04:fix/todo-context-body-args

Conversation

@jacklau04

Copy link
Copy Markdown
Contributor

Why

devbrain todo context <id> reads the body from stdin and only refuses a tty. When an agent calls it inline with the text as an argument — devbrain todo context 0115-… "…notes…" — stdin is the tool harness's socket, which never closes, so io.ReadAll blocks forever and the text is silently dropped.

Observed on 2026-10-15: a devbrain todo context process spawned from a Claude Code session sat for 3h50m (STAT S, stdin = unix socket, no children) until killed; the task file was never written.

What

  • Trailing arguments after the id are the body (joined with spaces); no stdin read in that case.
  • With no body arguments, stdin must be a pipe or file: a tty or a socket is refused with the existing hint, so the command fails fast instead of hanging.
  • Usage line updated. The /continue and /work heredoc form (devbrain todo context "$id" <<'CTX') is unchanged and still works.

How verified

  • New TestContextBodyFromArgs and TestContextRefusesSocketStdin (socketpair as stdin, 2s watchdog). Both failed before the fix (exit 1 "needs the body on stdin"; watchdog timeout) and pass after.
  • go test -race -count=10 ./internal/todo -run TestContext (the new test uses a goroutine), and make test (vet, full suite, dashboard node checks) are green.

🤖 Generated with Claude Code

… body as arguments

`todo context <id>` read its body from stdin and only refused a tty. Called
inline by an agent with the text as an argument, stdin is the tool harness's
socket, which never closes: io.ReadAll blocked forever and the text was
dropped. Observed 2026-10-15 as a devbrain process stuck for ~4h on a unix
socket stdin, task file never written.

Trailing arguments after the id are now the body; with none, stdin must be a
pipe or file — a tty or a socket is refused up front with the existing hint.
The skills' heredoc form is unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant