Orchestrata Ultimate › Plans › briefs › pi-orchestra
PI-ORCHESTRA — make the wheel installable, and make the proper install stick
Source: plans/briefs/pi-orchestra.md at 8a2cb42ad · last changed 2026-10-20 · first committed 2026-10-20 · 210 lines.
Prose pending.
Plan text
PI-ORCHESTRA — make the wheel installable, and make the proper install stick
Authority: Mohamed's ruling 2026-10-20, verbatim: "python is 3.14t and if love
install is sym links or in place, no, i want a propper install", and on the torch
defect "Fix it so the wheel is installable". Upstream: the coordinator commit that
landed [tool.hatch.build.targets.wheel] packages = [...], removed the .envrc
PYTHONPATH export, and re-based tests/conftest.py's provenance guard on PEP 610
(see that commit message for the measurements). Lesson L26:
docs/lessons/L26-import-shadow-contaminated-proof.md.
Model routing: openrouter/qwen/qwen3-coder-next, explicit model= (Mohamed's
session ruling; stated override of RUL-026's sonnet default). The coordinator re-runs
every VERIFY before commit.
Already done — do NOT redo or revert: all three top-level packages
(orchestrata_ultimate, orchestrata_tools, orchestrata_ast) now ship in the wheel;
.venv is a proper non-editable install (direct_url.json →
"editable":false, no _editable_impl_*.pth); .envrc no longer exports PYTHONPATH;
the suite's provenance guard reads PEP 610 direct_url.json.
Guard corpus (restated — L7):
- RUL-001/005: never pytest-xdist. Run tests ONLY via
python scripts/run_tests.py <paths>orscripts/run_tests_streaming.py. RUL-009: runs are observed. RUL-032: never re-run a recorded green to decorate a report. - RUL-002: no mocks/monkeypatch/skips/fakes. RUL-003: env keys via
os.environ.get(...)at call time; the required infra-endpoint keys (REDIS_HOST/PORT,KG_*,MEMGRAPH_URI,CXP_GRPC_PORT) have NO default and RAISE — never give them one. - RUL-037: Python only as
.pyfiles through editor tools; nopython -c, no heredocs, no shell redirects into source. - The suite is hard-pinned to
env/test.env(ORCHESTRATA_ENV_PROFILE=test). - Fence discipline: ONLY the files your packet names. A concurrent session is committing
to this same branch (
components) — nevergit add -A, never commit, never push, never rebase. If you find a fence file already modified by someone else, STOP and report it rather than editing through it.
PACKET A — torch is a feature dependency declared as a core one, and it makes the wheel uninstallable
GOAL. orchestrata_ultimate's wheel cannot be installed by any consumer from a
normal index, because a CORE runtime dependency is torch==2.12.1+cpu — a local-version
wheel that exists only on https://download.pytorch.org/whl/cpu. PEP 621 metadata has no
field for an index, and uv's [tool.uv.sources] / [[tool.uv.index]] are NOT published
into the wheel, so a consumer resolving the wheel's own metadata finds nothing that can
satisfy +cpu. Measured:
uv pip install orchestrata_ultimate-1.5.0-py3-none-any.whl → "Because there is no
version of torch==2.12.1+cpu … we can conclude that your requirements are unsatisfiable."
codetools only ever resolved it because it depends on a GIT source, where this repo's own
pyproject.toml is present during resolution.
Move the local-embedding stack behind an optional extra so the BASE distribution resolves from PyPI alone, and make dev/test keep working (they use the local backend).
Measured facts — verify each yourself before editing (L19: do not trust this text):
pyproject.toml:torch==2.12.1+cpuandsentence-transformers>=2.7.0are in[project] dependencies;tokenizers>=0.23.1is in the same chain with a long comment about cp314t free-threading and the GIL.[tool.uv.sources] torch = { index = "pytorch-cpu" };[[tool.uv.index]] name = "pytorch-cpu" url = "https://download.pytorch.org/whl/cpu" explicit = true.- Exactly ONE module imports torch:
src/orchestrata_ultimate/semantic_graph/embedders.py, and it imports it LAZILY inside a method (device resolution), never at module level. Its top-level imports are stdlib +anyio+httpx+ a local exceptions module. semantic_graph/embedder_factory.py:SEMANTIC_EMBED_BACKEND=openrouteris the DEFAULT;SentenceTransformerEmbedderis constructed only whenembed_backend(env) == "local".env/dev.envandenv/test.envsetSEMANTIC_EMBED_BACKEND=local;env/prod.envsetsopenrouter. So dev and test NEED the local stack; prod does not.tests/semantic_graph/test_embedder_factory.pyassertsisinstance(embedder, SentenceTransformerEmbedder)— the local path IS tested.
Design constraints (these are the ruling, not suggestions):
- The base wheel must resolve from PyPI with no extra index. Verify by installing the built wheel into a clean venv.
- dev and test must keep the local backend working, so the dev dependency group must pull the extra. Prod stays on openrouter and gets a LIGHTER install — that is a benefit, name it in the change's own comments.
- Keep
[tool.uv.sources]/[[tool.uv.index]]so uv consumers of the extra still get the CPU wheel rather than the ~6.3 GB CUDA chain the existing comment rejects. Document that a non-uv consumer installing the extra must pass--extra-index-url https://download.pytorch.org/whl/cpu. - Free-threading is load-bearing here (SPEC-023;
tools/codebase_tools.py's_assert_free_threaded()guard). The existing comment records thattokenizers<0.23.1 re-enables the process-wide GIL when pulled transitively viasentence-transformers → transformers. Moving that chain out of the DEFAULT install shrinks the GIL-risk surface for prod — preserve every version floor and that reasoning verbatim in the new location. Do not relax a pin. - Name the extra for what it enables (
local-embeddingsunless measurement shows an existing naming convention in this repo that beats it — if so, follow the convention and say which).
FENCE — Packet A:
- EDIT
pyproject.toml(dependencies → optional-dependencies + dev group; keep the sources/index tables; preserve the GIL/tokenizers reasoning) - EDIT
uv.lockONLY by runninguv lock— never by hand - EDIT
env/dev.env,env/test.env,env/prod.envONLY if a comment there names the dependency set and becomes wrong; do not change endpoint values - EDIT
docs/page(s) that state the install command or the dependency set, if any do — MEASURE first (grep -rn "uv sync\|sentence-transformers\|torch" docs/ AGENTS.md) and list in your reply exactly which you changed and which you deliberately left - CREATE nothing under
src/— this packet moves declarations, not code
Explicit negatives: do NOT touch tests/conftest.py, .envrc,
[tool.hatch.build.targets.wheel] (just landed), [project.scripts], or anything in
src/. Do NOT change SEMANTIC_EMBED_BACKEND values. Do NOT weaken the
_assert_free_threaded() guard or any GIL check.
VERIFY (paste verbatim):
cd /home/mohamed/workspace/wt-COMPONENTS
uv lock
rm -rf /tmp/opencode/piA-dist && uv build --wheel -o /tmp/opencode/piA-dist
unzip -l /tmp/opencode/piA-dist/*.whl | grep -oE " (orchestrata_[a-z]+)/" | sort -u # still all three
rm -rf /tmp/opencode/piA-venv && uv venv /tmp/opencode/piA-venv --python 3.14t
# THE POINT OF THE PACKET — the base wheel resolves with no extra index:
env -u PYTHONPATH uv pip install --python /tmp/opencode/piA-venv/bin/python /tmp/opencode/piA-dist/*.whl
uv sync --dev --no-editable
grep -n "SEMANTIC_EMBED_BACKEND" env/test.env
ORCHESTRATA_ENV_PROFILE=test python scripts/run_tests.py tests/semantic_graph/ --skip-gates
ORCHESTRATA_ENV_PROFILE=test python scripts/run_tests.py tests/core/threading/ --skip-gates # GIL guard lane
uv run --no-sync ruff check pyproject.toml 2>/dev/null; uv run --no-sync ruff check src/ tests/ | tail -3
Expected: uv lock clean; all three packages still in the wheel; the clean-venv install of
the BASE wheel SUCCEEDS with no --extra-index-url (this is the acceptance criterion — if
it still fails on torch, the packet is not done); tests/semantic_graph/ green with the
local backend still constructed (report the count); the GIL/threading lane green.
Known non-defect, do not chase: scripts/run_tests.py may print a git_sentinel
❌ ("a test wrote to the repository", a moved components ref) while the tests themselves
report N passed, 0 failed. A CONCURRENT session is committing to this branch during runs;
the sentinel attributes an external commit to the test. Report the test counts and name the
sentinel line as this known artifact — do NOT "fix" it and do not weaken the sentinel.
DONE WHEN: the base wheel installs into a clean 3.14t venv from PyPI alone; dev/test
still exercise the local embedder; prod's declared install no longer carries torch; every
version floor and the GIL reasoning survive verbatim; uv.lock regenerated by uv lock;
the five RUL-034 items addressed for a dependency-declaration change (no @traces apply —
this is packaging, deliberately untraced per the two-lane rule; docs updated where they
state the dependency set; wiki update is the coordinator's, not yours). Reply with: files
changed, every VERIFY output verbatim, the extra's final name, and anything you could not
execute faithfully, NAMED.
PACKET B — make the proper install stick, so it cannot silently drift back to editable
GOAL. uv sync installs the project and every workspace member EDITABLE by default
(uv's own docs, [tool.uv] package: "Packages are built and installed into the virtual
environment in editable mode"). The ruling wants a proper install, so the non-editable
mode must be the DEFAULT here, not something one person remembers to pass. uv sync
honours UV_NO_EDITABLE (measured in uv sync --help: --no-editable … [env: UV_NO_EDITABLE=]). Make every path that creates or refreshes an environment in this repo
produce a non-editable install, and make the requirement visible where a reader would look.
MEASURE FIRST, then edit only what you measured. Inventory every place an environment is created or synced, and report the full list in your reply whether or not you change it:
grep -rn "uv sync\|uv pip install\|uv run\b" --include="*.sh" --include="*.py" --include="*.md" --include="*.toml" --include="*.yaml" --include="*.yml" --include=".envrc" . | grep -v "\.venv/\|__pycache__\|/plans/ast-"
grep -rn "UV_NO_EDITABLE\|--no-editable" . --include="*" 2>/dev/null | grep -v "\.venv/\|__pycache__"
Also inventory the worktree-provisioning path — this project's rule (RUL-021) is that every
worktree gets its OWN full env, and there is a provisioning script for it
(scripts/provision_worktree_env.py per ADR-0118's Tier-1 list; confirm it exists and read
it before editing). A worktree provisioner that runs a bare uv sync will re-create an
editable install and undo this packet.
Design constraint: prefer setting UV_NO_EDITABLE=1 where environments are MADE
(.envrc for interactive shells, the provisioner, any deploy/install script) over editing
dozens of uv sync call sites — but if a call site runs where no .envrc is loaded (a
systemd unit, a container build, CI), that site needs the flag or the env var explicitly.
Name which mechanism you used for each site and why. Do NOT introduce a wrapper script that
replaces uv sync unless measurement shows the call sites are too many to make consistent —
if you do introduce one, it must be wired into every site you found, not left as an option.
FENCE — Packet B:
- EDIT
.envrc(add the env var with a comment naming the ruling and the incident; the PYTHONPATH removal comment already there is the model for the tone and the evidence) - EDIT the worktree/env provisioning script(s) you measured
- EDIT
AGENTS.mdand anydocs/page that states the install/sync command (measure which) - EDIT
env/{dev,test,prod}.envONLY if that is where this repo's shells/tooling actually read build-env vars from — justify in your reply, or leave them alone - CREATE nothing under
src/
Explicit negatives: do NOT touch pyproject.toml or uv.lock (Packet A owns them, and
it runs concurrently — if you need a dependency change, report it, do not make it). Do NOT
touch tests/conftest.py's provenance guard. Do NOT change endpoint values in env/*.env.
Do NOT commit or push.
VERIFY (paste verbatim):
cd /home/mohamed/workspace/wt-COMPONENTS
grep -n "UV_NO_EDITABLE" .envrc
# a fresh shell-like environment produces a NON-editable install with no explicit flag:
env -u PYTHONPATH bash -lc 'cd /home/mohamed/workspace/wt-COMPONENTS && uv sync --dev >/dev/null 2>&1; cat .venv/lib/python3.14t/site-packages/orchestrata_ultimate-*.dist-info/direct_url.json'
ls .venv/lib/python3.14t/site-packages/ | grep -iE "editable|\.pth$" # no _editable_impl_*.pth
ls -d .venv/lib/python3.14t/site-packages/orchestrata_*/ # all three, real dirs
env -u PYTHONPATH .venv/bin/orchestrata-discover --help | head -3 # orchestrata_tools verb works
env -u PYTHONPATH .venv/bin/ast-sync --help | head -3 # orchestrata_ast reachable
ORCHESTRATA_ENV_PROFILE=test python scripts/run_tests.py tests/core/config/ --skip-gates
Expected: direct_url.json shows "editable":false after a bare uv sync (that is the
acceptance criterion — the default must now be proper); no _editable_impl_*.pth; all three
packages present as real directories; both console scripts OK with no PYTHONPATH.
DONE WHEN: a bare uv sync in this repo yields a non-editable install; every
environment-creating path you measured is covered or explicitly reported as out of reach
with the reason; the requirement is documented where a new session would read it
(AGENTS.md + .envrc); no out-of-fence edits. Reply with: the measured inventory of
uv sync/uv pip install call sites (all of them, changed or not), the mechanism chosen
per site, files changed, every VERIFY output verbatim, and anything you could not execute
faithfully, NAMED.