Skip to content

fix(branch): --agent-stdin keeps the piped brief with an issue flag (#359) - #360

Merged
baldurpan merged 3 commits into
mainfrom
359-branch-agent-stdin-reads-an-empty-brief-with-an
Nov 23, 2026
Merged

baldurpan merged 3 commits into
mainfrom
359-branch-agent-stdin-reads-an-empty-brief-with-an

Conversation

@baldurpan

Copy link
Copy Markdown
Contributor

What changed

worktree branch --agent-stdin used to read an empty brief whenever the branch came from an issue flag (--linear, --github, --jira, --clickup). Every linear-listen delegation failed with "The agent brief from --agent-stdin is empty."

Cause: when a positional arg is not given, oclif's parser fills it from piped stdin (tryStdin in @oclif/core/lib/parser/parse.js). It skips this only when the arg sets ignoreStdin. With an issue flag, branchName is never given, so this.parse(Branch) drained the pipe before readBriefStdin ran.

  • src/commands/branch.ts: branchName now sets ignoreStdin: true.
  • src/commands/branch-stdin.test.ts: runs the real oclif Parser.parse with Branch.args/Branch.flags, a piped non-TTY stdin and each issue flag. It asserts that branchName stays unset and the brief is still on stdin. All 5 tests fail without the fix and pass with it.
  • .changeset/quiet-pipes-listen.md: a patch note.

Only branch defines --agent-stdin. checkout takes only --agent (its docs say it has no --agent-stdin), so no other command needs the change.

Gates

  • Gate 1 (context/verify.md): pnpm check 0 errors; pnpm typecheck, pnpm build exit 0; pnpm test: 56 files, 3831 tests pass.
  • Gate 2 (the reviewer subagent): PASS WITH NOTES, nothing blocking. Non-blocking notes:
    • The second test (not.toBe(brief)) adds nothing to the first's toBeUndefined().
    • Piping a branch name into worktree branch with no positional no longer fills branchName. This was never documented.
    • The test pins the parse, not a full Branch.run end to end.
    • checkout/open/remove/rename/config positionals keep oclif's default. That is harmless while none of them reads stdin.

Release note

Paths checked:

  • src/** owed a note, written at patch (level confirmed).
  • No docs/**, context/** or .github/** path is touched.

docs/src/content/docs/commands/branch.mdx:61 (cat brief.md | worktree branch --github 42 --agent-stdin) is now true as written.

Closes #359

…359)

oclif fills a positional that was not given from piped stdin, so with
--linear, --github, --jira or --clickup the parse drained the pipe before
readBriefStdin ran, and every linear-listen delegation failed with an
empty brief. branchName now sets ignoreStdin, and a test runs the real
oclif parse with a piped brief for each issue flag.

Closes #359

@baldurs-reviewer baldurs-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code-reviewer: minor issues

This sets ignoreStdin: true on branch's branchName positional. With an issue flag and no positional, oclif's parser used to drain piped stdin before readAgentBrief ran, so the brief read empty. The fix is the right lever, since oclif skips its stdin fallback only for args that set ignoreStdin, and the new test exercises the real Parser.parse for all four issue flags. I found no correctness problems, only one small suggestion on the test.


Reviewed 31c0a70 for baldurpan · claude-opus-5-5 · 3 files · $0.21

Comment thread src/commands/branch-stdin.test.ts Resolved

@baldurs-reviewer baldurs-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code-reviewer follow-up: looks good

Since the last review, the redundant second test was replaced with the case where --agent-stdin is given with no issue flag and no positional branch name. It asserts that branchName stays unset and the brief remains on stdin. The earlier comment is addressed, and the change looks sound.

Earlier comments


Reviewed a52854f (changes since 31c0a70) for baldurpan · claude-opus-5-5 · 1 file · $0.03

@baldurpan
baldurpan merged commit d359982 into main Nov 23, 2026
2 checks passed
@baldurpan
baldurpan deleted the 359-branch-agent-stdin-reads-an-empty-brief-with-an branch November 23, 2026 14:01
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.

branch --agent-stdin reads an empty brief with an issue flag, so every linear-listen delegation fails

1 participant