Skip to content

fix(OMN-20426): canary score reducer writes capability_scores through the projection arm - #3346

Merged
jonahgabriel merged 1 commit into
devfrom
OMN-20426-canary-score-writer
Oct 4, 2026
Merged

jonahgabriel merged 1 commit into
devfrom
OMN-20426-canary-score-writer

Conversation

@jonahgabriel

@jonahgabriel jonahgabriel commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • OMN-20426: public.capability_scores was empty on the dev lane; node_canary_score_reducer could not write it.
  • Resolves an AttributeError ('HandlerCanaryScoreReducer' object has no attribute 'handle') that caused the runtime to withhold offsets because the contract declared db_io.db_tables.
  • Adds a handle() method to HandlerCanaryScoreReducer that strips keys beginning with an underscore, validates a ModelCanaryReport, and folds it with the unchanged pure accumulate() and materialize() functions.
  • Implements upsert logic for one capability_scores row per scored model with conflict key model_key,task_type, tenant_id set to the house tenant, rounding avg_latency_ms to int and coercing null score and cost to 0.0.
  • Changes metadata.yaml side_effect_class from read_only to read_write and removes the three-line entry for canary_score_reducer from validation/handler_dispatch_entrypoint_baseline.yaml.

Test plan

  • Added tests/chains/test_canary_score_reducer_writes_capability_scores.py with 5 tests: one drives the real contract through the real dispatch engine and projection database operations (aimed at an unreachable address), the other four assert row content, idempotent upsert, no write for a failed report, and a refusal when no adapter is injected.
  • Verified that the new tests failed on the old handler with the AttributeError and now pass (5 passed).
  • Ran ruff check, ruff format --check, and mypy --strict on the node.
  • Executed scripts/ci/check_node_metadata_dependencies.py and node_runtime_sweep --import-check.
  • Ran tests/test_metadata_schema.py.

Evidence

  • Baseline on the dev lane (compose project omnibase-infra, database omnidash_analytics): capability_scores 0 rows; positive control delegation_events 9497 rows.
  • Topic onex.evt.omnimarket.adr-canary-completed.v1 had high-watermark 0 before the probe. A consumer group for canary_score_reducer was Stable on the tenant-projection-writer container, so the subscription hop works.
  • RED: tests/chains/test_canary_score_reducer_writes_capability_scores.py on the unfixed handler failed with AttributeError: 'HandlerCanaryScoreReducer' object has no attribute 'handle', surfaced by the runtime as a withheld offset. GREEN after the change: focused run of that file plus the node's own tests, 11 passed.
  • Not in this PR: the table only fills when a canary run publishes the event. A delegated call does not feed this reducer.

Lab: host omninode-pc (lab host h201), dev lane compose project omnibase-infra, container omnimarket-tenant-projection-writer. Hotpatched head 168a5da's handler into the container (file copy plus docker restart, .prepatch backup), published one adr-canary-completed event with one successful model score, and select count(*) from public.capability_scores went 0 to 1: row omn20426-probe-model | adr_extraction | success_rate 0.835 | total_count 4 | avg_latency_ms 500 | house tenant, consumer group offset 0 to 1 with lag 0. The original file was then restored and the container restarted healthy.

Evidence-Ticket: OMN-20426
Evidence-Source: OCC#12694

public.capability_scores had 0 rows on the dev lane because the handler
lacked handle(), causing AttributeError on the first adr-canary-completed
event. The change adds handle() to strip runtime keys, validate
ModelCanaryReport, fold with accumulate() and materialize(), and upsert
capability_scores rows keyed on (model_key, task_type). A failed canary
report writes nothing. metadata.yaml side_effect_class changes from
read_only to read_write. New chain test passes with the updated handler.
@github-actions

github-actions Bot commented Oct 3, 2026

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).

@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown

✅ Hostile Reviewer — PASSED

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


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
jonahgabriel enabled auto-merge (squash) October 3, 2026 23:16
jonahgabriel added a commit to OmniNode-ai/onex_change_control that referenced this pull request Oct 4, 2026
)

* evidence(OMN-20426): add contract and PASS receipt for OmniNode-ai/omnimarket#3346
Adds contracts/OMN-20426.yaml and drift/dod_receipts/OMN-20426/dod-OmniNode-ai-omnimarket-pr-3346/command.yaml.
Receipt is a hand-authored companion for head 168a5dafc08e88145963dd9705fd230324f5b78d; check counts 'def handle(' in node_canary_score_reducer handler (probe output 1, exit 0).
occ-autobind ended ERROR (git clone timed out after 120 seconds); receipt captured with check_receipt_hardening.py --capture-probe, passing yamlfmt, check-yamlfmt-contamination, and check-receipt-hardening.

* evidence(OMN-18921): mint the owed OCC self-bind for PR #12694

---------

Co-authored-by: onexbot-occ-writer[bot] <onexbot-occ-writer[bot]@users.noreply.github.com>
@jonahgabriel
jonahgabriel merged commit ba718a9 into dev Oct 4, 2026
247 of 266 checks passed
@jonahgabriel
jonahgabriel deleted the OMN-20426-canary-score-writer branch October 4, 2026 01:32
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