Skip to content

Conversation

@brettcannon
Copy link

Problem

When running Python E2E tests locally (outside CI), they hang indefinitely on any test that sends a message via send_and_wait().

Root Cause

The E2E test harness overrides XDG_CONFIG_HOME to an isolated temp directory for test isolation. When not in CI, github_token was None, so the CLI defaulted to use_logged_in_user=True — but found no credentials in the empty temp dir.

The CLI logged Error: Session was not created with authentication info or custom provider but never emitted a session.error event back to the SDK, so send_and_wait() blocked forever waiting for a session.idle that would never come.

Fix

Always pass github_token="fake-token-for-e2e-tests" in the test harness and in the one test that creates its own client. Since E2E tests use a replaying proxy with canned responses, real auth is never needed.

Verification

All 74 Python E2E tests pass (2 pre-existing skips for known unrelated issues).

@brettcannon brettcannon requested a review from a team as a code owner February 12, 2026 19:29
Copilot AI review requested due to automatic review settings February 12, 2026 19:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes local Python E2E test hangs by ensuring the Copilot CLI never attempts interactive/credential-based auth when the harness points XDG_CONFIG_HOME at an empty temp directory.

Changes:

  • Always pass github_token="fake-token-for-e2e-tests" when constructing the shared Python E2E CopilotClient.
  • Update the one test that creates its own CopilotClient to also always pass the fake token.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
python/e2e/testharness/context.py Makes the shared E2E client always use a fake auth token to prevent CLI auto-login behavior from hanging tests locally.
python/e2e/test_session.py Ensures the test-created “new client” uses the same fake token behavior as the harness client.

The E2E test harness overrides XDG_CONFIG_HOME to an isolated temp
directory. When running locally (not CI), github_token was None, so
the CLI defaulted to use_logged_in_user=True but found no credentials
in the empty temp dir. This caused a silent auth failure — the CLI
logged 'Session was not created with authentication info' but never
emitted a session.error event, making send_and_wait() hang forever.

Since E2E tests use a replaying proxy with canned responses, real
auth is never needed. Always pass the fake token.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant