Repository navigation
Description
Symptom
When a pi session is rooted inside a git repository, any bash command that
cds into a directory that is not a git repository prints
fatal: not a git repository (or any of the parent directories): .git
directly onto the terminal — on top of the TUI input line. The text is not part
of the tool result, not in the session file, and disappears on the next TUI
redraw (first keystroke), which makes it look like the input box was
temporarily corrupted.
It happens on every such command, even when the command contains no git
invocation at all (e.g. cd <non-repo-dir> && ls).
Reproduction
- Root a pi session in a git repository (so the
inGitRepo(sessionRoot)bail
in thetool_callhook does not trigger). - Run any bash command of the form
cd <path> && …where<path>exists but
is not a git repository (a scratch dir,/tmp, a work directory, …). - Observe the fatal painted over the TUI, while the tool result shows only the
command's normal output.
Reproduced on bigpowers 2.88.17 and confirmed still present in 2.90.0.
Platform-independent (Node stdio inheritance, not a terminal quirk).
Root cause
In extensions/omp-hooks.ts, the tool_call handler resolves the branch of
the command's target directory:
const pushBranch = currentBranch(commandGitCwd(command, command.length, sessionRoot));commandGitCwd() follows the last cd / git -C in the
command. currentBranch(cwd) then runs
execSync("git rev-parse --abbrev-ref HEAD", { encoding: "utf-8", timeout: 3000, cwd });without a stdio option. Node's execSync inherits the parent's stderr by
default, so when the target directory is not a repository, git writes the
fatal to the agent process's stderr — i.e. straight onto the TTY the TUI is
rendering. The catch that returns "unknown" swallows the exception but not
the already-written stderr.
The inGitRepo() probe just above uses stdio: "ignore" and is silent; the
early bail in the handler only covers process.cwd() (the session root), not
the per-command target directory introduced by #154.
Context
This exact leak was reported and fixed before:
- [Fix] omp-hooks.ts: Stop git guards from screaming outside repos #147 — "Stop git guards from screaming outside repos"
- fix(pi): prevent Git hook stderr from corrupting the TUI #146 — "prevent Git hook stderr from corrupting the TUI"
The per-command-target branch resolution from #154 reintroduced the uncaptured
probe, so the #146/#147 protection no longer applies when the session root is
a repo and the command cds elsewhere.
Suggested fix (not validated)
One line in currentBranch() — capture/ignore the child's stdio, mirroring
inGitRepo():
execSync("git rev-parse --abbrev-ref HEAD", {
encoding: "utf-8",
timeout: 3000,
cwd,
stdio: ["ignore", "pipe", "ignore"],
});Optionally also short-circuit with if (!inGitRepo(cwd)) return "unknown" to
avoid spawning git at all for non-repo targets.
Impact
- Cosmetic but frequent TUI corruption for anyone whose session root is a repo
and whose commands cd outside it (scratch dirs, temp dirs, sibling
projects) — every such command prints the fatal. - The leak is invisible to the agent and to the session transcript, which
makes the symptom confusing and hard to self-diagnose.
Activity
bertalanv commentedon Nov 3, 2026
Hi Daniel,
I found the issue and validated it, but the report is written by my local model (Qwen3.8-27B-FP8), I hope this feedback is useful in this format, if not pls tell me.
Bertalan
fix(omp): keep the tool_call branch probe quiet outside a git repo (#190
chore(release): 2.90.1 [skip ci]
github-actions commentedon Nov 3, 2026
🎉 This issue has been resolved in version 2.90.1 🎉
The release is available on:
Your semantic-release bot 📦🚀
chore(bugs): reconcile registry — mark 14 shipped fixes closed (#231)