Investigate Test Failures After Main Merge · Entire
After merging main, tests started failing in https://github.com/entireio/cli/pull/1347 check what's up.
Root cause identified.
The failing test TestIsAgentSubprocessEnv_GitTerminalPromptOnIsNotAgent in cmd/entire/cli/interactive/interactive_test.go:67 fails because:
func TestIsAgentSubprocessEnv_GitTerminalPromptOnIsNotAgent(t *testing.T) {
t.Setenv("GIT_TERMINAL_PROMPT", "1")
if isAgentSubprocessEnv() {
t.Error("isAgentSubprocessEnv() = true; want false when GIT_TERMINAL_PROMPT=1")
}
}
But isAgentSubprocessEnv() returns true because your environment has PI_CODING_AGENT=true set (from running inside the pi coding agent):
$ env | grep PI_CODING_AGENT
PI_CODING_AGENT=true
The function checks:
func isAgentSubprocessEnv() bool {
return os.Getenv("GEMINI_CLI") != "" ||
os.Getenv("COPILOT_CLI") != "" ||
os.Getenv("PI_CODING_AGENT") != "" ||
os.Getenv("GIT_TERMINAL_PROMPT") == "0"
}
t.Setenv("GIT_TERMINAL_PROMPT", "1") only overrides that one variable; inherited PI_CODING_AGENT=true still triggers the condition.
This is a pre-existing test bug on main (not caused by merging the PR). The test assumes a clean environment but doesn't defensively clear the other agent-detection variables.
Fix: Update the test to explicitly override the other vars to empty:
func TestIsAgentSubprocessEnv_GitTerminalPromptOnIsNotAgent(t *testing.T) {
setenv("GEMINI_CLI", "")
setenv("COPILOT_CLI", "")
setenv("PI_CODING_AGENT", "")
t.Setenv("GIT_TERMINAL_PROMPT", "1")
if isAgentSubprocessEnv() {
t.Error("isAgentSubprocessEnv() = true; want false when GIT_TERMINAL_PROMPT=1")
}
}
Or use os.Unsetenv via a helper if preferred.
Zero connection.
- The test failure exists on
mainindependently of the PR (confirmed by runningmise run testonmain— same failure). cmd/entire/cli/interactive/interactive.goand its test were not modified by either the PR branch or the merge ofmaininto it.- The PR (
fix/checkpoint-step-count-prompts) only touches checkpoint/attach/strategy code; the auth changes pulled in frommainare unrelated to theinteractivepackage. - The root cause is purely environmental:
PI_CODING_AGENT=true(set by thepiagent harness) leaks intogo test, and the test doesn't defensively clear the sibling agent-detection vars.
The PR merge is a red herring — the test is fragile and fails whenever any of GEMINI_CLI, COPILOT_CLI, or PI_CODING_AGENT is present in the parent environment.
PR created: https://github.com/entireio/cli/pull/1361
Verification summary
- The fix is correct: the test now defensively clears
GEMINI_CLI,COPILOT_CLI, andPI_CODING_AGENTbefore asserting thatGIT_TERMINAL_PROMPT=1alone does not triggerisAgentSubprocessEnv(). t.Setenvensures cleanup after the test; setting to""overrides any inherited non-empty values from the parent process.- The change is isolated to the test file, has no impact on production logic, and resolves the environmental flakiness observed when running inside
pi(or the other agent CLIs).