Skip to content

fix: preserve terminal stderr for ticket pickers - #39

Merged
dkarter merged 1 commit into
mainfrom
fix/interactive-ticket-terminal
Oct 5, 2026
Merged

dkarter merged 1 commit into
mainfrom
fix/interactive-ticket-terminal

Conversation

@dkarter

@dkarter dkarter commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Motivation

Interactive ticket pickers can render a blank screen because HWT turns stderr into a pipe. Preserve terminal stderr so pickers work without a 2>/dev/tty shell wrapper.

Summary of changes

  • Pass terminal stderr directly to the command; keep stdout reserved for JSON.
  • Keep streaming and captured diagnostics for redirected stderr and injected writers.
  • Add real Bubble Tea PTY regression tests and an end-to-end branch/metadata test.

Testing

To verify manually, configure a picker as direct argv, such as [lnr, issue, search, --json, '{input}'], and run hwt create --ticket --json in Herdr. Confirm the picker renders, Enter creates the selected branch with ticket metadata, and Escape cancels without creating a worktree. Redirect stdout to a file to confirm no UI appears in the JSON.

Verified in a live Herdr pane with fake ticket data and a disposable repository: the picker received real dimensions, Enter created a real Herdr workspace/worktree, metadata persisted, and Escape preserved the picker exit status. Test workspace and pane were removed.

Also passed the full mise run check, 20 repeated macOS race-enabled ticket-command test runs, 20 repeated Linux container test runs, and 10 repeated ticket E2E runs.

Dependencies/special considerations

  • Adds github.com/creack/pty for tests and uses the existing cross-platform terminal library directly.
  • Windows build remains blocked by pre-existing Unix-only Flock calls in internal/localdns/localdns.go.
  • Existing user shell workarounds remain untouched until the native fix is released and installed.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes Reviewed all seven changed files, including subprocess descriptor handling, failure diagnostics, and the terminal regression tests.

  • Terminal inheritance: Ticket commands receive terminal stderr directly, preserving terminal identity and dimensions while stdout remains reserved for JSON.
  • Diagnostic handling: Redirected stderr and injected writers retain streaming and capture; terminal failures avoid repeating unrelated stdout and preserve wrapped subprocess errors.
  • Regression coverage: Real Bubble Tea PTY tests exercise selection and cancellation, and a hermetic CLI test verifies branch creation and persisted ticket metadata. The specification and dependencies reflect the new coverage.

Verification passed on Linux: mise exec -- go test ./..., mise exec -- go vet ./..., and five race-enabled repetitions of the ticket-command tests. macOS and live Herdr behavior were not independently exercised during this review.

Pullfrog  | View workflow run | Using gpt-6.1-sol | 𝕏

@dkarter
dkarter marked this pull request as ready for review October 5, 2026 17:41
@dkarter
dkarter merged commit a1d09d4 into main Oct 5, 2026
6 checks passed
@dkarter
dkarter deleted the fix/interactive-ticket-terminal branch October 5, 2026 17:41
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