Skip to content

fix(pi): prevent Git hook stderr from corrupting the TUI - #146

Closed
d3vv3 wants to merge 1 commit into
danielvm-git:mainfrom
d3vv3:fix/pi-git-stderr
Closed

d3vv3 wants to merge 1 commit into
danielvm-git:mainfrom
d3vv3:fix/pi-git-stderr

Conversation

@d3vv3

@d3vv3 d3vv3 commented Oct 10, 2026

Copy link
Copy Markdown

Summary

Prevent failed Git branch lookups from writing directly over Pi’s terminal editor.

The Git-safety hook performs a branch lookup before Bash commands. Outside a Git repository, git rev-parse fails. Although the exception is caught, its stderr can still leak into the terminal and corrupt the editor display.

Changes

  • Explicitly capture stdout and stderr and ignore stdin.
  • Preserve the existing timeout and unknown branch fallback.
  • Extend the runtime smoke test through the registered tool_call hook:
    • Failed lookups outside a repository produce no terminal stderr.
    • Ordinary Bash commands remain allowed.
    • Pushes from the protected main branch remain blocked.

Verification

  • Regression failed before the fix with fatal: not a git repository.
  • Regression and extension validation passed after the fix.
  • Full local preflight passed:
npm run compliance &&
bash scripts/run-verification-gates.sh &&
bash scripts/sync-skills.sh &&
bash scripts/trace-stories.sh --strict

Scope and review status

This fixes terminal stderr leakage. It does not change the synchronous lookup behavior or claim to resolve filesystem-related UI freezes.

Independent review is pending; this PR is intentionally a draft.

@d3vv3
d3vv3 marked this pull request as ready for review October 11, 2026 10:15
@d3vv3 d3vv3 closed this by deleting the head repository Oct 14, 2026
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