After merging main, tests started failing in https://github.com/entireio/cli/pull/1347…
- User
After merging main, tests started failing in https://github.com/entireio/cli/pull/1347 check what's up.
- Assistant
Root cause identified.
The failing test
TestIsAgentSubprocessEnv_GitTerminalPromptOnIsNotAgentincmd/entire/cli/interactive/interactive_test.go:67fails because:gofunc 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 hasPI_CODING_AGENT=trueset (from running inside the coding agent): - User
In how far has that something to do with the PR changes?
- Assistant
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, orPI_CODING_AGENTis present in the parent environment. - The test failure exists on
- User
Ok, fix/address it in a separate PR?
- Assistant
Done. Created branch
fix/interactive-test-hermetic-envwith the hermetic test fix:diffdiff --git a/cmd/entire/cli/interactive/interactive_test.go b/cmd/entire/cli/interactive/interactive_test.go index 602a6cce0..ea538f0e6 100644 --- a/cmd/entire/cli/interactive/interactive_test.go +++ b/cmd/entire/cli/interactive/interactive_test.go @@ -62,6 +62,11 @@ func TestIsAgentSubprocessEnv(t *testing.T) { // 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") - User
Double check this is the proper solution and create a PR.
- Assistant
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).
- The fix is correct: the test now defensively clears