---
description: Runtime registration and wiring verification — checks node descriptions are real (not compute+hash), all contract-declared handlers are wired in dispatch, all topics have both producer and consumer, and container logs are free of repeated errors. Auto-creates Linear tickets for unwired handlers and error-heavy containers.
mode: full
version: "1.0.0"
level: advanced
debug: false
category: verification
tags: [runtime, wiring, contracts, sweep, close-out]
author: omninode
composable: true
args:
  - name: --dry-run
    description: "Report findings without creating Linear tickets (default: false)"
    required: false
  - name: --scope
    description: "Check scope: omnidash-only | all-repos (default: all-repos)"
    required: false
---

# Runtime Sweep

**Skill ID**: `onex:runtime-sweep`

## Purpose

Runtime registration and wiring verification. Ensures:
1. Registered nodes have real descriptions (not auto-generated compute+hash placeholders)
2. All contract-declared handlers are wired in the dispatch engine
3. All Kafka topics have both a producer AND a consumer
4. Projection handlers in omnidash map to actual topic subscriptions
5. Container logs are free of repeated ERROR/FATAL/traceback patterns

## Announce

"I'm using the runtime-sweep skill to verify runtime registration and wiring integrity."

## Usage

/runtime-sweep
/runtime-sweep --dry-run
/runtime-sweep --scope omnidash-only

## Phase 1 — Node Description Audit

Scan all ONEX contract YAMLs across repos for node descriptions:

```bash
# Find all contract.yaml files
find "$OMNI_HOME"/*/src -name "contract.yaml" -path "*/nodes/*"
```

For each contract, extract the `description` field. Flag descriptions that:
- Are empty or placeholder ("TODO", "TBD", "FIXME")
- Match the auto-generated pattern `compute+{hash}` or `Generated by generate_skill_node`
- Are shorter than 10 characters

Classify:
- `REAL`: meaningful description (>10 chars, not placeholder)
- `PLACEHOLDER`: auto-generated or placeholder text
- `MISSING`: no description field

## Phase 2 — Handler Wiring Audit

For omnidash specifically, verify every projection handler is wired:

**Step 2a: List all projection files**

```bash
ls omnidash/server/projections/*.ts | grep -v __tests__ | grep -v index
```

**Step 2b: Check each handler is referenced in read-model-consumer.ts**

For each projection file (e.g., `agent-routing-projection.ts`), verify:
- The handler function it exports is listed in `omnidash/topics.yaml` handler field
- The handler is imported and called in `omnidash/server/read-model-consumer.ts`

Classify:
- `WIRED`: handler in topics.yaml AND imported in consumer
- `UNWIRED`: handler exists but not in topics.yaml or consumer
- `ORPHAN_TOPIC`: topic in topics.yaml but no handler file

**Step 2c: Cross-repo handler check (if --scope all-repos)**

For each repo under `omni_home/`, find contract YAMLs that declare
`subscribe` or `publish` topics. Verify the handler referenced in the
contract exists as an actual Python function.

## Phase 3 — Topic Symmetry Audit

For every topic in the ONEX ecosystem, verify both sides exist:

**Step 3a: Collect all published topics**

Scan all contract YAMLs and topics.yaml files for topics listed under
`publish` or `topics` keys.

**Step 3b: Collect all subscribed topics**

Scan all contract YAMLs and topics.yaml files for topics listed under
`subscribe` keys. Include `omnidash/topics.yaml` entries.

**Step 3c: Find asymmetries**

- `PRODUCER_ONLY`: topic has a publisher but no subscriber
- `CONSUMER_ONLY`: topic has a subscriber but no publisher
- `SYMMETRIC`: both sides exist

## Phase 4 — Docker Log Analysis

For each running container, pull recent logs and scan for error patterns.
Uses `docker_helper.py` from `plugins/onex/skills/_shared/docker_helper.py`.

**Step 4a: List running containers**

Use `list_containers()` to get all running ONEX infrastructure containers
(filter: `omnibase-infra-|omninode-`).

**Step 4b: Pull and scan logs**

For each container, call `get_container_logs(container_name, tail=100)`.
The helper already detects lines matching: `error`, `exception`, `failed`,
`fatal`, `critical`.

**Step 4c: Classify containers**

- `CLEAN`: 0 error lines in last 100 log lines
- `NOISY`: 1-5 error lines (may be transient)
- `ERROR_HEAVY`: >5 error lines — repeated errors indicate a real problem
- `CRASH_LOOP`: container state is `restarting` or restart count > 3

**Step 4d: Cross-reference with service health**

For each `ERROR_HEAVY` or `CRASH_LOOP` container, call
`check_container_health(container_name)` and `get_container_status(container_name)`.
Correlate log errors with health status:

- `ERROR_HEAVY` + `unhealthy` → critical finding
- `ERROR_HEAVY` + `healthy` → warn (errors not affecting health checks yet)
- `CRASH_LOOP` + any health → critical finding

## Phase 5 — Report + Ticket Creation

Emit four summary tables:

### Node Descriptions
| Contract | Node | Description Status |

### Handler Wiring
| Handler File | Topic | Wiring Status |

### Topic Symmetry
| Topic | Producer | Consumer | Symmetry Status |

### Docker Log Health
| Container | Error Lines | Classification | Health Status | Restart Count |

For each finding with status `PLACEHOLDER`, `UNWIRED`, `PRODUCER_ONLY`,
`CONSUMER_ONLY`, `ERROR_HEAVY`, or `CRASH_LOOP`, auto-create a Linear ticket:

Title: `fix(wiring): {finding_type} — {subject}`
Project: Active Sprint
Labels: wiring, runtime-sweep
Description: include evidence (file paths, topic names, handler names)

Skip ticket creation for:
- `--dry-run` mode
- `REAL` / `WIRED` / `SYMMETRIC` / `CLEAN` / `NOISY` findings (healthy or transient)

## Dispatch Rules

- ALL work dispatched through `onex:polymorphic-agent`
- NEVER edit files directly from orchestrator context
- `--dry-run` produces zero side effects (no tickets)

## Integration Points

- **autopilot**: invoked as optional wiring verification step in close-out mode
- **data-flow-sweep**: complementary — data-flow checks live data; runtime-sweep checks static wiring
- **integration-sweep**: complementary — integration-sweep checks post-merge contracts; runtime-sweep checks registration
