Orchestrata Ultimate › Plans › briefs › qwen › Q9-report

Q9 Phase A report (ADR-0091) — COMPLETE (Kimi continuation)

Source: plans/briefs/qwen/Q9-report.md at 8a2cb42ad · last changed 2026-10-12 · first committed 2026-10-12 · 275 lines.

Prose pending.

Plan text

Q9 Phase A report (ADR-0091) — COMPLETE (Kimi continuation)

Phase A is done: the two later orchestrator orders are executed (the approved test_install_orchestrata_cc.py expectation verified on disk; the fork now always relinks via ForcedBuildExt), the red-first evidence for the relink test exists (.q9/red-relink-head.txt, .q9/red-relink-index.txt), the venv's janus was rebuilt with the documented command while a stale build/ was in place, and the authoritative forced run over the 61-module target list is green: passed 1546, failed 0, errors 0, skipped 0, reused 0, rc 0.

Done-when (brief §4) — every box ticked, evidence below

Kimi continuation (2026-10-12, executor Kimi)

1. Review of the inherited diffs (brief A.1–A.4, orders 1–2)

git diff HEAD read for all 12 files. Result: no deviations found; nothing needed fixing.

.q9/ held no red for test_fork_build_always_relinks_over_a_stale_build_dir (red2.txt's test_build_janus_ft.py block lists only the six earlier tests), so I produced it per rule 11: saved my setup.py to .q9/save-setup-relink.py (sha256 8e177d60…), wrote git show HEAD:scripts/_janus_patched/setup.py over it, ran only that test through .hostlock.sh, restored (sha256sum match, git diff --stat re-verified). Two reds captured:

3. Rebuild of the venv's janus (documented command, build/ in place)

scripts/_janus_patched/build/ was present (stale, from earlier builds). Command (as docs/free-threaded-prolog.md now documents):

env -u PYTHONPATH -u PYTEST_ADDOPTS -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
  CC=/usr/bin/gcc CXX=/usr/bin/g++ SWIPL=/home/mohamed/.guix-profile/bin/swipl \
  uv sync --reinstall-package janus-swi

Output: ~ janus-swi==1.5.3 (from file:///home/mohamed/workspace/wt-JANUS-SWIPL/scripts/_janus_patched), run rc=0. The order-2 ForcedBuildExt relinked despite the stale build/. readelf -d .venv/lib/python3.14t/site-packages/janus_swi/_swipl.cpython-314t-x86_64-linux-gnu.so:

 0x0000000000000001 (NEEDED)             Shared library: [libswipl.so.9]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000001d (RUNPATH)            Library runpath: [/home/mohamed/.guix-profile/lib/swipl/lib/x86_64-linux]

RUNPATH is the declared profile's lib dir, unresolved, no /gnu/store/.

4. Targets and the forced run

affected_tests.py --json --files <12 Phase A files>: escalate: false, 62 entries, untested: ["scripts/_janus_patched/setup.py"] (noted; tests/scripts/test_build_janus_ft.py covers it with real builds). Union with /tmp/claude-1001/aff.txt (identical 62 words) and tests/deploy/test_install_orchestrata_cc.py (already in the set); dropped tests/conftest.py; replaced the directory entry tests/infrastructure with tests/infrastructure/test_kernel_infra.py (the only test_*.py under it). Final list: 61 modules in .q9/final-targets.txt.

Authoritative forced run (detached, lock acquired 05:27:43):

env -u PYTHONPATH -u PYTEST_ADDOPTS bash .run_exclusive.sh --force --json <61 modules>

GREEN: 0 failed, 0 errors, 0 skipped, reused 0, rc 0.

5. Lint, syntax, types, staging, gate

6. git diff --cached --stat

 deploy/toolchain.sh                              |  34 ++--
 docs/free-threaded-prolog.md                     |  31 ++-
 env/toolchain.env                                |  30 ++-
 scripts/_janus_patched/setup.py                  |  41 +++-
 scripts/worktree_toolchain.py                    |  37 +++-
 src/orchestrata_ultimate/core/janus_bootstrap.py | 135 +++++++++----
 tests/core/test_janus_bootstrap.py               | 244 ++++++++++++++++-------
 tests/deploy/test_envrc_toolchain.py             |  24 ++-
 tests/deploy/test_install_orchestrata_cc.py      |  11 +-
 tests/deploy/test_toolchain_sh.py                | 136 ++++++++++---
 tests/scripts/test_build_janus_ft.py             | 229 +++++++++++++++++++++
 tests/scripts/test_worktrees_provision.py        | 101 ++++++++--
 12 files changed, 849 insertions(+), 204 deletions(-)

7. Friction


(Previous sections — Qwen + Sonnet builder, kept for the record)

STOP reason (RESOLVED by orchestrator order 1 + this continuation)

Authoritative forced run: test_totals passed 1544, failed 1, errors 0, skipped 0; reused 0; rc=1. The single failure is tests/deploy/test_install_orchestrata_cc.py::test_sync_stage_uses_the_declared_compilers (line ~245). It asserts the old echo line toolchain: CC=/usr/bin/gcc CXX=/usr/bin/g++ (from <decl>); A.1 requires load_toolchain's echo to name SWIPL, so the line is now toolchain: CC=... CXX=... SWIPL=/home/mohamed/.guix-profile/bin/swipl (from <decl>) (the failure output shows exactly that). That file is outside Phase A's list (rule 8), so I did not edit it. Needed: in that test, expect the SWIPL segment (read it via worktree_toolchain.declared_toolchain(...)["SWIPL"]). Then re-run it.

→ The orchestrator APPROVED exactly that edit (order 1); it is on disk, verified against the order (Kimi §1), and the forced re-run is green (Kimi §4: 1546 passed, 0 failed).

Deviations I found in Qwen's work and fixed

Changes per file (all as A.1–A.4)

Red-first (A.5)

Qwen's .q9/red-*.txt were written after source edits began, so I discarded them. My cycle: saved the 6 impl files (.q9/save/, sha256 in .q9/save.sha), wrote git show HEAD:<file> over each, ran the five test modules (scripts/run_tests_streaming.py through .hostlock.sh; output .q9/red2.txt), restored (first restore silently failed on an interactive cp prompt; redone with /bin/cp -pf, sha256sum -c all OK, git diff --stat shows the 6 files modified). Red at HEAD implementation:

A.6

  1. Rebuild: the brief's command SWIPL=... uv sync --reinstall-package janus-swi did NOT relink (rc=0, RUNPATH still /gnu/store/ss98ppl…; also failed with Guix gcc when CC unset). Cause: git-ignored scripts/_janus_patched/build/ keeps the old .so, setuptools sees sources unchanged. I moved build/ aside to .q9/janus-build-old and ran with CC=/usr/bin/gcc CXX=/usr/bin/g++ and include vars unset: uv rc=0. readelf -d .venv/lib/python3.14t/site-packages/janus_swi/_swipl.cpython-314t-x86_64-linux-gnu.so: NEEDED libswipl.so.9, RUNPATH Library runpath: [/home/mohamed/.guix-profile/lib/swipl/lib/x86_64-linux]. FINDING: the documented rebuild (uv sync --reinstall-package janus-swi) is insufficient on a host with an existing build/; docs/deploy must remove it (for the orchestrator to decide; prod installs from a tree without build/ only if fresh). → RESOLVED by orchestrator order 2: the fork now forces relinking, and Kimi §3 re-ran the documented command WITH a stale build/ in place: rc=0, RUNPATH /home/mohamed/.guix-profile/lib/swipl/lib/x86_64-linux.
  2. Systemd PATH, from /tmp, no ORCHESTRATA_LIBSWIPL/SWIPL (re-measured by Kimi 05:26 after the rebuild): /home/mohamed/.guix-profile/lib/swipl/lib/x86_64-linux/libswipl.so.9 {'truth': True, 'X': 42} {'truth': True}
  3. Affected set (affected_tests.py --json --files <11 files>): escalate false, 62 tests; it lists tests/conftest.py and the dir tests/infrastructure (not runnable targets, first run: all 62 modules rc=1, 0 tests — PYTEST_ADDOPTS plugin import without PYTHONPATH, D18; the brief's run command lacks env -u). Second run: env -u PYTHONPATH -u PYTEST_ADDOPTS bash .run_exclusive.sh --force --json <60 modules + tests/infrastructure/test_kernel_infra.py, conftest dropped>: test_totals passed 1544 / failed 1 / errors 0 / skipped 0, reused modules 0 tests 0, run_tests rc=1 (the STOP failure above). The affected tool also noted scripts/_janus_patched/setup.py has no own test file; tests/scripts/test_build_janus_ft.py covers it. → Kimi §4 re-ran with the 61-module list (12 files incl. the approved test): passed 1546, failed 0, errors 0, skipped 0, reused 0, rc=0.
  4. ruff rc=0 (All checks passed), black --check rc=0 (7 files unchanged, after fix), pyright rc=0 (0 errors), bash -n deploy/toolchain.sh rc=0. 11 Phase A files git added; scripts/gate.py review-staged: rc=0, "commit review: PASS, 6 review(s), no blocking findings". → Kimi §5 re-ran on the 12 staged files: ruff rc=0 (non-fork), black --check rc=0, pyright rc=0, bash -n rc=0, review-staged PASS 7 reviews rc=0.
  5. Inventory of swipl invocations:
    • Build time: fork setup.py -> _find_swipl.swipl_properties(SWIPL) runs <SWIPL> --dump-runtime-variables; a bare except falls back to find_swipl() which returns None on linux (so a bad SWIPL yields props None); now SWIPL must be absolute+executable first.
    • Run time, fork: janus/__init__.py calls _swipl.initialize("swipl", ...) — argv[0] string only, no process spawn; _find_swipl is used at import only on win32. Measured under systemd PATH: current_prolog_flag(home) = /gnu/store/ss98ppl…-swi-prolog-9.3.8/lib/swipl (resolved from the loaded library), version 90308; swipl is not on that PATH (command -v empty).
    • Run time, ours: janus_bootstrap._path_from_dump_runtime_variables (runs only the declared absolute SWIPL now); _path_from_janus_ldd runs ldd. code_intel.py literals swipl finds no declared "swipl" literal; codebase_tools._parse_swipl_json only parses text. deploy/provision_environments.sh runs swipl --version inside the dev/test/prod prolog containers (not the host PATH).
  6. Untracked/changed outside Phase A (not staged): plans/ast-*.json are regenerated by edit hooks; .hostlock.sh, .run_exclusive.sh, .q9/, the brief.

Tooling friction (hooks, not worked around)