Skip to content

refactor(OMN-10872,OMN-10873): add protocol injection seams to NavigationHistoryReducer and OverseerBenchmarker - #693

Merged
jonahgabriel merged 6 commits into
mainfrom
jonah/omn-10872-di-refactor-nav-history-benchmarker
May 18, 2026
Merged

jonahgabriel merged 6 commits into
mainfrom
jonah/omn-10872-di-refactor-nav-history-benchmarker

Conversation

@jonahgabriel

@jonahgabriel jonahgabriel commented May 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • OMN-10872: Add ProtocolNavigationHistoryWriter (record/close) to handler_navigation_history_reducer.py; HandlerNavigationHistoryReducer.__init__ now accepts ProtocolNavigationHistoryWriter | None instead of the concrete class. Default construction still builds HandlerNavigationHistoryWriter unchanged.
  • OMN-10873: Add ProtocolLlmEvalHarness (handle) to handler_llm_eval_harness.py; NodeOverseerBenchmarker.__init__ now accepts ProtocolLlmEvalHarness | None instead of NodeLlmEvalHarness. Default construction still builds NodeLlmEvalHarness unchanged.
  • Both follow the optional-di-fallback pattern from OMN-10751/10752.
  • New unit tests: test_di_injection_navigation_history_reducer.py (6 tests) and test_di_injection_overseer_benchmarker.py (6 tests) verify protocol satisfaction, injection routing, shutdown propagation, and default-construction fallback.

Verification

  • 4087 tests pass (uv run pytest tests/ -v --tb=short -m "not kafka")
  • uv run mypy src/omnimarket/nodes/node_navigation_history_reducer/ src/omnimarket/nodes/node_llm_eval_harness/ src/omnimarket/nodes/node_overseer_benchmarker/ --strict → success, no issues
  • uv run ruff check src/ tests/ → all checks passed
  • All pre-commit hooks pass

Evidence-Ticket

OMN-10872, OMN-10873

Summary by CodeRabbit

  • New Features

    • Protocol-based dependency injection enabled for navigation history writing and LLM-evaluation harnesses, allowing interchangeable implementations.
  • Tests

    • Added unit tests validating injection paths, runtime protocol checks, and lifecycle behavior for both components.
  • Documentation

    • Added refactor plan and work-tracking contracts documenting the DI seam changes and acceptance criteria.

Review Change Stack

Evidence-Source: OCC#1113
Evidence-Ticket: OMN-10872

…tionHistoryReducer and OverseerBenchmarker

OMN-10872: introduce ProtocolNavigationHistoryWriter with record()/close()
methods; HandlerNavigationHistoryReducer.__init__ now accepts
ProtocolNavigationHistoryWriter | None instead of the concrete class.
Concrete HandlerNavigationHistoryWriter satisfies the protocol structurally.

OMN-10873: introduce ProtocolLlmEvalHarness with handle() method;
NodeOverseerBenchmarker.__init__ now accepts ProtocolLlmEvalHarness | None
instead of NodeLlmEvalHarness. Default construction still works unchanged.

Both follow the optional-di-fallback pattern established in OMN-10751/10752.
New DI injection tests verify protocol satisfaction, injection routing,
shutdown propagation, and default-construction fallback. 4087 tests pass.
@github-actions
github-actions Bot enabled auto-merge May 17, 2026 21:26
@coderabbitai

coderabbitai Bot commented May 17, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d7b98482-2fc1-499c-a33b-041f6f3441af

📥 Commits

Reviewing files that changed from the base of the PR and between 0990379 and 5eb4255.

📒 Files selected for processing (3)
  • docs/plans/2026-05-17-omn-10872-di-refactor-nav-history-benchmarker.md
  • docs/work-tracking/contracts/OMN-10872.yaml
  • docs/work-tracking/contracts/OMN-10873.yaml
✅ Files skipped from review due to trivial changes (2)
  • docs/work-tracking/contracts/OMN-10872.yaml
  • docs/work-tracking/contracts/OMN-10873.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/plans/2026-05-17-omn-10872-di-refactor-nav-history-benchmarker.md

📝 Walkthrough

Walkthrough

This PR implements protocol-based dependency injection refactoring for two handlers: HandlerNavigationHistoryReducer (OMN-10872) and NodeOverseerBenchmarker (OMN-10873). It introduces structural protocols (ProtocolNavigationHistoryWriter and ProtocolLlmEvalHarness), updates handler constructors to accept these protocols instead of concrete types, exports them via public APIs, and provides comprehensive test coverage validating stub injection and call routing.

Changes

Protocol-Based Dependency Injection Refactor

Layer / File(s) Summary
DI Refactor Planning and Scope Documentation
docs/plans/2026-05-17-omn-10872-di-refactor-nav-history-benchmarker.md, docs/work-tracking/contracts/OMN-10872.yaml, docs/work-tracking/contracts/OMN-10873.yaml
Documents the OMN-10872 and OMN-10873 scope and evidence requirements, and adds work-tracking contracts.
LLM Eval Harness Protocol Definition
src/omnimarket/nodes/node_llm_eval_harness/handlers/handler_llm_eval_harness.py
Adds runtime_checkable import and introduces ProtocolLlmEvalHarness runtime-checkable protocol with handle(request: LlmEvalRequest) -> LlmEvalResult signature.
Overseer Benchmarker DI Integration and Export
src/omnimarket/nodes/node_overseer_benchmarker/handlers/handler_overseer_benchmarker.py
Updates NodeOverseerBenchmarker.__init__ to accept `harness: ProtocolLlmEvalHarness
Overseer Benchmarker DI Tests
tests/test_di_injection_overseer_benchmarker.py
Verifies protocol runtime-checkability, stubbed harness injection and call routing, harness precedence over client, default construction fallback to concrete harness, and dry_run mode bypass behavior.
Navigation History Writer Protocol Definition
src/omnimarket/nodes/node_navigation_history_reducer/handlers/handler_navigation_history_reducer.py
Adds Protocol and runtime_checkable imports, introduces ProtocolNavigationHistoryWriter runtime-checkable protocol with record(session) and close() methods, and updates __all__ to export it.
Navigation History Reducer DI Integration
src/omnimarket/nodes/node_navigation_history_reducer/handlers/handler_navigation_history_reducer.py
Updates HandlerNavigationHistoryReducer._writer attribute and __init__.writer parameter type to ProtocolNavigationHistoryWriter instead of concrete HandlerNavigationHistoryWriter, with docstring describing protocol-based injection.
Navigation History Reducer Protocol Export Wiring
src/omnimarket/nodes/node_navigation_history_reducer/handlers/__init__.py, src/omnimarket/nodes/node_navigation_history_reducer/__init__.py
Imports and re-exports ProtocolNavigationHistoryWriter through handlers and main reducer packages, extending public API.
Navigation History Reducer DI Tests
tests/test_di_injection_navigation_history_reducer.py
Verifies protocol runtime-checkability, stubbed writer injection and call routing through initialize/execute/shutdown lifecycle, default construction fallback, and uninitialized error handling without stub invocation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • OmniNode-ai/omnimarket#611: Updates NodeOverseerBenchmarker DI path for the harness dependency, moving from concrete NodeLlmEvalHarness to protocol-based typing.

Poem

🐰 Protocols stitched with careful care,
Writers and harnesses hop in the air,
Stubs stand ready to prove the way,
Tests confirm the DI ballet,
A rabbit celebrates this tidy repair!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% 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 describes the main change: adding protocol injection seams to NavigationHistoryReducer and OverseerBenchmarker for tickets OMN-10872 and OMN-10873.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jonah/omn-10872-di-refactor-nav-history-benchmarker

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

@github-actions

github-actions Bot commented May 17, 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_navigation_history_reducer/handlers/handler_navigation_history_reducer.py:500: handler = HandlerNavigationHistoryReducer()

src/omnimarket/nodes/node_navigation_history_reducer/handlers/handler_navigation_history_reducer.py:535: self._writer = HandlerNavigationHistoryWriter(\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 May 17, 2026 •

Copy link
Copy Markdown

✅ PR Review Bot — CLEAN

Findings: 0
Run ID: ``

Note: Reviewer models are running as stubs (OMN-7969–OMN-7972 pending). Architectural findings from Phase 1 (arch-lint) are the authoritative signal until model handlers land.


Verdict semantics

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

Powered by node_pr_review_bot — FSM pipeline with multi-model review fan-out

@github-actions

github-actions Bot commented May 17, 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)

@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 `@docs/plans/2026-05-17-omn-10872-di-refactor-nav-history-benchmarker.md`:
- Around line 1-14: The document and filename contain internal ticket
identifiers; remove all occurrences of "OMN-10872" and "OMN-10873" from the
title, the "Tickets" section, and section headers in the file
(docs/plans/...-omn-10872-di-refactor-nav-history-benchmarker.md) and replace
them with a concise descriptive feature name (e.g., "DI Refactor —
NavigationHistoryWriter & LlmEvalHarness"); also either move the file out of
docs/ to an internal plan location or rename the file to remove ticket IDs while
keeping the date and a descriptive slug, and update any mentions of
ProtocolNavigationHistoryWriter, HandlerNavigationHistoryReducer, and
HandlerNavigationHistoryWriter to ensure they remain correct after renaming.
🪄 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: 9a4fe877-f3a1-42d5-add4-7f8c26bac778

📥 Commits

Reviewing files that changed from the base of the PR and between 3702fdd and 0990379.

📒 Files selected for processing (8)
  • docs/plans/2026-05-17-omn-10872-di-refactor-nav-history-benchmarker.md
  • src/omnimarket/nodes/node_llm_eval_harness/handlers/handler_llm_eval_harness.py
  • src/omnimarket/nodes/node_navigation_history_reducer/__init__.py
  • src/omnimarket/nodes/node_navigation_history_reducer/handlers/__init__.py
  • src/omnimarket/nodes/node_navigation_history_reducer/handlers/handler_navigation_history_reducer.py
  • src/omnimarket/nodes/node_overseer_benchmarker/handlers/handler_overseer_benchmarker.py
  • tests/test_di_injection_navigation_history_reducer.py
  • tests/test_di_injection_overseer_benchmarker.py

Comment thread docs/plans/2026-05-17-omn-10872-di-refactor-nav-history-benchmarker.md Outdated
jonahgabriel added a commit to OmniNode-ai/onex_change_control that referenced this pull request May 17, 2026
…Wave 2

Contracts for HandlerNavigationHistoryReducer protocol injection seam
(OMN-10872) and NodeOverseerBenchmarker harness injection seam (OMN-10873).
Both are seam tickets with unit-test and PR-merge evidence.
omnimarket PR: OmniNode-ai/omnimarket#693
@sonarqubecloud

Copy link
Copy Markdown

jonahgabriel added a commit to OmniNode-ai/onex_change_control that referenced this pull request May 18, 2026
… 2 (#1113)

* feat(OMN-10872,OMN-10873): add OCC contracts and dod receipts for DI Wave 2

Contracts for HandlerNavigationHistoryReducer protocol injection seam
(OMN-10872) and NodeOverseerBenchmarker harness injection seam (OMN-10873).
Both are seam tickets with unit-test and PR-merge evidence.
omnimarket PR: OmniNode-ai/omnimarket#693

* fix(OMN-10872,OMN-10873): add dod-deploy receipts, pin commit SHA in all receipts

* fix(OMN-10872,OMN-10873): fix receipts — accurate PR state, add commit_sha, add repo fields

* fix(OMN-10872,OMN-10873): rewrite receipts to canonical ModelDodReceipt schema

Receipts previously used a custom flat schema with fields like evidence_id,
description, repo, command, output, recorded_at which fail ModelDodReceipt
Pydantic validation (15 errors per receipt). Rewrites all 6 receipts to use
the canonical schema with schema_version, evidence_item_id, check_type,
check_value, run_timestamp, runner, verifier, probe_command, probe_stdout.

Updates commit_sha from stale 723e68ce to live omnimarket #693 head
eed1dc53 (verified live via gh pr view) and propagates to contract grep
patterns.

Adds dod-occ-pr-1113 self-binding receipts for both tickets so
receipt-gate pr_ticket_mismatch resolves.

* chore: retrigger CI with updated PR body (Evidence-Ticket lines)

* chore: reset stale CodeRabbit Thread Check rollup

* fix(OMN-10872): clarify cross-repo provenance in dod-unit-tests-pass receipt

CodeRabbit flagged that actual_output claimed tests ran in omnimarket but
working_dir pointed to onex_change_control. Added pr_repo field and
clarified that OCC is the canonical evidence registry while execution
happened in the omnimarket worktree.

* fix(OMN-10872): restore schema-compliant receipt fields

Previous fix added pr_repo (rejected by ModelDodReceipt as extra field) and
made working_dir a free-text string (schema requires absolute path). Restore
schema compliance: working_dir back to absolute omnimarket worktree path,
cross-repo provenance documented in actual_output instead.
@jonahgabriel
jonahgabriel added this pull request to the merge queue May 18, 2026
Merged via the queue into main with commit fcd4ff4 May 18, 2026
39 checks passed
@jonahgabriel
jonahgabriel deleted the jonah/omn-10872-di-refactor-nav-history-benchmarker branch May 18, 2026 05:19
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