Skip to content

test: isolate AF_UNIX socket paths + ambient HOME state (#4279 classes 2 & 4) - #4369

Open
abhay-codes07 wants to merge 1 commit into
omnigent-ai:mainfrom
abhay-codes07:test/4279-macos-socket-path-and-home-isolation
Open

test: isolate AF_UNIX socket paths + ambient HOME state (#4279 classes 2 & 4)#4369
abhay-codes07 wants to merge 1 commit into
omnigent-ai:mainfrom
abhay-codes07:test/4279-macos-socket-path-and-home-isolation

Conversation

@abhay-codes07

Copy link
Copy Markdown
Contributor

Related issue

Addresses #4279 (classes 2 & 4). Together with #4363 (classes 1 & 3) this covers all four classes.

Summary

The remaining two test-isolation gaps from #4279. Both are macOS / Databricks-dev-box-specific at runtime — I validated non-regression on a Windows checkout and followed the issue's prescribed fixes and the in-repo precedents, but the macOS-only failure modes (AF_UNIX 103-byte cap, real Keychain) aren't reproducible on my box, so I'm flagging them as pattern-applied rather than executed on the failing platform.

Class 2 — AF_UNIX 103-byte path cap

macOS caps a Unix socket path at ~103 bytes and its $TMPDIR is already ~48, so pytest's tmp_path (which embeds the test name) overflows before a socket filename is appended. The repo already solves this with a short_tmp_parent fixture (tests/inner/egress/test_relay.py), just not in the two other socket-binding tests. Promoted a shared short_tmp_parent to tests/inner/conftest.py and used it in:

  • test_proxy.py::test_proxy_start_unix
  • test_terminal.py::test_server_survives_inner_process_exit_real_tmux

Class 4 — host state outside OMNIGENT_CONFIG_HOME

Ambient provider detection also reads ~/.codex/config.toml and ~/.databrickscfg (under $HOME), and on macOS _claude_login_detected() falls back to claude auth status, which reads the Keychain — no $HOME override can hide it. Fixes:

  • Redirect $HOME (and $USERPROFILE, so os.path.expanduser is isolated cross-platform) to a temp dir in test_openai_agents_sdk_spawn_env.py and test_provider_spawn_env.py.
  • Stub ambient._claude_login_detected -> False for the Keychain case.
  • Scope the same $HOME redirect into the one affected runner test (test_create_session_threads_workspace_to_pi_cwd).

Test Plan

Verified on a Windows checkout:

OMNIGENT_SKIP_WEB_UI=true uv run pytest \
  tests/runtime/test_provider_spawn_env.py \
  tests/runtime/test_openai_agents_sdk_spawn_env.py \
  "tests/runner/test_app_sessions_native_terminals_runtime.py::test_create_session_threads_workspace_to_pi_cwd"
# 99 passed  (Class-4 isolation is additive — no regression)

The Class-2 tests use AF_UNIX, which is unsupported on Windows, so they behave identically to clean main there (the short_tmp_parent fixture itself runs fine); their macOS path-length fix is validated by the established test_relay.py precedent. ruff check + ruff format --check clean.

Demo

N/A. Test-only change (socket-path + env isolation); no product code touched.

Type of change

  • Bug fix
  • Feature
  • UI / frontend change
  • Refactor / chore
  • Docs
  • Test / CI
  • Breaking change

Test coverage

  • Unit tests added / updated
  • Integration tests added / updated
  • E2E tests added / updated
  • Manual verification completed
  • Existing tests cover this change
  • Not applicable

Note for a macOS reviewer

If you can run uv run python -m pytest tests/inner tests/runtime on a signed-in Mac with a gateway-pinned shell + ~/.codex/config.toml + multi-profile ~/.databrickscfg, these are the tests #4279 lists for classes 2 & 4 — a green run there confirms the runtime fix I couldn't exercise on Windows.

Changelog

Isolated the AF_UNIX socket paths and ambient $HOME/Keychain provider state in the affected tests so pytest is a usable local signal on macOS.

…mnigent-ai#4279, classes 2 & 4)

The remaining two test-isolation gaps from omnigent-ai#4279. Both are macOS/Databricks-
dev-box-specific at runtime; I validated non-regression on Windows and
followed the issue's prescribed patterns (and the in-repo precedents), but
the macOS-only failure modes (AF_UNIX 103-byte cap, real Keychain) are not
reproducible on my box.

Class 2 - AF_UNIX 103-byte path cap:
  macOS caps a Unix socket path at ~103 bytes and its $TMPDIR is already ~48,
  so pytest's tmp_path (which embeds the test name) overflows before a socket
  name is appended. Added a shared `short_tmp_parent` fixture in
  tests/inner/conftest.py (generalizing the one test_relay.py already had) and
  used it for the two socket-binding tests that still used tmp_path:
  test_proxy.py::test_proxy_start_unix and
  test_terminal.py::test_server_survives_inner_process_exit_real_tmux.

Class 4 - host state outside OMNIGENT_CONFIG_HOME:
  Ambient provider detection also reads ~/.codex/config.toml and
  ~/.databrickscfg (under $HOME), and on macOS _claude_login_detected() reads
  the Keychain, which no $HOME override can hide. Redirected $HOME (and
  $USERPROFILE for cross-platform expanduser) to an isolated temp dir in
  test_openai_agents_sdk_spawn_env.py and test_provider_spawn_env.py, plus
  stubbed _claude_login_detected -> False for the Keychain case, and scoped
  the same HOME redirect into the one affected pi-cwd runner test.

Verified on Windows: the Class-4 files pass (99 passed; isolation is additive),
and the Class-2 tests behave as before (AF_UNIX is unsupported on Windows
regardless, identical to clean main). With omnigent-ai#4363 (classes 1 & 3) this covers
all four classes of omnigent-ai#4279.

Signed-off-by: abhay-codes07 <abhaysingh0293@gmail.com>
Copilot AI lite review requested due to automatic review settings August 7, 2026 18:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the size/M Pull request size: M label Aug 7, 2026
@github-actions
github-actions Bot requested a review from dbczumar August 7, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Pull request size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants