/onex:self_healing_dispatchfrom onex
Orchestrates ticket workflows by grouping tickets by repo, dispatching via TeamCreate, monitoring workers with agent_healthcheck, and auto-recovering stalls with bounded retry (max 2 redispatches). Logs all events to structured NDJSON.
Ships in onex. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Skill ID: onex:self_healing_dispatch
Workstream: B Phase 3 — built on earlier stall-detection and dispatch-enforcement foundations
Single orchestration entrypoint that combines:
agent_healthcheckHandles workloads of ≤10 tickets across ≤4 repos without human intervention.
/onex:self_healing_dispatch --tickets PROJ-1234,PROJ-5678,PROJ-9012
/onex:self_healing_dispatch --epic-id PROJ-7253
/onex:self_healing_dispatch --epic-id PROJ-7253 --dry-run
Announce at start:
[self_healing_dispatch] Starting orchestration run <run_id> | tickets: N | mode: <live|dry-run>
--tickets given: parse and validate each as OMN-\d+. Fail fast on invalid IDs.--epic-id given: call decompose_epic to get child ticket list. Fail fast if decompose returns empty.--tickets / --epic-id must be provided. Emit usage error and stop if neither or both.ERROR: Provide exactly one of --tickets or --epic-id.
Usage:
/onex:self_healing_dispatch --tickets PROJ-1234,PROJ-5678
/onex:self_healing_dispatch --epic-id PROJ-7253
Call the Python orchestrator:
from omniclaude.hooks.self_healing_orchestrator import orchestrate, group_by_repo
result = orchestrate(
ticket_ids=["PROJ-1234", "PROJ-5678"],
epic_id="PROJ-7253", # or None
repo_hints={"PROJ-1234": "omniclaude"}, # or None
run_id="orch-20260405T120000Z",
)
The orchestrator emits an orchestration_planned NDJSON event and returns a OrchestratorResult.
Grouping rules:
labels field or team field).unassigned group — surface a warning and stop.WARNING: Cannot resolve repo for PROJ-9999. Provide --repo-hints or set the ticket's repo label in Linear before orchestrating.
For each dispatch group, spawn a named worker via TeamCreate. Never use a bare Agent() call — the dispatch-mode guardrail will fire an advisory, and this skill enforces TeamCreate unconditionally.
# Pseudo-code — executed by the skill entrypoint, not the Python module
team_name = f"orch-{run_id}"
for group in result.groups:
prompt = build_team_dispatch_prompt(group, epic_id=result.epic_id)
Agent(
name=f"worker-{group.repo}-{run_id}",
team_name=team_name,
prompt=prompt,
)
Log a worker_dispatched event per group:
{"timestamp_utc":"...","event":"worker_dispatched","run_id":"...","repo":"omniclaude","tickets":["PROJ-1234"]}
After dispatching all workers, enter a polling loop. Use onex:agent_healthcheck as a composable sub-skill to check each active worker:
Skill(skill="onex:agent_healthcheck", args="--ticket-id PROJ-1234 --agent-id worker-omniclaude-orch-... --timeout-minutes 2 --max-redispatches 2")
On stall detected (status == stalled or failed):
from omniclaude.hooks.self_healing_orchestrator import record_stall_recovery, build_stall_recovery_prompt
should_redispatch, attempt = record_stall_recovery(
group=group,
ticket_id=stalled_ticket_id,
run_id=run_id,
completed_tickets=completed_so_far,
)
if should_redispatch:
prompt = build_stall_recovery_prompt(group, stalled_ticket_id, attempt, completed_so_far)
Agent(
name=f"recovery-{stalled_ticket_id}-attempt-{attempt}",
team_name=team_name,
prompt=prompt,
)
else:
# Exceeded MAX_REDISPATCHES (2) — escalate
linear.save_issue(identifier=stalled_ticket_id, status="Blocked",
comment=f"Auto-blocked: stalled {attempt} times. See dispatch log.")
Recovery prompt rules:
agent_healthcheck.MAX_REDISPATCHES = 2. Third stall → escalate to Blocked.Exit when all workers have returned completed or escalated status.
Emit final orchestration_complete event:
{
"timestamp_utc": "...",
"event": "orchestration_complete",
"run_id": "...",
"total_tickets": 5,
"stalls_recovered": 1,
"escalated": [],
"elapsed_seconds": 430
}
Print final summary:
[self_healing_dispatch] Run <run_id> complete.
Tickets: 5 | Recovered stalls: 1 | Escalated: 0
Log: $ONEX_STATE_DIR/dispatch-log/2026-04-05.ndjson
| Constraint | Value |
|---|---|
| Max tickets | 10 |
| Max repos | 4 |
| Max redispatches per ticket | 2 |
| Stall threshold | 2 minutes (delegated to agent_healthcheck) |
| Dispatch mode | TeamCreate only — bare Agent() forbidden |
All events append to $ONEX_STATE_DIR/dispatch-log/{YYYY-MM-DD}.ndjson. One JSON object per line, never pretty-printed.
| Event | Key Fields |
|---|---|
orchestration_planned | run_id, epic_id, ticket_count, group_count, repos |
worker_dispatched | run_id, repo, tickets |
stall_recovery_dispatched | run_id, ticket_id, redispatch_attempt, max_redispatches |
escalated_to_blocked | run_id, ticket_id, attempt_count |
orchestration_complete | run_id, total_tickets, stalls_recovered, escalated, elapsed_seconds |
When --dry-run is set:
orchestration_planned event.[self_healing_dispatch] DRY RUN — no workers launched.
Planned groups:
omniclaude: PROJ-1234, PROJ-5678
omnibase_core: PROJ-9012
Log: $ONEX_STATE_DIR/dispatch-log/2026-04-05.ndjson
All grouping, prompt generation, stall accounting, and log emission logic lives in:
src/omniclaude/hooks/self_healing_orchestrator.py
Do not duplicate this logic inline. Import and call the module functions.
onex:agent_healthcheck — stall detection sub-skillonex:dispatch_watchdog — epic-level watchdog for larger wave runsonex:epic_team — full epic orchestration (use for >10 tickets or >4 repos)What SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (omninode-ai/omniclaude) — no native marketplace selected
npx claudepluginhub p/omninode-ai-onex-plugins-onex128 skills in this plugin
/adversarial_pipelineAdversarial PipelineAutonomous 3-stage adversarial plan-to-ticket pipeline — design_to_plan → hostile_reviewer gate (≥3 issues required) → plan_to_tickets. All stages run as background agents. Zero foreground work./agent_healthcheck/onex:agent_healthcheck — dispatch-only shimDispatch-only shim for agent stall detection and recovery. All detection and recovery logic lives in node_worker_stall_recovery (omnimarket). The skill parses args, builds the input envelope, dispatches to the node, and renders the receipt./aislop_sweep