Investigate Test Failures After Main Merge

Pi·grok-4.3·dipree·4mo ago·19min·1 Checkpoint·1 file change·+5·43.1K tokens

After merging main, tests started failing in https://github.com/entireio/cli/pull/1347 check what's up.

4mo ago·2.0s

Root cause identified.

The failing test TestIsAgentSubprocessEnv_GitTerminalPromptOnIsNotAgent in cmd/entire/cli/interactive/interactive_test.go:67 fails because:

But isAgentSubprocessEnv() returns true because your environment has PI_CODING_AGENT=true set (from running inside the pi coding agent):

The function checks:

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:

Or use os.Unsetenv via a helper if preferred. Would you like me to apply the fix?

In how far has that something to do with the PR changes?

4mo ago·8.0s

Zero connection.

  • The test failure exists on main independently of the PR (confirmed by running mise run test on main — same failure).
  • cmd/entire/cli/interactive/interactive.go and its test were not modified by either the PR branch or the merge of main into it.
  • The PR (fix/checkpoint-step-count-prompts) only touches checkpoint/attach/strategy code; the auth changes pulled in from main are unrelated to the interactive package.
  • The root cause is purely environmental: PI_CODING_AGENT=true (set by the pi agent harness) leaks into go 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.

Ok, fix/address it in a separate PR?

4mo ago·10.7s

Done. Created branch fix/interactive-test-hermetic-env with the hermetic test fix:

The change makes the test independent of inherited PI_CODING_AGENT/GEMINI_CLI/COPILOT_CLI values. You can commit/push and open the PR from this branch.

Double check this is the proper solution and create a PR.

4mo ago·11.7s

PR created: https://github.com/entireio/cli/pull/1361

Verification summary

  • The fix is correct: the test now defensively clears GEMINI_CLI, COPILOT_CLI, and PI_CODING_AGENT before asserting that GIT_TERMINAL_PROMPT=1 alone does not trigger isAgentSubprocessEnv().
  • t.Setenv ensures 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).