test: make GitTerminalPromptOnIsNotAgent hermetic · Entire
test: make GitTerminalPromptOnIsNotAgent hermetic
1a26779→main·
dipree·1mo ago·1 file·+5 added/-0 removed
Clear sibling agent-detection env vars (GEMINI_CLI, COPILOT_CLI, PI_CODING_AGENT) so the test does not depend on parent environment. Fixes flakiness when running inside pi, gemini-cli, or copilot-cli.
Sessions
eb5e53e98303View transcript
Changes
1
cmd/entire/cli/interactive
Minteractive_test.go+5
61 unmodified lines
62
63
64
65
66
67
68
69
70
71
72
61 unmodified lines
// GIT_TERMINAL_PROMPT only counts when explicitly set to "0". Other values
// (or absence) shouldn't trigger the guard.
func TestIsAgentSubprocessEnv_GitTerminalPromptOnIsNotAgent(t *testing.T) {
// Clear sibling agent-detection vars so the test is hermetic regardless of
// parent environment (e.g. running inside pi, gemini-cli, copilot-cli).
t.Setenv("GEMINI_CLI", "")
t.Setenv("COPILOT_CLI", "")
t.Setenv("PI_CODING_AGENT", "")
t.Setenv("GIT_TERMINAL_PROMPT", "1")
if isAgentSubprocessEnv() {
t.Error("isAgentSubprocessEnv() = true; want false when GIT_TERMINAL_PROMPT=1")
}
Mcmd/entire/cli/interactive/interactive_test.go+5