Skip to content

feat(OMN-14018): per-run backend pin on context-ROI runner + generation-consumer honor path (ROI tier-flip enrichment) - #1636

Merged
jonahgabriel merged 7 commits into
devfrom
jonah/omn-14018-runner-backend-override
Jul 7, 2026
Merged

jonahgabriel merged 7 commits into
devfrom
jonah/omn-14018-runner-backend-override

Conversation

@jonahgabriel

@jonahgabriel jonahgabriel commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Evidence-Source: OCC#3652

OMN-14018 — per-run backend pin on the context-ROI runner (enables the demonstrable tier-FLIP)

Design authority: docs/plans/2026-07-06-OMN-14011-roi-enrichment-design.md §6. Parent OMN-14011.

Problem

context_roi_scores is fed only by the context-ROI battery, which always routes to the
contract-declared local tier — so the table is single-tier (488 local rows, 100% success) and
nothing is below the 0.5 ROI floor. Path 1 (the honest escalation-skip flip) needs a real
sub-floor cheap_cloud cohort, which requires running the battery pinned to a genuinely-failing
cloud backend.

Change — the enrichment MECHANISM (real routing, real grading, no fakery)

Runner side

  • ModelContextRoiRunRequest.target_endpoint (optional, default empty).
  • HandlerContextRoiRunner threads it onto every generation command as forced_endpoint_ref (only
    when non-empty; empty leaves the command shape byte-identical).
  • run_context_roi_battery.py --target-endpoint → target_endpoint.

Generation-consumer side (so the pin is REAL, not an inert field)

  • ModelNodeGenerationRequest.forced_endpoint_ref (optional, default empty).
  • handle() pins the STARTING route to the forced backend's tier via _forced_starting_route, which
    resolves the concrete model + endpoint through the same routing authority (delta with
    min_tier_name) the escalation path already uses. Fail-safe: an unresolvable ref keeps the
    contract-declared route (never crashes). Empty ref = byte-identical to prior behavior.

Evidence

  • 5 new tests, all exercised through the real routing authority (no mocked routing):
  • uv run pytest tests/unit/nodes/node_generation_consumer/ tests/nodes/node_context_roi_runner/ tests/unit/scripts/ → 510 passed.
  • ruff + mypy --strict clean; full pre-commit clean (incl. check-no-faked-boundary OMN-13502 +
    leaked-literals OMN-10580).

Honest scope — what is NOT in this PR

This lands the mechanism. The live sub-floor capture (≥5 real graded cheap_cloud rows with
success_rate < 0.5) and the observed escalation-skip A/B on the stability runtime are gated on
the ticket's own Blocked-by: OMN-14001/#1629 merged AND the stability lane redeployed with this
code + OMNIDASH_ANALYTICS_DB_URL set (a Mac onex delegate cannot reach .201 Postgres — LAN grant).
No synthetic rows were authored; when #1629 lands and the lane is redeployed, the battery can be run
pinned to cloud-glm/cloud-gemini-flash to capture the real cohort and observe the flip.

Refs OMN-14018, OMN-14011.

Evidence-Ticket: OMN-14018

…on consumer honors it

The context-ROI battery only ever routed to the contract-declared local tier, so
context_roi_scores held a single tier (488 local rows, 100% success). To capture
genuine per-tier graded outcomes (a real sub-floor cheap_cloud cohort for the
demonstrable escalation-skip flip, OMN-14011 Path 1) a run must be pinnable to a
chosen backend.

Runner side:
- ModelContextRoiRunRequest.target_endpoint (optional, default empty).
- HandlerContextRoiRunner threads it onto every generation command as
  forced_endpoint_ref (only when non-empty; empty preserves the command shape).
- run_context_roi_battery.py --target-endpoint flag → target_endpoint.

Generation-consumer side (so the pin is REAL, not an inert field):
- ModelNodeGenerationRequest.forced_endpoint_ref (optional, default empty).
- handle() pins the STARTING route to the forced backend's tier via
  _forced_starting_route, which resolves the concrete model+endpoint through the
  SAME routing authority (delta with min_tier_name) the escalation path already
  uses. Fail-safe: an unresolvable ref keeps the contract-declared route (never
  crashes). Empty ref = byte-identical to prior behavior.

Tests (5 new, all through the real routing authority — no mocked routing):
- runner threads/omits forced_endpoint_ref by target_endpoint presence;
- forced cloud pin makes generation attempt #1 post to the CLOUD tier's
  model+endpoint (vs contract-local); empty preserves local; bad ref falls back
  to local without crashing. 510 pass across gen-consumer + runner + scripts.
- ruff/mypy --strict clean; check-no-faked-boundary + leaked-literals gates pass.

NOTE (honest scope): this lands the enrichment MECHANISM. The live sub-floor
capture (≥5 real cheap_cloud rows) + observed escalation-skip A/B is gated on
OMN-14001/#1629 merged AND the stability-lane runtime redeployed with this code +
OMNIDASH_ANALYTICS_DB_URL set (the ticket's own Blocked-by). No synthetic rows
were authored.

Refs OMN-14018, OMN-14011.
@coderabbitai

coderabbitai Bot commented Jul 6, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 41 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6025aad2-76ab-449f-aaf0-a8cba1f61f33

📥 Commits

Reviewing files that changed from the base of the PR and between 3dccb3c and 8435a9d.

📒 Files selected for processing (7)
  • scripts/run_context_roi_battery.py
  • src/omnimarket/nodes/node_context_roi_runner/handlers/handler_context_roi_runner.py
  • src/omnimarket/nodes/node_context_roi_runner/models/model_context_roi_run_request.py
  • src/omnimarket/nodes/node_generation_consumer/handlers/handler_generation_consumer.py
  • src/omnimarket/nodes/node_generation_consumer/models/model_generation.py
  • tests/nodes/node_context_roi_runner/test_handler_context_roi_runner.py
  • tests/unit/nodes/node_generation_consumer/test_generation_rides_ladder_omn13359.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jonah/omn-14018-runner-backend-override

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

@github-actions
github-actions Bot enabled auto-merge July 6, 2026 18:40
@github-actions

github-actions Bot commented Jul 6, 2026 •

Copy link
Copy Markdown

⚠️ Architectural Review — WARNINGS

Errors: 0
Warnings: 1

What this checks

Rule Description
ARCH-TOPIC-001 No hardcoded Kafka topic strings in handler code
ARCH-DI-001 No event_bus=None bypass
ARCH-DI-002 No direct Handler instantiation outside workflow_runner/adapters
ARCH-DI-003 No reinvented DI containers
ARCH-TOPIC-002 contract.yaml topics follow `onex.{cmd

ARCH-DI-002: Direct Handler instantiation (warning)\n\n```\nsrc/omnimarket/nodes/node_context_roi_runner/handlers/handler_context_roi_runner.py:285: result = HandlerContextPackBuilder().handle(request)

src/omnimarket/nodes/node_generation_consumer/handlers/handler_generation_consumer.py:1112: self._effect = HandlerLlmOpenaiCompatible(transport=_Transport())\n```\n\nHandler classes should be wired only in workflow_runner.py or adapter modules. Direct instantiation elsewhere bypasses the contract system.\n\n

Powered by node_pr_review_bot

@github-actions

github-actions Bot commented Jul 6, 2026 •

Copy link
Copy Markdown

✅ PR Review Bot — CLEAN

Findings: 0
Run ID: ``

Required gate: This check blocks merge when verdict is blocking_issue.


Verdict semantics

Verdict Meaning
clean No blocking findings
risks_noted Findings noted; threads passed judge verification
blocking_issue MAJOR/CRITICAL findings not resolved — do not merge

Powered by node_pr_review_bot — Qwen3-Coder-30B reviewer + DeepSeek-R1 judge (OMN-7963)

…te-coverage gate)

Touching node_context_roi_runner activates the contract-state-coverage gate for
it; the two declared terminal output states were asserted only by substring, so
the gate saw them uncovered. Assert the full literal topic names
(onex.evt.omnimarket.context-roi-run-{completed,failed}.v1) in the two emit tests
-- a stronger assertion (exact topic, not substring) that covers both states.
…erlay-countable capture)

_forced_starting_route left endpoint_ref="" (mirroring escalated routes), so the
attempt + run-level benchmark recorded the bare TIER NAME (e.g. 'cheap_cloud') as
endpoint_class. The context_roi_scores row's endpoint_ref = that endpoint_class,
and the ROI overlay maps a row to a tier via tier_for_backend(endpoint_ref) which
resolves a BACKEND id ('cloud-glm' -> cheap_cloud) but returns None for a bare
tier name -> every captured per-tier row would be silently DROPPED, yielding zero
usable sub-floor rows for the OMN-14011 Path-1 flip.

Fix: carry the forced backend id on endpoint_ref. Routing is unaffected —
_call_llm posts to endpoint_url when authority_resolved is True (endpoint_ref is
attribution-only there). Tests now assert the attempt AND run-level benchmark
record the backend id as endpoint_class.

Refs OMN-14018, OMN-14011.
@github-actions

github-actions Bot commented Jul 6, 2026 •

Copy link
Copy Markdown

⚠️ Hostile Reviewer — DEGRADED (informational)

Blocking findings (critical/error): 0
Total findings: 0
Models succeeded: none

Note: All reviewer models failed or were unavailable. Degraded results are informational during the pilot phase (OMN-8524) and do not block merge. Error: cli_review exited non-zero (all models failed or binary error)


Gate semantics (pilot phase)

Verdict Meaning Blocks merge?
passed No critical/error findings No
blocked CRITICAL or ERROR findings found Yes
degraded All models unavailable (infra) No (pilot)

Powered by omniintelligence.review_pairing.cli_review — node-based adversarial review via HandlerLlmCliSubprocess (OMN-8524)

auto-merge was automatically disabled July 7, 2026 18:39

Merge commits are not allowed on this repository

@jonahgabriel
jonahgabriel enabled auto-merge (squash) July 7, 2026 19:14
…-backend-override

# Conflicts:
#	tests/unit/nodes/node_delegate_skill_orchestrator/test_local_dispatch_rejected_content_logged_omn14004.py
@jonahgabriel
jonahgabriel merged commit ce466d9 into dev Jul 7, 2026
61 checks passed
@jonahgabriel
jonahgabriel deleted the jonah/omn-14018-runner-backend-override branch July 7, 2026 21:37
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