Skip to content

follow-up: harden Unix socket test against AF_UNIX path limits#8

Merged
gaoguobin merged 2 commits into
mainfrom
codex/github-mention-fix-skip-runtime-special-files-in-backups
May 20, 2026
Merged

follow-up: harden Unix socket test against AF_UNIX path limits#8
gaoguobin merged 2 commits into
mainfrom
codex/github-mention-fix-skip-runtime-special-files-in-backups

Conversation

@gaoguobin
Copy link
Copy Markdown
Owner

Motivation

  • Prevent flaky AF_UNIX path too long failures on Linux/macOS CI caused by long temporary directories so the test exercises backup behavior reliably.
  • Keep coverage of Unix-socket skipping logic while removing environment-dependent setup failures.

Description

  • Modify test_backup_skips_venv_symlinks_and_unix_sockets to create a short temporary symlink target and bind the Unix socket through that short path when possible.
  • Add a length guard (len(str(bind_path)) < 100) to only attempt AF_UNIX bind when the computed path is short enough.
  • Ensure socket parent directory creation uses exist_ok=True and close the test server promptly after bind attempts.

Testing

  • Ran python -m unittest tests.test_core.CodexEnvironmentBackupTests.test_backup_skips_venv_symlinks_and_unix_sockets and it passed (OK).

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 22fde4aa45

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/test_core.py Outdated
if len(str(bind_path)) < 100:
server = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
try:
server.bind(str(bind_path))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restore Windows-safe handling for AF_UNIX bind failures

This server.bind(...) call is now unguarded, so on Windows environments where socket.AF_UNIX exists but binding fails (for example due to platform/socket-path constraints), the test raises OSError and fails instead of continuing without a created socket. The previous version explicitly swallowed bind errors on os.name == "nt", so this change reintroduces platform-specific CI failures for test_backup_skips_venv_symlinks_and_unix_sockets rather than just skipping the socket assertion path.

Useful? React with 👍 / 👎.

@gaoguobin gaoguobin merged commit fbca1d0 into main May 20, 2026
5 checks passed
@gaoguobin gaoguobin deleted the codex/github-mention-fix-skip-runtime-special-files-in-backups branch May 20, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant