Skip to content

feat(harness): phi4-mini harness layer — self-healing watcher + availability-first orchestrator#134

Open
celstnblacc wants to merge 2 commits into
mainfrom
feat/harness-layer-phi4mini
Open

feat(harness): phi4-mini harness layer — self-healing watcher + availability-first orchestrator#134
celstnblacc wants to merge 2 commits into
mainfrom
feat/harness-layer-phi4mini

Conversation

@celstnblacc

Copy link
Copy Markdown
Owner

Summary

  • Adds src/superharness/harness/ module: phi4-mini (Ollama) intelligence for the watcher and orchestrator
  • Watcher gets WatcherHealthAdvisor — per-cycle health decisions (restart/break_lock/escalate/continue) via phi4-mini or rule-based fallback
  • Orchestrator gets OrchestratorDispatchAdvisor — availability-first routing, round-robin when model unavailable
  • OwnerRegistry tracks all owners (claude-cli, codex-cli, gemini-cli, vLLM) with zero skill assumptions — outcomes feed ReviewStore (sqlite) for future data-driven routing
  • Adds install-launchd-ollama.sh and install-launchd-orchestrator.sh — startup order: ollama → orchestrator → watcher
  • Harness is enhancement-only: always degrades to rule-based mode if Ollama is unreachable, never blocks the watcher cycle
  • Version bump: 1.34.3 → 1.35.0

Architecture

phi4-mini (Ollama, localhost:11434)
  ├─ WatcherHealthAdvisor  → is the system healthy? what action?
  └─ OrchestratorDispatchAdvisor → which owner is available?

Owners (no skill assumptions, equal at registration):
  claude-cli  |  codex-cli  |  gemini-cli (future)  |  vLLM (future)

Test plan

  • 56 new unit tests, all passing (tests/unit/harness/, test_inbox_watch_harness.py, test_inbox_dispatch_harness.py)
  • Full unit suite: 604 passed, 1 pre-existing failure (test_delegate_no_auto_model_uses_fallback) unrelated to this PR
  • Harness is import-safe: lazy imports, never raises, no hard dependency on Ollama at startup

🤖 Generated with Claude Code

newblacc and others added 2 commits April 24, 2026 21:32
… intelligence

Adds a local phi4-mini (Ollama) harness layer that makes the watcher self-healing
and the orchestrator availability-aware. The harness layer never touches task
content — owners (claude-cli, codex-cli, gemini-cli, vLLM) retain full control
over task execution and decomposition.

New module: src/superharness/harness/
- OllamaHarnessClient: phi4-mini HTTP client (ping, decide, route)
- RuleBasedFallback: deterministic decisions when Ollama is unavailable
- WatcherHealthAdvisor: per-cycle health assessment (restart/break_lock/escalate)
- OrchestratorDispatchAdvisor: availability-first routing, round-robin fallback
- OwnerRegistry: owner availability via CLI/endpoint checks, no skill assumptions
- ReviewStore: sqlite outcomes store for future data-driven routing
- HarnessConfig: harness.yaml loader with safe defaults

Watcher integration: _run_health_check() called each cycle in _run_scripts()
Dispatch integration: _resolve_owner() advisory routing before adapter selection
Model router: harness-local entry added (phi4-mini for all tiers)

Launchd: install-launchd-ollama.sh + install-launchd-orchestrator.sh
Startup order: ollama → orchestrator → watcher

56 new tests, all passing. Pre-existing test_delegate failure unrelated.
Version: 1.34.3 → 1.35.0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When a task has failed FAILOVER_RETRY_THRESHOLD (2) times on its assigned
owner, the OrchestratorDispatchAdvisor automatically excludes that owner
and routes to the next available alternative. Falls back to the original
owner when no alternatives exist.

- OrchestratorDispatchAdvisor.advise_failover(task_id, failing_owner)
- _resolve_owner() now accepts retry_count; triggers failover at >= 2
- Call site passes item_retry_count from inbox item
- 9 new tests covering failover scenarios

This addresses the gemini-cli auth-block scenario: after 2 failures,
the task automatically reassigns to claude-code or codex-cli without
manual shux recover.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

2 participants