Repository navigation
fix(workspace): let the worktree import hook serve the canonical venv - #1362
Merged
Merged
Conversation
#1355 runs a worktree's commands in the workspace container with UV_PROJECT_ENVIRONMENT set to the clone root's venv, so sys.prefix is <clone>/.venv and the import hook left sys.path alone. make codegen then imported the clone root's Aug 31 roboco: fe-doc committed a stale verb table into every push of f28b1d75 and fe-pm bounced the PR six times. When sys.prefix is a clone root's own .venv, the hook now points the clone root's sys.path entries at the worktree the process runs in. Co-Authored-By: Claude Opus 5.5 <[email protected]> Entire-Checkpoint: 01M6FQR4576061DZE7ZB7MEBX7
|
Thanks for opening your first pull request on RoboCo! Quick checklist before review (most of these are enforced by CI, but worth a glance):
See CONTRIBUTING.md for the full workflow and the Code of Conduct for the community standards we follow. Welcome aboard — a maintainer will review shortly. |
rennf93
marked this pull request as ready for review
November 3, 2026 03:39
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Follow-up to trail #65 (change 213): since #1355,
make codegenin a task worktree imports the clone root's code instead of the worktree's.What happened
On the live run of 2026-11-03, task f28b1d75 (PR #1359, two doc files) went round the PM review six times:
codegen_command(make codegenfor roboco-api) before it goes out (git.py_run_codegen_and_commit).UV_PROJECT_ENVIRONMENTset toreadlink -f .venv, which is the clone root's venv (workspace_container.py:89,138). Sosys.prefixis<clone>/.venv.sys.prefixis<clone>/.worktrees/<id>/.venv(worktree_imports.py_worktree_whose_venv_is), so it leftsys.pathalone and the script imported the clone root'sroboco.agents/prompts/_generated/verbs.mdas blob c3870cb3. The PR base, slave and master all hold eca32f19.i_documented, fe-pm sent it back ("PR diff holds only CHANGELOG.md and docs/positioning/..."), and fe-dev-2 reverted. PR [f28b1d75] Write ETR positioning note and CHANGELOG entry #1359 has 6 of each.Fix
When
sys.prefixis a clone root's own.venv, the hook now points the clone root'ssys.pathentries at the worktree that holds the working directory. The container already runs the command there (-wis the worktree). A process outside.worktrees/<id>, or a prefix that is not that clone's.venv, is left alone as before. A vanished working directory counts as none.Behavior change: code run in a worktree on the canonical venv imports the worktree's source. Nothing else changes. #1355 stays as it is, since reverting it brings back worktree paths in the shared venv's shebangs.
Not in this PR: why the clone roots stopped fast-forwarding to slave after Aug 31. I didn't check.
Verified
tests/unit/services/test_workspace_worktree_imports.py: a parametrized one for the canonical prefix (6 cases), and one that runs a script in a worktree through the clone root's venv python and checks it imports the worktree's package. On the old hook, 3 of them fail (3 failed, 17 passed). With the fix:20 passed.pytest tests/unit/services/ -k 'workspace or worktree':331 passed, 4266 deselected.ruff checkandruff format --checkclean, mypy clean on both files, xenon exits 0, vulture and bandit report nothing,verify_codebase_map.pyreports 0 errors and 0 warnings, and_complete_map.mdis in sync.