Repository navigation
test(e2e): rely on setup to build the Codex plugin environment - #2646
Merged
PsiACE merged 1 commit intoNov 16, 2026
Merged
Conversation
`powercontext setup codex` builds the installed plugin's uv environment, so the host E2E's own post-setup `uv sync` repeated setup's work and hid a regression in it. Setup and the Codex session read the same UV_PYTHON from the fixture's environment, so the session's hooks reuse what setup built. Document that uv rebuilds the plugin environment when Codex starts with a UV_PYTHON naming a different interpreter from the one setup used, and that the first session can then miss PowerContext's MCP tools.
hidb4ai
approved these changes
Nov 15, 2026
hidb4ai
left a comment
Contributor
There was a problem hiding this comment.
No blocking findings. Removing the redundant post-setup sync makes the host E2E exercise setup's existing plugin environment build, and the bilingual docs accurately describe the interpreter-mismatch limitation. No database tables or interfaces are added.
Validated with Codex CLI 0.167.2 against a real PowerContext Server using fixture models, plus setup/diagnostic tests and interpreter-reuse checks. Live-model, TUI, and Desktop acceptance remain outside this validation.
PsiACE
approved these changes
Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue or RFC does this PR close?
No tracking issue. Follow-up to #2624 (real-host Codex E2E) and #2626 (setup builds the plugin environment).
Rationale for this change
#2624's host E2E built the installed plugin's uv environment itself after
powercontext setup codex. Without that step, the MCP header helper and theSessionStarthook built the environment at the same time while Codex started. They ran under different interpreters, and the helper could fail on the half-replaced environment. Since #2626, setup runs the sameuv sync --frozen --quiet --project <plugin>, so the test's step only repeats setup's work. It also hides a regression in setup's build, which is the path users get.Setup's build is only useful if the Codex session reuses it. That holds when setup's
uv syncand the session'suv runrequest the same interpreter:codex execenvironment from the same_isolated_environment. Both carryUV_PYTHON=sys.executable, and both resolve the sameuvonPATH. Setup prepends the Codex binary's directory toPATH, and locally that directory holds the sameuvthat is already first onPATH.codex-hostjob inmaster.ymland thesetup-python-envaction set noUV_*variable, so CI matches the local run.UV_*. WithUV_PYTHONunset, uv reuses the existing environment.What changes are included in this PR?
tests/e2e/test_codex_host_service_chain.py: the post-setupuv syncstep and its comment are removed. The comments on the uv cache and onUV_PYTHONnow say that setup builds the environment and that the hooks reuse it only because they request the same interpreter.UV_PYTHONnames a different interpreter from the one setup used. In that case the first session'sSessionStarthook rebuilds it, and that session can start without PowerContext's MCP tools. The docs also say how to avoid it.Are there any user-facing changes?
The test change is not user-facing. The docs now describe the
UV_PYTHONlimitation below. Behavior is unchanged.Known limitation (not fixed here):
uv runrecreates the plugin's.venvwhenUV_PYTHONnames a different interpreter from the one setup built it with. A Codex session started with such aUV_PYTHONtherefore rebuilds the environment once, on its firstSessionStarthook, while the MCP header helper may be using it. That first session can miss the PowerContext MCP tools, as before #2626. Later sessions reuse the rebuilt environment. The real fix changes how the plugin runtime chooses its Python, so that the hooks stop depending on the session'sUV_PYTHON. That is a separate change.How was this change tested?
CODEX_CLI_BIN=<codex 0.167.2> UV_OFFLINE=1 uv run pytest tests/e2e/test_codex_host_service_chain.py tests/e2e/test_host_model_responses.py -n 5, with real Codex CLI 0.167.2 on macOS arm64, three runs in a row: 6 passed each time (55 s, 43 s, 40 s). The load average was about 40 from other work on the machine. Not run on Linux locally; thecodex-hostjob runs on Linux.In each Codex case of the first run, the installed plugin's
.venvand itsbin/pythonwere created about 0.4 s before setup returned. Nothing recreated them during the Codex sessions, so the cases ran on setup's build.Control on a copy of the plugin, run offline. It builds the environment as setup does (
uv sync --frozen --quiet,UV_PYTHON= the repository's Python 3.13), then runs the hooks'uv run --frozen --quiet --project <plugin> python:UV_PYTHONforuv runbin/pythoninode), runs 3.13pyvenv.cfg3.11.13), runs 3.11make checkpasses.Self-review (code-review, high): no findings.
AI usage statement
Claude Code (Claude Opus 5.5) checked the interpreter handling, made the change, ran the verification above and wrote this description.