claude-failover/internal
Ubuntu 3e20085204 feat(phase2-E): multi-provider routing via secutools delegation
Adds optional delegation of agent-queue tasks to the SecuAAS secutools
AI platform (GPU / Gemini / Claude API) instead of dispatching to a
local Claude Code tmux session. Per-task opt-in via YAML frontmatter
fields preferred_ai, allow_delegation, complexity_hint — absence keeps
the Phase 1 behaviour exactly (zero breaking change).

Go side:
- internal/secutools: HTTP client with exponential-backoff retries
  (SubmitJob/GetJob/WaitForResult), DecideProvider map adapter for CLI
  use, table tests.
- internal/router: struct-typed Decide() with strict precedence
  (needs_claude_code > preferred_ai=claude-code > allow_delegation=false
  > preferred_ai > fail-safe local on unknown).
- internal/delegation: Manager submits jobs, writes .md.delegated
  markers for on-restart recovery, runs a periodic reaper that moves
  completed jobs into done/ with provider/cost footer and failed jobs
  into failed/.
- internal/dispatcher: WithDelegation() opt-in, routeTask hook before
  findFreeSession, skips .md.delegated in assignNextTask.
- internal/api: /api/delegated/status (active jobs + counters),
  /watchdog/status extended with delegation counters.
- cmd/ccl-delegate: small CLI exposing submit/get/result/decide so the
  bash dispatcher can call the same contract without duplicating logic.
- cmd/claude-failover: delegation wired opt-in via SECUTOOLS_API_KEY.

Tests:
- 29+ new unit tests across router, secutools, delegation, dispatcher,
  api packages. go test -race -count=1 clean.
- tests/phase2-E-integration.sh: bash end-to-end against a Python
  stdlib mock HTTP server, exercising the dev-management scripts.

Forward-compat with watchdog (Phase 1 B1 already ignores
state=delegated_to_secutools) so delegated tasks aren't flagged stale.
2026-04-17 02:17:19 +00:00
..
api feat(phase2-E): multi-provider routing via secutools delegation 2026-04-17 02:17:19 +00:00
config feat(pool): add start_index so manual and auto pools can coexist 2026-04-15 20:39:57 +00:00
delegation feat(phase2-E): multi-provider routing via secutools delegation 2026-04-17 02:17:19 +00:00
dispatcher feat(phase2-E): multi-provider routing via secutools delegation 2026-04-17 02:17:19 +00:00
janitor feat: Phase 2.7+3 — full integration, config update, systemd unit 2026-04-15 00:15:06 +00:00
lifecycle feat(lifecycle): validate shared symlinks at daemon startup (A2) 2026-04-16 19:03:43 +00:00
notify feat(notify): Phase 2.5 — Notifier Telegram + Resend email 2026-04-14 20:28:46 +00:00
quota fix(dispatcher): send a lone Enter after the task paste to submit it 2026-04-15 20:49:59 +00:00
router feat(phase2-E): multi-provider routing via secutools delegation 2026-04-17 02:17:19 +00:00
secutools feat(phase2-E): multi-provider routing via secutools delegation 2026-04-17 02:17:19 +00:00
state fix(quota): add cooldown + 2-poll confirmation to prevent swap ping-pong 2026-04-15 19:18:27 +00:00
switcher fix(switcher+symlinks): rollback on ensure failure (Bug #1) + requiredShared contract test (Bug #10) 2026-04-16 19:53:48 +00:00
symlinks fix(switcher+symlinks): rollback on ensure failure (Bug #1) + requiredShared contract test (Bug #10) 2026-04-16 19:53:48 +00:00
tmux fix(dispatcher): send a lone Enter after the task paste to submit it 2026-04-15 20:49:59 +00:00
watcher fix(dispatcher+watcher): never auto-dispatch into dedicated sessions 2026-04-16 13:30:26 +00:00