Skip to content

feat(OMN-12006): inject ContainerBackedDelegationDispatchPort at auto-wiring time - #1749

Closed
jonahgabriel wants to merge 3 commits into
devfrom
jonah/omn-e0-delegation-dispatch-fix
Closed

jonahgabriel wants to merge 3 commits into
devfrom
jonah/omn-e0-delegation-dispatch-fix

Conversation

@jonahgabriel

@jonahgabriel jonahgabriel commented May 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Adds ContainerBackedDelegationDispatchPort to service_delegation_dispatch_port.py — lazy-resolves DirectBridgeDelegationDispatchPort from the DI container at first dispatch() call; falls back to RuntimeDelegationDispatchPort (Pattern B broker) if the bridge port is not registered
  • handler_wiring.py now injects ContainerBackedDelegationDispatchPort (when container is available) instead of RuntimeDelegationDispatchPort directly, so HandlerDelegateSkill gets the in-process bridge path without needing a Kafka consumer
  • Adds _ProtocolDispatchPort Protocol for type-safe resolution of either port implementation

Why lazy resolution

PluginDelegation.start_consumers() runs AFTER wire_from_manifest (auto-wiring). At handler wiring time the bridge is not yet in the container. ContainerBackedDelegationDispatchPort caches the resolved port on first call, so by the time HandlerDelegateSkill.handle() runs (always after all plugins have started), DirectBridgeDelegationDispatchPort is registered and will be used.

Test plan

  • uv run mypy src/omnibase_infra/runtime/service_delegation_dispatch_port.py src/omnibase_infra/runtime/auto_wiring/handler_wiring.py --strict — no issues
  • uv run ruff check src/omnibase_infra/runtime/service_delegation_dispatch_port.py src/omnibase_infra/runtime/auto_wiring/handler_wiring.py — all checks passed
  • tests/unit/runtime/ — 4753 passed, 1 pre-existing flaky performance test (passes on main)

Related

Evidence-Source: OCC#1665
Evidence-Ticket: OMN-12006

@coderabbitai

coderabbitai Bot commented May 25, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@jonahgabriel, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 2 minutes and 16 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

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.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: de828989-587e-44c8-bbbf-8c389acbffd3

📥 Commits

Reviewing files that changed from the base of the PR and between 2a19371 and 377a595.

📒 Files selected for processing (4)
  • src/omnibase_infra/runtime/auto_wiring/handler_wiring.py
  • src/omnibase_infra/runtime/protocols/protocol_delegation_dispatch_port.py
  • src/omnibase_infra/runtime/service_delegation_dispatch_port.py
  • tests/unit/contracts/test_protocol_ownership.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jonah/omn-e0-delegation-dispatch-fix

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

Comment thread src/omnibase_infra/runtime/service_delegation_dispatch_port.py Fixed
…ring time

Replaces direct RuntimeDelegationDispatchPort injection with
ContainerBackedDelegationDispatchPort, which lazy-resolves the
in-process DirectBridgeDelegationDispatchPort from the DI container
at first dispatch() call (after PluginDelegation.start_consumers()
has registered it). Falls back to RuntimeDelegationDispatchPort when
no container or bridge port is available.
- Extract _ProtocolDispatchPort to runtime/protocols/protocol_delegation_dispatch_port.py,
  renamed to ProtocolDelegationDispatchPort (PascalCase, no leading underscore)
- Removes mixed models+protocols in service_delegation_dispatch_port.py (architecture gate)
- Eliminates redundant # type: ignore[union-attr] — mypy is clean against typed Protocol
- Add ProtocolDelegationDispatchPort to KNOWN_INFRA_PROTOCOLS allowlist ([RUNTIME] category)
- Run ruff format on handler_wiring.py
- Stamp schema fingerprint (69 migration files)
@jonahgabriel
jonahgabriel force-pushed the jonah/omn-e0-delegation-dispatch-fix branch from c63d745 to 324a104 Compare May 26, 2026 02:30
wait: bool,
quality_contract_mode: str,
acceptance_criteria: tuple[str, ...],
) -> dict[str, object]: ...
@jonahgabriel jonahgabriel changed the title feat(OMN-E0): inject ContainerBackedDelegationDispatchPort at auto-wiring time feat(OMN-12238): inject ContainerBackedDelegationDispatchPort at auto-wiring time May 26, 2026
@jonahgabriel jonahgabriel changed the title feat(OMN-12238): inject ContainerBackedDelegationDispatchPort at auto-wiring time feat(OMN-12006): inject ContainerBackedDelegationDispatchPort at auto-wiring time May 26, 2026
@jonahgabriel jonahgabriel changed the title feat(OMN-12006): inject ContainerBackedDelegationDispatchPort at auto-wiring time feat(OMN-12006): inject container-backed delegation dispatch port May 26, 2026
@jonahgabriel jonahgabriel changed the title feat(OMN-12006): inject container-backed delegation dispatch port feat(OMN-12006): inject ContainerBackedDelegationDispatchPort at auto-wiring time May 26, 2026
@jonahgabriel
jonahgabriel deleted the jonah/omn-e0-delegation-dispatch-fix branch May 26, 2026 03:48
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.

2 participants