Repository navigation
Drop transient Codex launcher paths before running loop-zero #1613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -455,7 +455,10 @@ def test_shim_prefers_verified_codex_only_for_loopzero(helper, tmp_path, monkeyp | |
| codex = pin / 'codex' | ||
| codex.write_text('#!/bin/sh\nexit 0\n') | ||
| codex.chmod(0o755 if pin_state != 'nonexecutable' else 0o644) | ||
| monkeypatch.setenv('PATH', f'{shims}:{binaries}') | ||
| codex_home = tmp_path / 'codex-home' | ||
| arg0 = codex_home / 'tmp/arg0-linux/codex-arg0ABC123' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Test only covers the positive match; the narrowness of the filter is not pinned The task says the filter matches only a named Codex launcher inside the active CODEX_HOME. The test adds one matching directory, but no test checks that near-misses survive: a |
||
| monkeypatch.setenv('CODEX_HOME', str(codex_home)) | ||
| monkeypatch.setenv('PATH', f'{shims}:{arg0}:{binaries}') | ||
| monkeypatch.setattr(helper.sys, 'argv', [str(shims / name)]) | ||
| calls = [] | ||
| monkeypatch.setattr(helper.os, 'execve', lambda *args: calls.append(args)) | ||
|
|
@@ -471,7 +474,7 @@ def test_shim_prefers_verified_codex_only_for_loopzero(helper, tmp_path, monkeyp | |
| expected.insert(0, str(pin)) | ||
| assert env['PATH'].split(helper.os.pathsep) == expected | ||
| else: | ||
| assert env['PATH'] == f'{shims}:{binaries}' | ||
| assert env['PATH'] == f'{shims}:{arg0}:{binaries}' | ||
|
|
||
|
|
||
| @pytest.mark.parametrize('provider,email,shown', [ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Filter compares paths lexically, so a symlinked or non-normalized CODEX_HOME will not match
Path(d).parent != arg0is a plain string-level comparison. Codex canonicalizes its home directory before it builds thetmp/arg0-linux/codex-arg0*PATH entry. IfCODEX_HOMEis set to a symlink, a relative path, or a path containing.., the PATH entry will be the canonical path, the comparison fails, and the transient directory stays in PATH. The receipt fingerprint then changes from session to session, which is the bug this change is meant to fix. Smallest fix: compare resolved paths, e.g. computearg0 = (...).resolve()once and testPath(d).parent.resolve() == arg0, or useos.path.realpathon both sides. Resolving does not touch the filesystem in a way that matters here, and it keeps the filter narrow.