Skip to content

feat(runtime): Phase D real-model E2E lane with retained evidence artifact - #81

Merged
hardcoreerik merged 3 commits into
masterfrom
feat/native-runtime-e2e-lane-evidence
Jul 20, 2026
Merged

feat(runtime): Phase D real-model E2E lane with retained evidence artifact#81
hardcoreerik merged 3 commits into
masterfrom
feat/native-runtime-e2e-lane-evidence

Conversation

@hardcoreerik

@hardcoreerik hardcoreerik commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • Closes Phase D's remaining DoD item: "the lane runs green on a real reference box and emits a retained evidence artifact." The negative fail-closed test (feat(runtime): Phase D negative test — admission denial fails closed, no Ollama fallback #78) and cancellation leg (fix(runtime): recycle a role's executor after any failed generation, not just NoKvSlot #79) already landed; this closes the happy-path piece.
  • NativeRuntimeE2ELaneTests drives discovery → real admission (a real OrcScheduler against a real live-queried NativeVramProbe budget — deliberately not the allowUnbudgetedExecution opt-out every other gated lane uses) → adapter lifecycle → real inference → telemetry reads at three stages (before/mid-flight/after), writing a retained JSON evidence artifact regardless of pass/fail.
  • NativeE2ELaneEvidenceStore follows the same convention as the existing evidence stores (schema_version/timestamp_utc/app_version, under .orc/native-e2e-lane/) — a sibling, not a fork of the pattern.

Real hardware result (attached as a captured example, not the artifact itself — that's gitignored/local)

  • 25.7 tok/s, 284ms TTFT, 2.5GB measured VRAM
  • Telemetry surfaced a genuinely correct, interesting distinction: residency (ActiveCount) drops to 0 once the conversation disposes, but the VRAM reservation deliberately stays live with the loaded model rather than releasing — confirming those two lifecycles are intentionally decoupled, not a leak.

Test plan

  • dotnet build OrchestratorIDE.slnx — clean
  • Full suite: 637 passed, 0 failed, 1 skipped (Ollama-parity, needs a running Ollama instance)
  • New E2E lane test passes reliably across 3 repeated real-hardware runs

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added retained native end-to-end evidence artifacts (run result + telemetry snapshots, tokens/TTFT, optional VRAM estimate) saved as schema-versioned JSON with sanitized outputs/errors.
    • Extended Native Runtime v2 Phase D coverage to validate discovery through inference, telemetry collection, and full lifecycle completion.
  • Tests
    • Added a live-environment Native Runtime v2 Phase D end-to-end “happy path” test with bounded execution and evidence verification.
  • Documentation
    • Updated the Native Runtime v2 spec with the latest Phase B/Phase D status and a concrete Phase D evidence-artifact lane description.

…ifact

Native Runtime v2.0 Phase D's remaining DoD item: "the lane runs green on a
real reference box and emits a retained evidence artifact." The negative
fail-closed test (#78) and the cancellation leg (#79) both landed already;
this closes the happy-path piece.

NativeRuntimeE2ELaneTests drives discovery (ModelDepot.Scan) through a REAL
admission decision -- a real OrcScheduler against a real live-queried
NativeVramProbe budget, deliberately not the allowUnbudgetedExecution opt-out
every other gated lane in this workstream uses -- through adapter lifecycle,
real inference, and telemetry reads at three stages (before/mid-flight/after),
writing a retained JSON evidence artifact regardless of pass or fail.

NativeE2ELaneEvidenceStore follows the same schema_version/timestamp_utc/
app_version convention as the existing NativeRuntimeFallbackEvidenceStore and
NativeRuntimeComparisonReportStore, under .orc/native-e2e-lane/ -- a sibling
store, not a fork of the pattern, since this is the successful-run case those
two don't cover (the fallback store only persists non-success outcomes).

Verified on real hardware, 3 repeated runs: 25.7 tok/s, 284ms TTFT, 2.5GB
measured VRAM. The captured telemetry surfaced a genuinely interesting, correct
distinction: residency (ActiveCount) drops to 0 once the conversation disposes,
but the VRAM reservation deliberately stays live with the loaded model rather
than releasing -- confirming those two lifecycles are intentionally decoupled,
not a leak. Full 637-test suite (including every gated real-model lane) stays
green.

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

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c00fb528-0d7a-47b1-b4c7-4a3b496457d6

📥 Commits

Reviewing files that changed from the base of the PR and between aa07f41 and 6d2c745.

📒 Files selected for processing (4)
  • OrchestratorIDE.NativeRuntime/OrchestratorIDE.NativeRuntime.csproj
  • OrchestratorIDE.UnitTests/NativeRuntimeE2ELaneTests.cs
  • OrchestratorIDE/Core/Runtime/NativeE2ELaneEvidence.cs
  • docs/NATIVE_RUNTIME_V2_SPEC.md

📝 Walkthrough

Walkthrough

Adds a retained JSON evidence store, integrates it with a real-model Native Runtime lifecycle test, and updates the Native Runtime v2 specification with the landed Phase D evidence lane.

Changes

Native E2E evidence lane

Layer / File(s) Summary
Evidence contract and persistence
OrchestratorIDE/Core/Runtime/NativeE2ELaneEvidence.cs
Defines telemetry and run-result records, writes schema-versioned JSON artifacts, resolves output directories, and sanitizes output and error text.
Real-model lifecycle test
OrchestratorIDE.NativeRuntime/OrchestratorIDE.NativeRuntime.csproj, OrchestratorIDE.UnitTests/NativeRuntimeE2ELaneTests.cs
Compiles the evidence store and adds an NVIDIA-gated end-to-end test covering discovery, streaming, before/mid-flight/after telemetry, disposal, evidence retention, and resident-count assertions.
Phase D status documentation
docs/NATIVE_RUNTIME_V2_SPEC.md
Records updated Phase B and Phase D implementation status, evidence retention details, telemetry behavior, measured values, and remaining concurrent-role work.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Test as NativeRuntimeE2ELaneTests
  participant Depot as Model depot
  participant Runtime as NativeRoleRuntime
  participant Store as NativeE2ELaneEvidenceStore
  participant Disk as JSON evidence file
  Test->>Depot: scan GGUF model depot
  Test->>Runtime: create runtime with live NVIDIA budget
  Test->>Runtime: capture before telemetry
  Test->>Runtime: stream worker completion
  Test->>Runtime: capture mid-flight and after telemetry
  Test->>Store: write NativeE2ELaneRunResult
  Store->>Disk: persist sanitized JSON evidence
Loading

Possibly related PRs

  • hardcoreerik/TheOrc#72: Provides the live NVIDIA budget probing and nullable budget plumbing used by the E2E runtime setup.
  • hardcoreerik/TheOrc#73: Introduces the reservation and residency telemetry surfaces captured by this evidence lane.
  • hardcoreerik/TheOrc#78: Adds related Phase D admission and fallback coverage and updates the corresponding documentation.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: a Phase D real-model E2E runtime lane with retained evidence.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/native-runtime-e2e-lane-evidence

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
OrchestratorIDE.UnitTests/NativeRuntimeE2ELaneTests.cs (1)

61-90: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

No cancellation/timeout on the real-inference streaming call.

StreamRoleCompletionAsync at Line 70 is awaited with no CancellationToken. A real-hardware stall (driver/GPU issue) during this Phase D validation run would hang the test indefinitely instead of failing with retained evidence.

Suggested fix
+        using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(2));
         ...
-            await foreach (var token in runtime.StreamRoleCompletionAsync(RuntimeRole.Worker, messages, maxTokens: 64))
+            await foreach (var token in runtime.StreamRoleCompletionAsync(RuntimeRole.Worker, messages, maxTokens: 64, cancellationToken: cts.Token))
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@OrchestratorIDE.UnitTests/NativeRuntimeE2ELaneTests.cs` around lines 61 - 90,
Add a bounded cancellation or timeout to the real-inference streaming call in
the test around StreamRoleCompletionAsync, pass its token into the streaming
API, and ensure timeout cancellation is caught so the test records the failure
in errorMessage while preserving retained telemetry snapshots.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/NATIVE_RUNTIME_V2_SPEC.md`:
- Line 656: Update the measurements in the referenced performance text to
include spaces between each numeric value and its unit, such as “284 ms” and
“25.7 tok/s,” while preserving the existing values and wording.
- Around line 14-19: Update the Phase D status paragraph in
NATIVE_RUNTIME_V2_SPEC.md to reflect that the evidence-artifact E2E lane has
landed and passed, using the documented results in the Phase D section. Replace
the “in flight (PR pending)” status and retain only extending the lane to a
second concurrent role as remaining work.

In `@OrchestratorIDE.UnitTests/NativeRuntimeE2ELaneTests.cs`:
- Around line 92-124: Update the NativeE2ELaneEvidenceStore.WriteAsync call in
the NativeE2ELaneRunResult flow to pass the workspace root explicitly, ensuring
the evidence artifact is written under the workspace’s .orc/native-e2e-lane
directory instead of the ApplicationData fallback.

In `@OrchestratorIDE/Core/Runtime/NativeE2ELaneEvidence.cs`:
- Around line 70-82: Update NativeE2ELaneEvidence.WriteAsync so the output
filename timestamp uses UTC, matching the timestamp_utc value produced by
BuildRecord; replace the local-time source in the native_e2e_lane filename while
preserving the existing format and file-writing behavior.

---

Nitpick comments:
In `@OrchestratorIDE.UnitTests/NativeRuntimeE2ELaneTests.cs`:
- Around line 61-90: Add a bounded cancellation or timeout to the real-inference
streaming call in the test around StreamRoleCompletionAsync, pass its token into
the streaming API, and ensure timeout cancellation is caught so the test records
the failure in errorMessage while preserving retained telemetry snapshots.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ce3654a0-3256-480e-a6a8-0442cf17207e

📥 Commits

Reviewing files that changed from the base of the PR and between aa07f41 and fff3aa3.

📒 Files selected for processing (4)
  • OrchestratorIDE.NativeRuntime/OrchestratorIDE.NativeRuntime.csproj
  • OrchestratorIDE.UnitTests/NativeRuntimeE2ELaneTests.cs
  • OrchestratorIDE/Core/Runtime/NativeE2ELaneEvidence.cs
  • docs/NATIVE_RUNTIME_V2_SPEC.md

Comment on lines +14 to +19
> [Phase D](#phase-d--real-model-native-path-proof-lane) is in progress: the negative
> "admission denial fails closed, no silent Ollama substitution" test (§3.4, PR #78) and the
> cancellation leg (PR #79 — found and fixed a real bug in the process, see the Phase D section
> below) have both landed as always-on tests, one of them hardware-gated. The evidence-artifact
> E2E lane (discovery through telemetry, with a real admission budget and a retained JSON
> artifact) is in flight (PR pending). Still open: extending that lane to a second concurrent

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Update the Phase D status to match the landed evidence lane.

This block says the evidence-artifact E2E lane is “in flight (PR pending),” but lines 645-657 document it as landed and passing across three runs. Since this is the authoritative shipped-state section, update it to say the lane has landed and leave only the second concurrent role as remaining work.

Proposed correction
-[Phase D](`#phase-d--real-model-native-path-proof-lane`) is in progress: ...
-The evidence-artifact E2E lane ... is in flight (PR pending).
+[Phase D](`#phase-d--real-model-native-path-proof-lane`) is in progress: ...
+The evidence-artifact E2E lane ... has landed.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
> [Phase D](#phase-d--real-model-native-path-proof-lane) is in progress: the negative
> "admission denial fails closed, no silent Ollama substitution" test (§3.4, PR #78) and the
> cancellation leg (PR #79 — found and fixed a real bug in the process, see the Phase D section
> below) have both landed as always-on tests, one of them hardware-gated. The evidence-artifact
> E2E lane (discovery through telemetry, with a real admission budget and a retained JSON
> artifact) is in flight (PR pending). Still open: extending that lane to a second concurrent
> [Phase D](`#phase-d--real-model-native-path-proof-lane`) is in progress: the negative
> "admission denial fails closed, no silent Ollama substitution" test (§3.4, PR `#78`) and the
> cancellation leg (PR `#79` — found and fixed a real bug in the process, see the Phase D section
> below) have both landed as always-on tests, one of them hardware-gated. The evidence-artifact
> E2E lane (discovery through telemetry, with a real admission budget and a retained JSON
> artifact) has landed. Still open: extending that lane to a second concurrent
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/NATIVE_RUNTIME_V2_SPEC.md` around lines 14 - 19, Update the Phase D
status paragraph in NATIVE_RUNTIME_V2_SPEC.md to reflect that the
evidence-artifact E2E lane has landed and passed, using the documented results
in the Phase D section. Replace the “in flight (PR pending)” status and retain
only extending the lane to a second concurrent role as remaining work.

Comment thread docs/NATIVE_RUNTIME_V2_SPEC.md Outdated
Comment thread OrchestratorIDE.UnitTests/NativeRuntimeE2ELaneTests.cs
Comment thread OrchestratorIDE/Core/Runtime/NativeE2ELaneEvidence.cs
hardcoreerik and others added 2 commits July 19, 2026 21:36
Three real, valid findings from the first genuine CodeRabbit pass under the
new .coderabbit.yaml config:

1. No bound on the real streaming call -- a hardware stall would hang the test
   indefinitely instead of failing with retained evidence. Added a 2-minute
   CancellationTokenSource.
2. Evidence was written to %AppData% instead of the repo's .orc/native-e2e-lane/
   convention every other evidence store in this workstream uses, because
   WriteAsync was never given a workspaceRoot. Added a FindRepoRoot() helper
   (walks up from the test binary looking for OrchestratorIDE.slnx) and passed
   it through. Verified: evidence now lands under the actual repo, confirmed
   on a real run.
3. The evidence filename used DateTime.Now while the record's own timestamp_utc
   field used UtcNow -- inconsistent, and could sort wrong across machine
   timezones. Now captures one DateTimeOffset.UtcNow and threads it through both.

Also fixed a minor unit-spacing nitpick in the spec doc (284ms -> 284 ms,
2.5GB -> 2.5 GB).

Skipped one suggestion: CodeRabbit's prompt asked the spec's Phase D banner to
say the E2E lane "has landed" -- this PR isn't merged yet, so that would be
the overclaiming this whole workstream has deliberately avoided. Left as
"in flight (PR pending)," accurate as of this commit.

Re-verified on real hardware: full 637-test suite green, E2E lane test passes
with evidence now correctly retained in the repo.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Three real nits from the cloud multi-agent review, all verified against
current code before fixing:

1. NativeE2ELaneRunResult dropped the exception TYPE on failure, only keeping
   ex.Message -- forking the sibling NativeRuntimeFallbackEvidenceStore
   pattern this store's own doc claims to follow (that one captures both
   ErrorType and ErrorMessage). A failed run's evidence couldn't distinguish
   an admission denial from a native load crash from a timeout. Added
   ErrorType, populated as ex.GetType().Name, threaded through to the JSON
   record.

2. Assert.Multiple unconditionally indexed snapshots[1]/[2] assuming 3
   entries, but the mid-flight snapshot is only appended once a token is
   actually yielded -- a failure BEFORE the first token (an admission denial
   or native load failure, exactly the case this lane's real, non-opted-out
   admission is designed to exercise) leaves Count at 2, and the unconditional
   index would throw ArgumentOutOfRangeException, burying the real failure
   already surfaced via `success`/`errorMessage` under confusing noise.
   Guarded the count-dependent asserts behind an explicit count check.

3. Two doc-only contradictions in NATIVE_RUNTIME_V2_SPEC.md, both introduced
   across this PR and earlier commits: the Phase B addendum still said "PR
   #77, in flight" after #77 had actually merged; and this PR's own Phase D
   section said the E2E lane "landed" while the banner correctly said "in
   flight (PR pending)" -- fixed the stale #77 reference to "landed", and
   reworded the Phase D section to match the banner's honest "PR pending"
   framing rather than claim this PR landed before it's merged.

Re-verified on real hardware: full 637-test suite green, E2E lane test passes
with error_type now present (null on the successful run) in the retained
evidence artifact.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@hardcoreerik

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@hardcoreerik

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.


Your plan includes PR reviews subject to rate limits. More reviews will be available in 23 minutes.

@hardcoreerik

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@hardcoreerik
hardcoreerik merged commit 3bd6983 into master Jul 20, 2026
2 checks passed
@hardcoreerik
hardcoreerik deleted the feat/native-runtime-e2e-lane-evidence branch July 20, 2026 13:37
hardcoreerik added a commit that referenced this pull request Jul 20, 2026
… criteria (#83)

Maps each of NATIVE_RUNTIME_V2_SPEC.md §6's entry criteria to a concrete,
evidence-bearing campaign phase (HV-0..HV-6) across the real three-machine
fleet: NewcorePC (Warchief, RTX 5070 Ti 16GB), HardcorePC (RTX 3050 6GB),
HardcoreLaptopMSI (RTX 4060 8GB). Fleet surveyed live over SSH during
planning (GPUs, drivers, repo paths/states verified, both remotes synced to
master @ aa07f41); pinned test-GGUF distribution to both workers initiated
with SHA-256 recorded for per-box verification.

Honest blockers listed up front: HardcorePC's unresolved native-lib
regression is a hard HV-0 precondition (and doubles as the campaign's first
real diagnosability exercise), the laptop's CUDA-redist bundling must be
verified per-box, and PR #81/#82 must merge first. The plan produces the §6
EVIDENCE only -- the flip itself stays gated on an explicit recorded product
decision, per the spec.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
hardcoreerik added a commit that referenced this pull request Jul 20, 2026
CodeRabbit finding: ROADMAP.md's banner still said the E2E lane was "built,
verified on real hardware, and pending merge" while CURRENT_STATE.yaml's
parallel note omitted that qualifier entirely -- inconsistent, and now stale
either way since PR #81 actually merged. Updated both to say landed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
hardcoreerik added a commit that referenced this pull request Jul 20, 2026
…endum + D (#82)

* docs: sync ROADMAP/CURRENT_STATE with Native Runtime v2.0 Phase B addendum + D

Both files still described Phase B's cost-estimate half as deliberately
deferred and Phase D as untouched -- stale since PR #76 (cost estimate), #77
(load-time measurement), #78 (negative fail-closed test), and #79
(cancellation-corruption fix) all landed since the last sync. Updates the
Native Runtime v2.0 direction table in ROADMAP.md and the native_runtime note
in CURRENT_STATE.yaml to reflect current reality: Phase B fully landed
(estimate + measurement), Phase D essentially complete pending the E2E
evidence-lane PR (#81, open).

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

* docs: mark E2E evidence lane landed (PR #81 merged), not pending

CodeRabbit finding: ROADMAP.md's banner still said the E2E lane was "built,
verified on real hardware, and pending merge" while CURRENT_STATE.yaml's
parallel note omitted that qualifier entirely -- inconsistent, and now stale
either way since PR #81 actually merged. Updated both to say landed.

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

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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