Skip to content

Interface check fails when the champion's .venv differs from its uv.lock - #99

Merged
Thykof merged 3 commits into
mainfrom
feat/probe-hides-unlocked-packages
Nov 20, 2026
Merged

Thykof merged 3 commits into
mainfrom
feat/probe-hides-unlocked-packages

Conversation

@Thykof

@Thykof Thykof commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Stacked on #98 (base feat/probe-at-sha-in-leg-env); review that one first.

What

#98 runs the interface check in the leg's sandbox with the workspace .venv. The scoring does not use that venv: it builds the environment with uv sync from pyproject.toml and uv.lock at the nominated commit. So a package installed with uv pip install and never locked passes the check and is missing at scoring.

Before starting the container, probe_in_sandbox now compares the venv with the commit's lock on the host (venv_differences). The check fails, naming each difference, when:

  • the commit has no uv.lock;
  • the venv holds a distribution uv.lock does not list (PEP 503 names), or lists at another version (lock entries without a version, such as a dynamic-version project, are not compared);
  • a top-level site-packages entry was installed by no distribution (a hand-written .pth, a copied package). uv's own _virtualenv.pth/_virtualenv.py and __pycache__ are exempt.

The message tells the agent to uv add what the champion needs and commit, uv sync to drop the rest, and delete what no package installed. Constitution rule 7 says the same.

Why a strict comparison rather than hiding unlocked packages

The first version hid unlocked packages from the champion at import time, so unused extras would not fail the check. Two review rounds found blind spots in hiding at runtime:

  • find_spec raising inside libraries that probe optional dependencies (transformers);
  • shadowing the champion's own modules;
  • setuptools/hatchling editable finders;
  • cmeel's code-driven .pth paths;
  • binary .pth package data;
  • the importlib_metadata backport;
  • PathFinder lookups by class.

A host-side comparison has none of these. It also catches version drift, for example a CUDA build of torch installed over the locked one.

The trade-off: a venv carrying unused, unlocked packages now fails the check, where hiding would have passed it. The fix is uv sync.

Checks

  • On synced uv venvs (synth-lib and five other projects) the comparison finds no difference, in 0.1–0.8 s. On venvs out of date with their lock it names the drifted versions and unlocked packages.
  • New tests cover each branch, and each mutation of the comparison (version check, versionless entries, ownership, uv's venv files, name normalization, the early return) fails at least one of them.
  • pytest tests: 612 passed, 1 skipped (Docker stubbed, as in Interface check: at every nominated commit, in the leg's own sandbox #98).
  • black 26.5.1 / flake8 7.1.2 clean on the changed files.

Not yet run against a real campaign workspace venv (Linux, root-owned); it needs a smoke run on a campaign host, like #98.

🤖 Generated with Claude Code

https://claude.ai/code/session_016kmUsyYSEMPGiwbSuvR9hh

Thykof and others added 2 commits November 19, 2026 14:04
The driver used to check a nomination once, when agent/CHAMPION first
appeared, on the working tree, with the harness's Python. It now checks
the commit CHAMPION names each time that commit changes, names it in
BUDGET.md, and checks a failed commit again when the agent exits.

The monte-carlo probe clones the workspace at that commit (only what its
refs reach, as the verdict's bundle) and, when the leg is sandboxed and
the workspace has a .venv, runs simulate() in the leg's image without
network, with that venv mounted read-only and its interpreter. Without a
sandbox or a .venv it runs on the host and says so.

A kind's probe now receives the leg's LegSandbox (None on the host) in
place of the interpreter path. The fake CLI commits its champion and
nominates the real commit. The constitution tells agents the check reads
the nominated commit with their .venv, and that the scoring rebuilds the
environment from pyproject.toml and uv.lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016kmUsyYSEMPGiwbSuvR9hh
The sandboxed check runs the workspace .venv, while the scoring builds the
environment from pyproject.toml and uv.lock at the nominated commit. Before
starting the container, compare the two on the host: a commit without
uv.lock, a distribution the lock does not list or lists at another version,
or a site-packages entry no distribution installed fails the check, naming
each difference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016kmUsyYSEMPGiwbSuvR9hh

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@Thykof
Thykof changed the base branch from feat/probe-at-sha-in-leg-env to main November 20, 2026 14:27
main's tree equals ce4aae2, this branch's base, so the branch's tree is kept unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016kmUsyYSEMPGiwbSuvR9hh
@Thykof
Thykof merged commit 3efaeb0 into main Nov 20, 2026
4 checks passed
@Thykof
Thykof deleted the feat/probe-hides-unlocked-packages branch November 20, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant