Skip to content

fix(OMN-15180): make backend_id pin reachable from the wire model + register local-coder-mlx in routing tiers - #1904

Merged
jonahgabriel merged 3 commits into
devfrom
jonah/omn-15180-wire-backend-pin-reachability
Jul 26, 2026
Merged

jonahgabriel merged 3 commits into
devfrom
jonah/omn-15180-wire-backend-pin-reachability

Conversation

@jonahgabriel

@jonahgabriel jonahgabriel commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes both halves of OMN-15180 (filed by the OMN-15159 build lane; blocks OMN-15170). Plan: omni_home/docs/plans/2026-07-26-steel-node-dispatch-integration-plan.md.

  1. Wire-model pin reachability. ModelDelegateSkillRequest gains an optional backend_id: str | None = None field (additive; frozen=True, extra="forbid" preserved) and HandlerDelegateSkill.handle() threads it to dispatch_port.dispatch(backend_id=...), reusing the OMN-15156 pin LocalDelegationDispatchPort already implements (resolve_delegation_backend(task_type, backend_id=...), merged feat(OMN-15156): thread optional backend_id pin through LocalDelegationDispatchPort.dispatch() #1897). Before this PR the pin was unreachable from any wire-level caller (e.g. steel's LlmBusDelegationClient, OMN-15159).

    • ProtocolDelegationDispatchPort and RuntimeDelegationDispatchPort (the deployed-bus dispatch port) were updated to accept the new keyword so the shared handler call doesn't TypeError on the bus path.
    • The deployed bus path has no backend_id field on omnibase_core's ModelDelegationRequest and no pin support in HandlerDelegationWorkflow (node_delegation_orchestrator) — threading the pin across the bus boundary is a cross-repo change out of this ticket's scope. A non-None pin on that path now fails loudly with NotImplementedError instead of being silently dropped (the exact "pin drops at a hop" defect class this ticket exists to close).
  2. routing_tiers.yaml registration. local-coder-mlx (registered as a bifrost_delegation.yaml backend by OMN-15155, merged omnimarket#1898) is added to the local tier's models[], mirroring the sibling local-coder/local-ds-v4-flash entries, so task_type-based tier selection (first_eligible_tier → backend_id_for_tier → _select_model_for_task) can reach it too — not just the explicit backend_id pin. Declared after local-coder in file order so unpinned auto-selection is unchanged (verified by regression test).

Unblocks OMN-15170 (steel-side driver test proving a live call reaches .200:8401).

Every hop the pin traverses

ModelDelegateSkillRequest.backend_id
  (src/omnimarket/models/delegation/wire/model_delegate_skill_request.py:126-141)
  -> HandlerDelegateSkill.handle() passes backend_id=request.backend_id
     (src/omnimarket/nodes/node_delegate_skill_orchestrator/handlers/handler_delegate_skill.py:318-323)
  -> ProtocolDelegationDispatchPort.dispatch(..., backend_id: str | None = None)
     (handler_delegate_skill.py:50-65, Protocol updated to match)
  -> LocalDelegationDispatchPort.dispatch(backend_id=...)  [bus-less local path, pre-existing OMN-15156 seam]
     (ports/port_local_delegation_dispatch.py:437-451)
     -> _resolve_initial_backend(task_type, backend_id=backend_id)
        (ports/port_local_delegation_dispatch.py:926-1004)
        -> resolve_delegation_backend(task_type, backend_id="local-coder-mlx")
           (routing/delegation_backend_resolution.py:319-330) -- resolves the EXACT
           pinned backend, bypassing tier_order selection entirely
  -> RuntimeDelegationDispatchPort.dispatch(backend_id=...)  [deployed-bus path]
     (ports/port_runtime_delegation_dispatch.py:81-104) -- a non-None pin raises
     NotImplementedError (fail-loud boundary; caught by HandlerDelegateSkill's
     existing except-Exception handler and surfaced as a "failed" response with
     the explicit reason, never a silent no-op)

Separately, routing_tiers.yaml half: src/omnimarket/configs/routing_tiers.yaml local tier models[] (new entry, mirrors local-coder) → parsed by parse_delegation_config_yaml → consumed by first_eligible_tier/backend_id_for_tier/_select_model_for_task in node_delegation_routing_reducer.

Tests

  • tests/unit/nodes/node_delegate_skill_orchestrator/test_models.py — wire-model round-trip with/without backend_id; frozen/extra="forbid" preserved after the widening.
  • tests/unit/nodes/node_delegate_skill_orchestrator/test_handler.py — handler propagates a non-None pin to the dispatch port; None reaches the port when unset (regression).
  • tests/unit/nodes/node_delegate_skill_orchestrator/test_runtime_dispatch_port.py — RuntimeDelegationDispatchPort fails loudly (NotImplementedError) on a non-None pin, never publishes to the bus.
  • tests/unit/nodes/node_delegate_skill_orchestrator/test_wire_backend_id_reaches_local_coder_mlx_omn15180.py (new) — full wire model -> HandlerDelegateSkill -> LocalDelegationDispatchPort -> resolve_delegation_backend chain selects local-coder-mlx exactly, and bypasses tier-order selection (first_eligible_tier asserted never consulted).
  • tests/test_routing_tiers_contract.py — local-coder-mlx membership in the local tier models[].

Test plan

  • ruff check / ruff format --check on changed files (.200)
  • mypy --strict src/omnimarket/ (.200) — 0 errors
  • pre-commit run --files <changed> (.200, OMNIBASE_INFRA_PATH set) — all hooks pass
  • Targeted pytest: tests/unit/nodes/node_delegate_skill_orchestrator/, tests/unit/delegation/, tests/unit/routing/, tests/test_routing_tiers_contract.py, tests/test_no_ambiguous_duplicate_model_ids.py, golden-chain + integration delegate-skill tests — 879 passed, 2 skipped (.200)
  • CI green (gh pr checks)
  • CodeRabbit threads resolved
  • Deploy-gate / receipt gate — expect OCC companion to self-clear via the live OCC Companion Emitter

Not merging — Codex lands via the merge queue per repo policy.

Summary by CodeRabbit

  • New Features

    • Added optional backend targeting for delegated tasks, enabling deterministic selection of a specific local model.
    • Added support for the MLX-quantized Qwen3.6 coder model for code generation, refactoring, and documentation tasks.
    • Preserved existing automatic, cheapest-first routing when no backend is specified.
    • Unsupported backend targeting on deployed event-bus dispatch now fails clearly.
  • Tests

    • Added coverage for backend selection, routing, serialization, and unsupported dispatch scenarios.

Evidence-Source: OCC#4963
Evidence-Ticket: OMN-15180
Evidence-Commit: 0ec5e7db12ef2658c866e57e443699fd03cb9204

…egister local-coder-mlx in routing tiers

Closes both halves of the OMN-15180 gap surfaced by the OMN-15159 build lane:

1. ModelDelegateSkillRequest gains an optional backend_id: str | None = None
   field (additive, frozen/extra=forbid preserved) and HandlerDelegateSkill.handle()
   threads it to dispatch_port.dispatch(backend_id=...), reusing the OMN-15156
   pin LocalDelegationDispatchPort already implements
   (resolve_delegation_backend(task_type, backend_id=...)). Previously the pin
   was unreachable from any wire-level caller (e.g. steel LlmBusDelegationClient,
   OMN-15159). ProtocolDelegationDispatchPort and RuntimeDelegationDispatchPort
   were updated to match the new keyword; the deployed bus path has no
   backend_id field on omnibase_core ModelDelegationRequest and no pin support
   in HandlerDelegationWorkflow, so a non-None pin there fails loudly
   (NotImplementedError) instead of being silently dropped -- extending the pin
   across the bus boundary is a cross-repo change out of this ticket's scope.

2. routing_tiers.yaml's local tier models[] gains a local-coder-mlx entry
   (mirroring the sibling local-coder pattern) so task_type-based tier
   selection (first_eligible_tier -> backend_id_for_tier ->
   _select_model_for_task) can reach the .200:8401 MLX endpoint registered by
   OMN-15155 too, not just the explicit backend_id pin.

Unblocks OMN-15170 (steel-side driver test proving a live call reaches
.200:8401).

Tests: wire-model round-trip with/without backend_id + frozen/extra=forbid
preserved (test_models.py); handler-to-port pin propagation + None-default
regression (test_handler.py); RuntimeDelegationDispatchPort fail-loud on a
non-None pin (test_runtime_dispatch_port.py); full wire->handler->port->
resolve_delegation_backend pin selecting local-coder-mlx, including a
tier-bypass assertion (test_wire_backend_id_reaches_local_coder_mlx_omn15180.py);
routing_tiers.yaml local-coder-mlx membership (test_routing_tiers_contract.py).
@coderabbitai

coderabbitai Bot commented Jul 26, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Backend Pin Reachability

Layer / File(s) Summary
Wire contract and handler propagation
src/omnimarket/models/delegation/wire/model_delegate_skill_request.py, src/omnimarket/nodes/node_delegate_skill_orchestrator/handlers/handler_delegate_skill.py, tests/unit/nodes/node_delegate_skill_orchestrator/*, tests/test_golden_chain_node_delegate_skill_orchestrator.py
Adds optional backend_id support to the request model and dispatch protocol, forwards it through HandlerDelegateSkill, and updates contract and handler coverage.
Runtime dispatch pin boundary
src/omnimarket/nodes/node_delegate_skill_orchestrator/ports/port_runtime_delegation_dispatch.py, tests/unit/nodes/node_delegate_skill_orchestrator/test_runtime_dispatch_port.py
Rejects non-null backend pins on the event-bus dispatch path before publishing.
Local backend pin resolution
src/omnimarket/configs/routing_tiers.yaml, tests/test_routing_tiers_contract.py, tests/unit/nodes/node_delegate_skill_orchestrator/test_wire_backend_id_reaches_local_coder_mlx_omn15180.py
Registers local-coder-mlx in the local tier and verifies wire-level pins resolve directly to its model, endpoint, and provider without tier selection.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant HandlerDelegateSkill
  participant LocalDelegationDispatchPort
  participant RecordingEffect
  Caller->>HandlerDelegateSkill: Submit request with backend_id
  HandlerDelegateSkill->>LocalDelegationDispatchPort: Forward backend_id
  LocalDelegationDispatchPort->>RecordingEffect: Call pinned local-coder-mlx backend
  RecordingEffect-->>LocalDelegationDispatchPort: Return delegation result
  LocalDelegationDispatchPort-->>HandlerDelegateSkill: Return response
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 61.90% 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
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the two main changes: wire-model backend_id pin support and registration of local-coder-mlx in routing tiers.
✨ 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 jonah/omn-15180-wire-backend-pin-reachability

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

@github-actions

Copy link
Copy Markdown

✅ Architectural Review — PASSED

Errors: 0
Warnings: 0

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

No architectural violations found.

Static architectural lint — no model inference (OMN-14176).

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@src/omnimarket/configs/routing_tiers.yaml`:
- Around line 100-116: Update the routing-tier configuration around
local-coder-mlx so unpinned task-based selection can actually choose this
backend rather than leaving it pin-only. Add an explicit priority or task-class
policy that takes precedence for the intended tasks, and add a resolution-level
assertion covering unpinned selection; otherwise revise the surrounding
ordering/comments to accurately state the supported behavior.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: ac90b2e5-f2c6-4abe-b4e2-6f3a8fd9693d

📥 Commits

Reviewing files that changed from the base of the PR and between b7a9cc2 and 0da8fdd.

📒 Files selected for processing (11)
  • src/omnimarket/configs/routing_tiers.yaml
  • src/omnimarket/models/delegation/wire/model_delegate_skill_request.py
  • src/omnimarket/nodes/node_delegate_skill_orchestrator/handlers/handler_delegate_skill.py
  • src/omnimarket/nodes/node_delegate_skill_orchestrator/ports/port_runtime_delegation_dispatch.py
  • tests/test_golden_chain_node_delegate_skill_orchestrator.py
  • tests/test_routing_tiers_contract.py
  • tests/unit/nodes/node_delegate_skill_orchestrator/test_handler.py
  • tests/unit/nodes/node_delegate_skill_orchestrator/test_models.py
  • tests/unit/nodes/node_delegate_skill_orchestrator/test_runtime_dispatch_port.py
  • tests/unit/nodes/node_delegate_skill_orchestrator/test_tenant_carry_response_to_projection_omn14485.py
  • tests/unit/nodes/node_delegate_skill_orchestrator/test_wire_backend_id_reaches_local_coder_mlx_omn15180.py

Comment thread src/omnimarket/configs/routing_tiers.yaml
@github-actions

Copy link
Copy Markdown

✅ Hostile Reviewer — PASSED

Blocking findings (critical/error): 0
Total findings: 0
Models succeeded: qwen3-review,qwen3-review-b


Gate semantics

Verdict Meaning Blocks merge?
passed >=2 models succeeded, no critical/error findings No
blocked CRITICAL or ERROR findings found Yes
degraded Fewer than 2 models succeeded (infra unavailable/timeout) Yes (OMN-15110)

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

jonahgabriel and others added 2 commits July 26, 2026 07:48
… (CodeRabbit)

CodeRabbit review on PR #1904 correctly flagged that appending local-coder-mlx
to routing_tiers.yaml local tier models[] does not make it the DEFAULT
(first-choice) unpinned selection for code_generation/refactor/document --
_select_model_for_task is first-match-wins in file declaration order, and
local-coder/local-reasoner/local-heavy-reasoning already claim those task
types (mirrors the pre-existing local-ds-v4-flash entry, which has the exact
same characteristic and is not a new defect).

The real task_type-based-tier-selection reachability the registration
provides is the OMN-14402 same-tier backend fallback
(sibling_backend_available_in_tier, wired into
HandlerDelegationWorkflow.handle_inference_response on the deployed bus
path): once local-coder (and, for code_generation, local-ds-v4-flash) fails
with a transport error, the orchestrator retries local-coder-mlx in the SAME
tier before escalating cross-tier to cheap_cloud.

Adds the resolution-level assert CodeRabbit requested
(test_local_coder_mlx_same_tier_fallback_omn15180.py), proven against the
REAL committed routing_tiers.yaml + task_class_contracts.v1.yaml (only the
bifrost endpoint config is a hermetic local fixture), and corrects the
routing_tiers.yaml comment to describe the actual reachability mechanism
instead of implying first-choice selection.
@jonahgabriel
jonahgabriel merged commit d1646b8 into dev Jul 26, 2026
121 of 122 checks passed
@jonahgabriel
jonahgabriel deleted the jonah/omn-15180-wire-backend-pin-reachability branch July 26, 2026 12:30
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