Skip to content

[obvious-fleet] Orchestrator: prove the deterministic local stub path on a committed packet - #253

Merged
SamGu-NRX merged 2 commits into
alphafrom
obv/burst5-20261015-bs-orchestrator-fixture
Oct 16, 2026
Merged

SamGu-NRX merged 2 commits into
alphafrom
obv/burst5-20261015-bs-orchestrator-fixture

Conversation

@obvious-autobuild

Copy link
Copy Markdown

fleet-packet: burst5-20261015-bs-orchestrator-fixture

What changed and why

Proves the orchestrator's deterministic local path on one committed capture packet, through its supported local entry point — python -m server.orchestrator.cli run-local — with stage stubs enabled and no Modal, GPU, network or credentials. Two additions, no production code touched and no defaults altered:

  • backend/server/orchestrator/tests/data/packets/synthetic-meter.tar — a 10 KB committed synthetic packet (deterministic tar, mtime 0): one keyframe, one meter still, meter tap, scale reference. Built following the repo's tracked-fixture precedent (reads.stub.json also lives under the ignored tests/data/ path).
  • backend/server/orchestrator/tests/test_local_fixture_proof.py — three tests:
    • test_committed_packet_runs_to_a_terminal_verdict — the packet produces a run (status=done, outcome_kind=manual_review, failure_code=None, packet_sha256 matching the stored packet bytes), stage records for every stage reaching done, exactly one terminal event (verdict_ready), and the result artifacts the API consumes (run.artifacts["result/result.json"] fetched from storage and validated as ResultResponse, plus review.html, preview.ply, verdicts/verdict.C.json). A spy on runner.stage_callable asserts the stubbed stages from the actual execution trace.
    • test_same_packet_twice_is_deterministic — two runs of the same committed tar agree on all eleven stage outcomes and on the SHA-256 of verdicts/verdict.C.json, result/result.internal.json and scene/scene.json bytes.
    • test_stage_failure_is_recorded_data_not_a_crash — with the supported injection seam HSS_ORCH_TEST_FAIL_STAGE=scale:compute_error:2, run-local still exits 0, the run records failure_code=stage_exhausted:scale:compute_error with outcome_kind=manual_review, the scale stage record shows failed after retries, exactly one terminal failed event is emitted, and the manual-result path publishes a schema-valid result/result.json — failure as data, not an uncaught coordinator crash.

Every stubbed stage is named: validate, poses, objects, reads, scale, dense, coverage, scene, objects_3d, criteria, result — the eleven of graph.STAGE_NAMES, each served by server/orchestrator/stubs/<stage>.py, asserted equal to the traced stub set in the test.

How I verified it

Worked in a fresh clone on a shared repo sandbox (cmp_rISlQZhQ, the agent-routing-kit sandbox; its GitHub token covers SamGu-NRX repos). Baseline before my change: 153 passed. After:

Command Result
uv run --frozen pytest server/orchestrator/tests -q 156 passed (153 baseline + 3 new)
HSS_ORCH_STAGE_STUBS=1 uv run --frozen pytest server/orchestrator/tests -q 156 passed (orchestrator stub suite)
make lint (ruff check, ruff format --check, lint-imports) clean; "Contracts: 5 kept, 0 broken"

The stubs-enabled suite is the honest sandbox proof, compared with attempting the real GPU pipeline:

Stub path (this PR) Real GPU pipeline
What runs server/orchestrator/stubs/<stage>.py for all eleven stages server.<stage>.run real modules
Hardware CPU, in-process (InlineExecutor) Modal L4/A100-40GB, real reconstruction
Network / credentials none Modal token, external vision calls
Determinism byte-identical artifacts across runs model outputs, not byte-stable
What it proves the coordinator, state, storage, events, retries, failure table and API artifact contract — the wiring the vision/geometry quality, which is the server team's evals domain, not the coordinator's

The stub path is the honest proof here because the claim under test is the orchestrator's local path — that a finalized packet yields a run, stage records, a terminal outcome, and API-consumable artifacts, and that stage errors are recorded rather than crashing the coordinator. Those are coordinator properties, and the stubs exercise the real coordinator, real StateStore/LocalFsStorage, the real events and outcomes table, and the real runner publish path (_publish writes actual bytes into captures/{cap}/runs/{run}/…). Swapping in the real GPU pipeline would not strengthen any of those assertions; it would add Modal credentials, network, GPU cost and nondeterminism, none of which this sandbox can honor. run-modal was not called (a Modal token absent, b the test patches modal_available to fail the run if anything reaches for Modal); make fixtures (network fetch of .fixtures/ tars) was not run — the packet is committed instead.

What is not verified

  • The real GPU stages: server.validate, server.poses, … real reconstruction, scene merge and criteria on a real capture. Stub verdicts are always manual_review, so a real clear/retake outcome path through the API is unverified here.
  • run-modal against a deployed Modal app (modal_functions.remote), prewarm/heartbeat under real Modal latency, and the sweeper's stale-run recovery in a multi-container deployment.
  • iOS capture → real packet bytes; the fixture packet is synthetic (minimal JPEG marker bytes).
  • make ci end to end (schemas, hygiene, evals) — the orchestrator suite and backend lint were run targeted, per the task; the known pre-existing failures on the base (e.g. server/eval gates per PR fix(backend): address Greptile review findings on the orchestrator #251's notes) were not re-run.

Assumptions

  • "The orchestrator's supported local entry point" = cli.run-local (the README's "Run locally" path). The tests call main([...]) in-process, which is the same code path as the module invocation.
  • "A committed fixture" = committing the synthetic tar; the README's .fixtures/packets/eth3d-electro.tar is network-fetched by make fixtures, so it cannot anchor a hermetic test.
  • The stage-failure case uses the repo's own supported injection seam (HSS_ORCH_TEST_FAIL_STAGE, as existing tests do) rather than monkeypatching coordinator internals — no production defaults changed, env only.
  • PR fix(backend): address Greptile review findings on the orchestrator #251 (orchestrator review fixes: amendment packet_uri, confirmation hook, retry entered_at, verdict profile) was read and deliberately not re-fixed or re-tested here; this PR is additive and touches none of its files.
  • Committed fixture under the ignored tests/data/ path follows the tracked-file precedent (reads.stub.json, backend/data/fixtures/**), avoiding a .gitignore change.
  • One empty trailer commit (adf8cc8) carries the required Co-authored-by: obvious-autobuild[bot] trailer, since the content commit f0df5cd was already pushed and force-push is not allowed.

SamGu-NRX and others added 2 commits October 15, 2026 10:23
…itted packet

One committed synthetic packet (tests/data/packets/synthetic-meter.tar)
drives run-local — the supported local entry point — with all eleven
stage stubs, no Modal, GPU, network or credentials. Asserts the run,
eleven done stage records, one terminal verdict event, the API-consumed
result artifacts, byte-identical determinism across two runs, and that
an exhausted stage lands as recorded failure data (manual result
published, failed event emitted) instead of a coordinator crash.
Previous commit f0df5cd (test(orchestrator): prove the deterministic
local stub path on a committed packet) is this same change.

Co-authored-by: obvious-autobuild[bot] <262744130+obvious-autobuild[bot]@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 44cd68dd-1ccd-45ae-841b-7635708d7bfc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the size:L 100-499 effective changed lines. label Oct 15, 2026
@obvious-autobuild

Copy link
Copy Markdown
Author

Independent review (Obvious, Autobuild + Max)

Verdict: ready — ready to move out of draft. Two additive files only (backend/server/orchestrator/tests/data/packets/synthetic-meter.tar, backend/server/orchestrator/tests/test_local_fixture_proof.py), no production code touched, no defaults altered. No blocking findings; two low-severity body-wording items below.

Findings (ranked by severity)

  1. Low — body wording, no code change. The body says reads.stub.json "also lives under the ignored tests/data/ path." The path is not git-ignored: git check-ignore -v matches no pattern for either committed file, and neither .gitignore nor backend/.gitignore contains a tests/data rule. The substance survives — committing needs no .gitignore change, and the tracked-fixture precedent is real (backend/server/orchestrator/tests/data/reads.stub.json is tracked). Smallest fix: drop the word "ignored" from the body.
  2. Low — body wording, no code change. The body cites the seam "HSS_ORCH_TEST_FAIL_STAGE, as existing tests do." Existing tests inject via the Python parameter, not the env var (build_services(tmp_path, "memory", test_fail_stage=...) at server/orchestrator/tests/test_run.py:222 and server/orchestrator/tests/test_round2.py:166). The env var itself is a genuinely supported config path — server/orchestrator/config.py:62 picks it up, and on the local path InlineExecutor._fail_code (server/orchestrator/executor.py:101) consumes it — so the seam claim holds. Smallest fix: delete "as existing tests do" or reword.

No code findings. Correctness, failure handling, scope, and safety check out (below).

What I verified (fresh clone, head adf8cc87; merge-base 57f57ff8 == base head feat/port-house-scanning-server)

  • Diff scope: git diff --stat $(git merge-base HEAD origin/feat/port-house-scanning-server)..HEAD → exactly the two new files (10240-byte tar + 197-line test). Nothing else.
  • Fixture integrity: tar -tvf shows epoch-0 mtimes (deterministic tar as claimed); packet.json declares sha256 for both media files and both match the actual bytes (sha256sum keyframes/k0.jpg stills/s1.jpg). Contents match the body: one keyframe, one meter still (purpose: meter_close), meter tap, scaleReference.
  • Suites (from backend/, uv sync --locked first):
    • uv run --frozen pytest server/orchestrator/tests -q → 156 passed (8.6s)
    • HSS_ORCH_STAGE_STUBS=1 uv run --frozen pytest server/orchestrator/tests -q → 156 passed (6.0s)
    • With the two PR files removed (equivalent to base, since merge-base == base head) → 153 passed. The delta is exactly the 3 new tests; no regression. Files restored, tree clean.
    • make lint → clean; "Contracts: 5 kept, 0 broken."
  • The tests bite on the real path (temporary local mutations, each reverted immediately):
    • No-op'ing InlineExecutor._fail_code (the seam the failure case actually exercises on the local path — not the coordinator's worker-path _injected_failure, which I no-op'd first and the test still passed, further confirming it drives the local executor) → test_stage_failure_is_recorded_data_not_a_crash fails (run completes done instead of recording stage_exhausted:scale:compute_error).
    • Making runner._publish write empty bytes → test_committed_packet_runs_to_a_terminal_verdict fails (JSONDecodeError validating result/result.json) — the artifact assertions read real stored bytes, not just recorded keys.
  • Failure-as-data contract: cli.run_local returns 0 after writing run.json/events.jsonl regardless of run status (verified in server/orchestrator/cli.py), so "exit 0, failure recorded as data" is the handler's real behavior, and scale failing at attempt ≥ 2 with exactly one terminal failed event is asserted and passing at head.
  • Modal guard is real: cli.py:27 imports modal_available at module level, so the monkeypatch target exists; the local path uses memory state, local storage and InlineExecutor(config=orch, stubs=True) — nothing reaches Modal.
  • README contract: backend/server/orchestrator/README.md "Run locally" pins exactly the test's LOCAL_ENV (STATE_BACKEND=memory STORAGE_BACKEND=local HSS_ORCH_STAGE_STUBS=1 VISION_EXTERNAL_CALLS=off SMP_ENVIRONMENT=dev) and the python -m server.orchestrator.cli run-local entry point.
  • Determinism, beyond the test's in-process check: two separate CLI processes with PYTHONHASHSEED=0 vs PYTHONHASHSEED=12345 produced byte-identical verdicts/verdict.C.json, result/result.internal.json, scene/scene.json and result/result.json, and identical 11-stage outcomes (done / manual_review / failure_code=None).
  • PR state: CI has no failing checks (label check passes; review bots skip drafts). The only existing comment is CodeRabbit's skip notice — nothing unanswered.

What I couldn't verify

  • The real GPU stages and the Modal path — by design out of scope for this PR, and the body's "What is not verified" section states that accurately (stub verdicts are always manual_review, so clear/retake outcomes, real iOS packet bytes, and make ci end-to-end remain unproven here).
  • Nothing else: every claim the body presents as verified reproduced cleanly in a fresh clone.

@SamGu-NRX
SamGu-NRX changed the base branch from feat/port-house-scanning-server to alpha October 16, 2026 04:29
@SamGu-NRX
SamGu-NRX marked this pull request as ready for review October 16, 2026 04:29
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T04:33:42.090033Z adf8cc8 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@SamGu-NRX
SamGu-NRX merged commit 885e9d6 into alpha Oct 16, 2026
6 checks passed
@codemetrics-ai

Copy link
Copy Markdown

Note

Review skipped

Codemetrics is installed on this repository, but it hasn't been added to your team yet.

To enable AI code reviews for this repo, go to your dashboard and add BaseScanning to your team's repositories.

@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Low impact] Adds test data and a test for the local orchestrator stub.

The PR appears safe to merge, with two non-blocking gaps in what the new tests enforce.

Fix All in Claude CodeFindings

  1. P2 Modal guard misses remote calls ▶
  2. P2 Missing files pass the comparison ▶
Fix with agent prompt
### Issue 1
backend/server/orchestrator/tests/test_local_fixture_proof.py:52-56
The `no_modal` fixture patches `cli.modal_available`, but `run-local` reaches Modal through `modal_spawn.launch_modal`, which imports `modal_functions.modal_available` directly. The guard cannot detect that path. If a developer's shell sets `HSS_ORCH_MODAL_REMOTE=1`, these tests can attempt a remote call despite the guard. Patch the function used by `launch_modal` and raise immediately if called; also pin remote execution off for these local tests.

### Issue 2
backend/server/orchestrator/tests/test_local_fixture_proof.py:164-166
The digest comparison filters the keys already present in `run["artifacts"]`, so it silently skips missing files. If both runs omit `result/result.internal.json` or `scene/scene.json`, the test still passes without comparing those promised outputs. Iterate over the three required keys and index each one directly so a missing file fails the test.

```suggestion
                key: hashlib.sha256(_stored(out, run["artifacts"][key])).hexdigest()
                for key in ("verdicts/verdict.C.json", "result/result.internal.json", "scene/scene.json")
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds a committed synthetic packet and three tests for the local stub path.

  • A committed packet proves the local orchestrator path end to end.

Reviews (1) · Last reviewed commit: "chore: add the required co-author traile..." · Reviewed by Greptile

Comment on lines +52 to +56
def _forbidden(*args: Any, **kwargs: Any) -> bool:
touched.append("modal_available")
return False

monkeypatch.setattr("server.orchestrator.cli.modal_available", _forbidden)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Modal guard misses remote calls

The no_modal fixture patches cli.modal_available, but run-local reaches Modal through modal_spawn.launch_modal, which imports modal_functions.modal_available directly. The guard cannot detect that path. If a developer's shell sets HSS_ORCH_MODAL_REMOTE=1, these tests can attempt a remote call despite the guard. Patch the function used by launch_modal and raise immediately if called; also pin remote execution off for these local tests.

Prompt To Fix With AI
This is a comment left during a code review.
Path: backend/server/orchestrator/tests/test_local_fixture_proof.py
Line: 52-56

Comment:
**Modal guard misses remote calls**

The `no_modal` fixture patches `cli.modal_available`, but `run-local` reaches Modal through `modal_spawn.launch_modal`, which imports `modal_functions.modal_available` directly. The guard cannot detect that path. If a developer's shell sets `HSS_ORCH_MODAL_REMOTE=1`, these tests can attempt a remote call despite the guard. Patch the function used by `launch_modal` and raise immediately if called; also pin remote execution off for these local tests.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code Fix in Codex

Comment on lines +164 to +166
key: hashlib.sha256(_stored(out, stored)).hexdigest()
for key, stored in run["artifacts"].items()
if key in {"verdicts/verdict.C.json", "result/result.internal.json", "scene/scene.json"}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Missing files pass the comparison

The digest comparison filters the keys already present in run["artifacts"], so it silently skips missing files. If both runs omit result/result.internal.json or scene/scene.json, the test still passes without comparing those promised outputs. Iterate over the three required keys and index each one directly so a missing file fails the test.

Suggested change
key: hashlib.sha256(_stored(out, stored)).hexdigest()
for key, stored in run["artifacts"].items()
if key in {"verdicts/verdict.C.json", "result/result.internal.json", "scene/scene.json"}
key: hashlib.sha256(_stored(out, run["artifacts"][key])).hexdigest()
for key in ("verdicts/verdict.C.json", "result/result.internal.json", "scene/scene.json")
Prompt To Fix With AI
This is a comment left during a code review.
Path: backend/server/orchestrator/tests/test_local_fixture_proof.py
Line: 164-166

Comment:
**Missing files pass the comparison**

The digest comparison filters the keys already present in `run["artifacts"]`, so it silently skips missing files. If both runs omit `result/result.internal.json` or `scene/scene.json`, the test still passes without comparing those promised outputs. Iterate over the three required keys and index each one directly so a missing file fails the test.

```suggestion
                key: hashlib.sha256(_stored(out, run["artifacts"][key])).hexdigest()
                for key in ("verdicts/verdict.C.json", "result/result.internal.json", "scene/scene.json")
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code Fix in Codex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 effective changed lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant