Skip to content

feat(OMN-20606): a fallback delegation names the delegation it follows, and the in-process evidence names its caller - #3435

Closed
jonahgabriel wants to merge 5 commits into
devfrom
jonah/omn-20606-delegation-fallback-lineage
Closed

jonahgabriel wants to merge 5 commits into
devfrom
jonah/omn-20606-delegation-fallback-lineage

Conversation

@jonahgabriel

@jonahgabriel jonahgabriel commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

OMN-20606

What

Operator, 2026-10-05: show whether a delegation is an escalation or a fallback, and why its parent failed. Measured on the h201 dev lane (ledger TERMINAL 2026-10-05T16:10:11Z lane=byok-routing-fix-9143): 93 of 94 failed delegations that carried a session were answered by a later in-process delegation within 120 s, and the answering row had a new correlation id, an empty caller_lane and nothing naming the failed parent.

Two defects, both fixed here:

  1. Nothing carried lineage. delegation_events gains parent_correlation_id, lineage_kind (fallback or escalation) and parent_failure_cause (migration 0055, nullable TEXT, partial index on the parent). One spelling in models/delegation/delegation_lineage.py; a pure fold (HandlerDelegationLineageFold) returns all three columns or a named refusal, and both writers (sync HandlerProjectionDelegation and the deployed DelegationProjectionRunner) persist what it returns. A partial or malformed lineage stores none of it and never dead-letters the row; a lineage-less re-emit keeps stored lineage.
  2. The in-process evidence terminal named no caller. On the in-process path port_local_delegation_dispatch._project_evidence builds the only terminal that reaches the bus (OMN-20154), and it never copied the request's caller_lane or ticket_id, although the handler's own terminal carries both. That is the cause of the empty caller_lane on every in-process fallback row. The handler now hands the port the validated caller lane, ticket and lineage (attribution, passed only when a request names any), and the port stamps them onto the evidence terminal.

The delegate-skill response tolerates and drops the three lineage keys before declaring them (OMN-18868 consumer-first order); the projection model declares and keeps them. Declaring them on the response and stamping them from the deployed handler is the second half, after a release carrying this one.

Dependency

Needs the omnibase_infra release carrying omnibase_infra#4592 (vendored migration 0055, and the dispatch port's attribution keyword this handler passes). Pin bump to that release goes on this branch once it is out.

Proof

  • RED then GREEN: the two unit files fail with the changed sources checked out from origin/dev (10 failed) and pass on the branch.
    • uv run pytest tests/unit/projection/test_delegation_lineage_omn20606.py tests/unit/nodes/node_delegate_skill_orchestrator/test_delegate_skill_attribution_omn20606.py -q (32 passed)
    • Real Postgres twin, PG16: tests/test_omn20606_lineage_projection_real_postgres.py (3 passed: a fallback row joins to its failed parent, re-emit keeps lineage, malformed writes none, migration shape and index); positive control tests/test_omn20162_backend_id_and_host_real_postgres.py passes on the same database.
    • Neighbours: caller lane, backend_id/host, attempt ladder seam, runtime dispatch port, local evidence publish, relation inventory (136 passed).
  • Lab readback on dev-202 (h202), 2026-10-05 ~17:31Z. The dev-202 delegation writer was hotpatched with this branch (originals verified identical to origin/dev, backed up, restored after), migration 0055 applied to dev-202 omnidash_analytics, and two in-process onex delegate runs made on h202 publishing to the dev-202 broker:
    • parent e850644a-5411-4e29-9e66-65f9831b4e9c forced to fail (one-token budget): row terminal_ok=f, caller_lane=deleg-fallback-mark-9143, ticket_id=OMN-20606 (both were empty on every in-process row before this change);
    • fallback 1333fb52-eb7f-4bf8-944d-1fe81623cc2e: row terminal_ok=t, parent_correlation_id=e850644a-..., lineage_kind=fallback, parent_failure_cause=quality_gate_refused, same caller lane and ticket.
    • The dev-202 tenant mirror had no row for the h202 install tenant, so its terminals dead-lettered (OMN-16831); the lane seeded that one mirror row from the h201 copy.
  • RLS/reader paths: the writer change adds columns to an existing tenant-scoped upsert; the lab pass did not go through onex-api.

Not in this PR

  • The deployed handler's own terminal carrying lineage (needs the response to declare the keys, after this release).
  • A separate defect seen while proving: on the h201 dev lane the acceptance-judge request handler dead-letters every in-process delegate-skill-completed terminal (ModelDelegateSkillCompleted refuses actual_score, causation_id, emitted_at). Reported in the lane TERMINAL, not changed here.

Evidence-Ticket: OMN-20606
Evidence-Source: OCC#12962

…s, and the in-process evidence names its caller

delegation_events gains parent_correlation_id, lineage_kind and parent_failure_cause (migration 0055), folded by a pure handler and written by both projection writers. The in-process evidence terminal now carries the request's caller lane, ticket and lineage; it carried none, which is why in-process fallback rows had an empty caller_lane. The delegate-skill response tolerates the lineage keys before declaring them (OMN-18868 order).

Onex-Lane: deleg-fallback-mark-9143
Onex-Session: b4db569d3bd8442a9c343731c7995d63
@github-actions

github-actions Bot commented Oct 5, 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).

onexbot-occ-writer Bot pushed a commit to OmniNode-ai/onex_change_control that referenced this pull request Oct 5, 2026
…omnimarket#3435

OCC companion by node_pr_lifecycle_fix_effect (OMN-13317 F1 / OMN-13990 / OMN-14285). Product PR head bc012a2c840548cb821fa3e7d4318a433b16ac3f.
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

⚠️ Hostile Reviewer — DEGRADED

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

Action required: fewer than 2 reviewer models succeeded (infra unavailable or timeout). This blocks merge (OMN-15110) -- re-run once the reviewer endpoint is reachable/uncontended, or investigate.


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)

onexbot-occ-writer Bot added a commit to OmniNode-ai/onex_change_control that referenced this pull request Oct 5, 2026
…nimarket#3435

The declared checks were executed for real in the OmniNode-ai/omnimarket checkout at the PR head by the product-repo OCC receipt runner, and the results written append-only into this companion. Producer-minted PENDING receipts are superseded by a net-new record; no existing receipt was edited.

Ticket: OMN-16859 (AC3b)
Onex-Workflow: OCC Receipt Runner
Onex-Run: https://github.com/OmniNode-ai/omnimarket/actions/runs/37350564489
@jonahgabriel
jonahgabriel enabled auto-merge (squash) October 5, 2026 18:12
@onexbot-occ-writer

Copy link
Copy Markdown
Contributor

OCC autobind rebound this PR's evidence-source stamp line to OCC#12962.

The receipt gate's own eligibility validator, run against the change-control tree the gate pins for OCC#12962, returned eligible for head 5ecc6467875b2bd36cd04d85de4c5c099de5693b. The body now carries exactly one stamp line. Displaced: OCC#12945.

Reported by occ_companion_emitter (OMN-18853).

Dev pins omnibase-infra>=0.38.67 in pyproject.toml and uv.lock pins 0.38.67, replacing the branch pin of 0.38.66.
Migration 0055_delegation_events_lineage.sql ships in omnibase_infra v0.38.67, satisfying the Sibling Release Compatibility Gate (OMN-20381).
Resolved conflict in port_local_delegation_dispatch.py _project_evidence by keeping both attribution and attempt_usage, with attribution first.
Verified migration file blob a39d5d5 is byte-identical to omnibase_infra v0.38.67.
jonahgabriel added a commit that referenced this pull request Oct 7, 2026
Reconcile the delegation_events schema by adopting omnimarket#3435's lineage_kind
vocabulary over omnimarket#3472's attempt_kind. Both PRs added parent_correlation_id
and parent_failure_cause; the kind columns differed only in name and
values. The merge takes #3435's versions of all shared files, deletes
#3472's redundant migration and its real-Postgres test (covered by
#3435's), and rewrites the projection test to pin the reconciled schema.
#3472 now lands after #3435; its residual diff is the test file and
contract YAML only.

Merges omnimarket#3435 head c41fd0e (OMN-20606); OMN-20287 step 1.
@jonahgabriel

Copy link
Copy Markdown
Contributor Author

Superseded: this branch has no changed files against dev; the OMN-20606 work already landed through #3472. Closing (found by lane cause-omnimarket-ci-summary).


Generated by Claude Code

auto-merge was automatically disabled October 9, 2026 11:56

Pull request was closed

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