Repository navigation
Conversation
…h, so a pytest.py in the checkout never runs at Stop Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
…m sys.path, and its tests clear VIRTUAL_ENV Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
… no sys.path or PYTHONPATH entry resolves into the checkout Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
This branch has not been deployed
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.
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
The Claude Code and Codex plugins' Stop-time test gate no longer runs a
pytest.pyorpytest/found at the checkout root when it looks for a Python that has pytest.Why
When the server's
code.test_gateanswer names a pytest test and the checkout has no virtualenv,hooks/loom-test-gate.mjsranpython3 -c "import pytest"(thenpython) with the checkout as its working directory. With-c, Python puts the working directory first onsys.path, so apytest.pyorpytest/at the checkout root was imported, and its code run, at Stop. Checked here: in a directory holding apytest.pythat writes a file,python3 -c "import pytest"creates the file.The probe now runs
python3 -c "import pytest"(thenpython) from the plugin's ownlib/directory instead of the checkout. With-c, Python puts the working directory onsys.path, and an empty or relativePYTHONPATHentry (PYTHONPATH=:/opt/lib,.,src) resolves against it too; from the plugin's directory none of them reaches the checkout. The probe keeps the user's site-packages and absolutePYTHONPATHentries, which-Iand-Ewould drop, and works on every Python version, which-P(3.11+) does not. Running it outside the checkout also keeps apython3executable in the checkout from being the one started on Windows, where the working directory is searched first.checkoutPythonmoves from the hook intolib/test-gate.mjs, besidevenvPython, so it can be unit-tested; it takes an optionalexecfor the test.Scope and risk
Plugin hook code:
lib/test-gate.mjsandhooks/loom-test-gate.mjsin the Claude Code plugin, their synced Codex copies, both manifests (1.2.22 → 1.2.23, a version no other open PR uses), andtests/test-gate.test.mjs. The virtualenv lookup is unchanged (it only checks that.venv/bin/python,venv/bin/pythonor$VIRTUAL_ENV's interpreter exists; it never runs it). The hook still only names the interpreter to the agent; it never runs tests itself.Compatibility, rollout and rollback
Tests
integrations/claude-code-plugin/tests/test-gate.test.mjs: a checkout with apytest.pythat writes a marker file;checkoutPythonleaves no marker. The marker test also setsPYTHONPATHto:.:srcwith a secondpytest.pyundersrc/. A second test checks the probe's arguments and that its working directory is outside the checkout. Both clearVIRTUAL_ENVwhile they run, since an active virtualenv is used before the probe.node --test integrations/claude-code-plugin/tests/*.test.mjs: 611 passed.scripts/codegen/agent_plugin_sync.py --check: copies current. Biome format and Prettier clean.tests/unit/test_codex_plugin.pyand the other plugin and hook unit tests: 240 passed.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code found the issue while checking the plugin's data-handling text, reproduced it, and wrote the fix and tests.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make format-check,make lint,make typecheckandmake test-unitpass; the integration suite passes if server behaviour changed. (Ran the plugin and plugin-related unit tests above; no server change.)python3 scripts/codegen/agent_plugin_sync.py).hooks/,lib/,bin/,skills/,.mcp.json, the Codexplugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code