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 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