test: fix two local-only test failures caused by leftover state - #1422
Draft
l2ysho wants to merge 1 commit into
Draft
test: fix two local-only test failures caused by leftover state#1422l2ysho wants to merge 1 commit into
l2ysho wants to merge 1 commit into
Conversation
`python_support` left `test/tmp/my-python-actor` behind (`remove: false`), so the next run detected the stale `.venv` as the Python runtime, cached that interpreter path, then deleted it — making the test alternate pass/fail on every other local run. `detectAiAgent` cleared the agent env vars in `afterEach` only, so the first test saw whatever the shell exported and failed inside any agent CLI. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Note
Two test-only fixes for failures that never show up in CI but break
pnpm run test:local. One made the Python test alternate pass/fail on every other run; the other fails for anyone running the suite from inside an AI agent CLI.python_supportalternated pass/failMeasured 5/10 with
--retry=0, deterministic alternation, pre-existing onmaster.useTempPath(..., { remove: false })lefttest/tmp/my-python-actorbehind — the only test in the repo usingremove: false. It was flipped fromtruein fix: python project detection and project detection #774 with no stated reason.usePythonRuntime({ cwd: tmpPath, force: true })found the leftover.venvand cached<tmpPath>/.venv/bin/python3as the interpreter.tmpPath, and so that interpreter..venvcreated, assertion failed.CI never hit it: fresh checkout every job, plus
retry: 3invitest.config.ts.Fix:
remove: true, and deletetmpPathbefore runtime detection so an interrupted run can't leave a venv that gets picked up.detectAiAgentfails inside any agent CLIThe nine agent env vars were cleared in
afterEachonly, so the first test ran against whatever the shell exported. Inside Claude Code (CLAUDECODE=1) it returnedclaude_codeinstead ofundefined. Same for Cursor, Codex, Gemini CLI.Fix: clear them in
beforeEachviavi.stubEnv, restore withvi.unstubAllEnvs(). The olddeletealso leaked — it removedCLAUDECODEfromprocess.envfor every later test in the worker.Verification
python_support: 4/4 consecutive runs with--retry=0without clearingtest/tmp; also passes with a real.venvplanted attest/tmp/my-python-actor/.venv(the exact state that used to fail).detectEnvironment: 7/7 withCLAUDECODE=1set and 7/7 with it unset.--retry=0.🤖 Generated with Claude Code