Skip to content

feat(engines): Lumina routes and view, CliRunner hardening with pinned-executable admission (draft, depends on #139) - #143

Closed
DVOpenLabs wants to merge 8 commits into
feat/lumina-adapterfrom
feat/lumina-wiring
Closed

DVOpenLabs wants to merge 8 commits into
feat/lumina-adapterfrom
feat/lumina-wiring

Conversation

@DVOpenLabs

@DVOpenLabs DVOpenLabs commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Draft for review. Opus APPROVE-WITH-NOTES, Sol APPROVE-WITH-NOTES on the Lumina bytes (943c9a8) and again on the later delta (6ccab7f: docs correction plus the two lifeline test commits) (Sol's earlier HIGH on executable admission is CLOSED under the trusted-caller model below). Depends only on #139 (base feat/lumina-adapter); #139 is unchanged. Merge and release are not authorized.

What

  • /engines/lumina/{formats,status,generate} registered through the existing /engines seam, and a Studio+ (Advanced) "Lumina" view. Format (3mf/png/glb) is an explicit user choice, never inferred; the result is a NEW file created exclusively in a Studio-owned folder; no full path appears in any response; netguard (loopback/LAN) applies. Private image-path guard (local_input.py) is interim; feat: Phase 2 portfolio tracks P2, P4-P8 with shared local-path guard (R4-F1 fixed via #147; Opus+Sol approved f40a18d) #140's shared localpath should replace it.
  • Generic CliRunner hardening: POSIX process group, Windows kill-on-close Job Object, failed-run job-dir removal, slicer-name rail, and identity-based admission.
  • The Lumina HTTP routes do NOT call CliRunner; it has no production caller. It was not wired in only to demonstrate the pin.

Findings by component

HTTP integration (routes_engines.py, local_input.py, UI, mock): Opus O1 (NT \??\ prefix) fixed; O6 wording fixed; O5, O8, O9 carried.
Generic CLI runner (cli_runner.py): Sol HIGH (renamed slicer copy passed a basename check) fixed; Opus O2 (refuse the Windows launcher when frozen), O3 (slicer-name tokens), O10 (-I) fixed; O4, O7 carried.

Executable admission, trusted-caller model

  • sys.executable is exempt and can run arbitrary Python.
  • A pin (approved_sha256) approves exact bytes, not behaviour.
  • The hash is checked at construction only; a later replacement is not detected.
  • A caller must not auto-approve a hash derived from an untrusted request.
    This is a safety rail, not a sandbox, and not a guarantee against slicing.

Review

Round 1 (27c6e4c): Opus AWN; Sol BLOCK HIGH. Round 2 (943c9a8, artifact 5f72698e11ff7966b31845f4de6e87418e22d59e9f87a5d081bec3fd871d7ad5): Opus AWN, Sol AWN with no findings.
Carried, not fixed: Opus N1 (MEDIUM, optional) hash is not re-checked before each run(); N2 in a frozen POSIX build sys.executable is the sidecar and is admitted without a pin; N3 ENGINES.md does not yet state bytes-not-behaviour or the no-auto-approve rule; N4 docs lag the token matching and the packaged-app refusal; N5 no test runs a pinned non-interpreter binary through the launcher; O4, O5, O7, O8, O9.

Evidence labels

fixture-tested and mock-service-tested (synthetic loopback LuminaHttpMock). No real Lumina was run. The matching-pin test is admission-only; lifecycle tests use sys.executable and do not prove an arbitrary pinned binary starts. Python 3.14 locally: engines + ext_routes + routes_engines_lumina + foundation 872 passed, 2 skipped; vitest 1369 and tsc clean at the first freeze. Python 3.13 confirmation is CI's.

🤖 Generated with Claude Code

CI note

The first CI run failed one test, tests/test_lifeline.py::test_noop_when_stdin_is_not_a_pipe ('RegularFileStat' object has no attribute 'st_size'), on ubuntu and windows (Python 3.13). That test patches the process-wide os.fstat; the likely trigger (inferred from the traceback, not reproduced locally) is a thread left by the new runner tests calling os.fstat while it is patched. Two test-only commits cherry-picked from the open PR #134 (0e5c959, 9bd7df7; now 38ce6bb, 117adb5 here) give that test its own os view. They are identical in content to #134, so the later merge is a no-op for them. These two commits were not part of the frozen review artifact; they change one test file only.

Delta review of the post-freeze commits (6ccab7f)

Artifact 5ab465fd; Opus APPROVE-WITH-NOTES, Sol APPROVE-WITH-NOTES (no findings). The two lifeline test commits (38ce6bb, 117adb5) have the same git patch-id --stable as #134's 0e5c959 and 9bd7df7; #134 itself has no formal review, so this is their first review. Reviewers confirmed they isolate only the test's view of os and do not weaken assertions. Notes carried, not fixed: _forbid_thread still patches the shared threading.Thread, so the comment "nothing global is patched" in test_lifeline.py is inaccurate and a sibling race is possible (kept identical to #134 on purpose); the stray runner thread that outlives its test is not fixed (F6/F9 lifecycle follow-ups); ENGINES.md does not state the 64-hex pin format or that symlinks are checked under the target's name.
docs/internal/ENGINES.md now states the admission model as the code implements it: token matching, name rail before identity, sys.executable exempt, pins approve bytes not behaviour, hash read at construction only, no auto-approving an untrusted hash, packaged-Windows refusal, frozen-POSIX sys.executable admitted, and the optional runner changes not done (re-hash before each run, a start test for a pinned non-interpreter binary, narrowing sys.executable in a frozen POSIX build). The Lumina HTTP routes still do not call CliRunner.

DVOpenLabs and others added 4 commits November 1, 2026 09:56
…cy, and Lumina-compatible service route and view

CliRunner stops the whole tree it started (POSIX process group; Windows kill-on-close Job Object), removes the job directory after a failed run, and refuses a slicer-named executable. POST /engines/lumina/{formats,status,generate} and a Studio+ view with an explicit format choice; output is a new file, no path is returned. Mock-service-tested against a synthetic loopback service; no real Lumina exercised. Depends on #139 only.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ecutable, not by name alone

Sol HIGH: a renamed copy of a slicer passed the basename check. Name rail kept;
unpinned executables now refused (executable_not_approved). Tests: renamed copy
refused, pin admits, wrong/malformed pin refused, name rail wins over pin.
Verified: engines+ext_routes+routes_engines_lumina+foundation 865 passed/2 skipped (py3.14).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…imits

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ckage

O1 refuse the NT passthrough prefix (\??\ and /??/) in the local-input guard.
O2 refuse the Windows launcher in a frozen (packaged) build instead of starting the sidecar.
O3 match slicer names by token (Snapmaker_Orca, bambu-studio, UltiMaker-Cura, AppImage names).
O10 run the launcher with -I. O6 evidence-label wording in ENGINES.md.
Deferred, not fixed: O4 close race, O5 default-folder edge, O7 timeout flake, O8 magic bytes, O9 partial file.
Verified: engines+ext_routes+routes_engines_lumina+foundation 872 passed/2 skipped (py3.14).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

DVOpenLabs and others added 3 commits November 1, 2026 10:40
test_noop_when_stdin_is_not_a_pipe replaced os.fstat for the whole process and
test_noop_on_non_posix / the EOF test replaced os.name / os._exit the same way, so any
other caller of os.fstat during the test (pytest, the runtime) saw a stub with no
st_size. CI hit "AttributeError: 'RegularFileStat' object has no attribute 'st_size'".

The tests now give the lifeline module its own os view (a module-local shim) and use a
real temporary regular-file descriptor through start_parent_lifeline(fd=...). The
no-watcher assertion and the real pipe/EOF coverage are unchanged. Test-only; no
product code, skip or suppression.

Verified: py -3.13 -m pytest tests/test_lifeline.py -> 4 passed, 1 skipped (Windows
local). The original CI failure did not reproduce locally, so the process-wide stub is the
cause by inspection, not by reproduction; the Python patch version is not established as
the trigger. Linux and CI results come from this PR's checks.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…test

Review of the first fix found the shim raised TypeError when an override repeated a key
(`_exit`), so the Linux EOF test errored before running. Attributes are now merged into a
dict first. The non-POSIX test passes a real pipe fd so only the os.name check can stop
the watcher.

Verified: Windows py -3.13 pytest tests/test_lifeline.py -> 4 passed, 1 skipped. Linux
(WSL Ubuntu, Python 3.12.3, _lifeline.py + this test in an isolated directory, pytest) ->
5 passed, so the pipe/EOF test ran.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The runner docs said the name rail matched only the basename or "slicer". The code also matches any token of the name
(split on - _ . and space), refuses before identity admission, and exempts sys.executable from the pin. State that,
and state what a pin does and does not mean: bytes not behaviour, read at construction only, never derived from an
untrusted request, and the packaged-Windows and frozen-POSIX cases. List the optional runner changes that are still
not done (re-hash before each run, a start test for a pinned non-interpreter binary, narrowing sys.executable in a
frozen POSIX build). Documentation only; the Lumina HTTP routes still do not call the runner.

Verified the name examples against _executable_policy_refused (orca_v2 and my-cura.bin refused, mycuracao allowed).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
DVOpenLabs added a commit that referenced this pull request Nov 14, 2026
feat: integrated Phase 2 build - Creative/Prepare (#141), cross-track recovery (#142), Lumina (#139+#143), Recovery/Passport slice
@DVOpenLabs

Copy link
Copy Markdown
Owner Author

Landed on main via #144 (merge 15a2ac3) / #140. Verified: merging this head into main produces a tree identical to main, so nothing here is lost. Branch preserved.

@DVOpenLabs DVOpenLabs closed this Nov 14, 2026
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