Skip to content

feat(routing): tier-aware fallback, output format guard, task decomposition#77

Merged
vishalveerareddy123 merged 2 commits into
mainfrom
feat/routing-resilience-and-quality
Jun 23, 2026
Merged

feat(routing): tier-aware fallback, output format guard, task decomposition#77
vishalveerareddy123 merged 2 commits into
mainfrom
feat/routing-resilience-and-quality

Conversation

@vishalveerareddy123

Copy link
Copy Markdown
Collaborator

Summary

Three improvements to routing resilience and output quality, built and validated against a live T3 Code → Claude Code → Lynkr integration.

1. Tier-aware fallback (escalate-then-demote) — always on

src/routing/tier-fallback.js + invokeModel catch block.
On provider failure, climb to a more capable tier first (toward REASONING); only if every higher tier is unavailable, fall downward to SIMPLE/local.

  • Skips circuit-OPEN providers, dedups provider:model, never re-tries the failed model
  • Never silent: X-Lynkr-Fallback, X-Lynkr-Served-Tier, X-Lynkr-Fallback-From-Tier, X-Lynkr-Fallback-Direction headers + warn logs
  • Example (this repo's tiers): COMPLEX (Moonshot) fails → REASONING (Azure) → MEDIUM/SIMPLE (Ollama)

2. Output format guard — always on

src/context/output-format-guard.js.
Injects a markdown formatting instruction for non-Claude backends so weaker models avoid ASCII/Unicode box-drawing diagrams. Keyed off the routing-resolved provider/model; skips Claude-family backends (already clean). Idempotent; handles string & array system.

3. Task decomposition — opt-in (TASK_DECOMPOSITION_ENABLED)

src/agents/decomposition/, exposed as the DecomposeTask tool.
Cost-aware gate decides when splitting is worthwhile → planner emits a validated subtask DAG → dispatcher runs subtasks (parallel within dependency levels, isolated context) → synthesizer combines → confidence-scored with monolithic fallback. Shadow mode + net-savings telemetry. Built on the existing subagent stack.

Config

  • TASK_DECOMPOSITION_ENABLED (default false) — the only new env knob; all other decomposition settings hardcoded
  • Tier-aware fallback and the format guard are hardcoded always-on

Testing

  • 47 new unit tests across all three features (gate / planner / dispatcher / synthesizer, format guard, tier-fallback chain) — all green
  • No regressions in existing suites (routing, code-mode, preflight verified)
  • ESLint clean on new files

🤖 Generated with Claude Code

vishal veerareddy and others added 2 commits June 23, 2026 01:38
…sition

Three opt-in/always-on improvements to routing resilience and output quality,
driven by real T3 Code + Lynkr integration testing.

1. Tier-aware fallback (escalate-then-demote) — src/routing/tier-fallback.js
   On provider failure, climb to a MORE capable tier first (toward REASONING);
   only if every higher tier is unavailable fall downward to SIMPLE/local.
   Skips circuit-OPEN providers, dedups provider:model, never re-tries the
   failed model. Surfaced via X-Lynkr-Fallback / X-Lynkr-Served-Tier headers +
   warn logs (never silent). Always on. Integrated in invokeModel's catch block.

2. Output format guard — src/context/output-format-guard.js
   Injects a markdown formatting instruction for non-Claude backends so weaker
   models avoid ASCII/Unicode box-drawing diagrams. Keyed off the routing-
   resolved provider/model; skips Claude-family backends. Always on.

3. Task decomposition — src/agents/decomposition/
   Opt-in (TASK_DECOMPOSITION_ENABLED). Cost-aware gate decides when to split a
   task into isolated-context subtasks (parallel where independent), then
   synthesizes; confidence-scored with monolithic fallback; shadow mode +
   net-savings telemetry. Exposed as the DecomposeTask tool.

Tests: 47 new unit tests (gate/planner/dispatcher/synthesizer, format guard,
tier-fallback chain). No regressions in existing suites.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vishalveerareddy123 vishalveerareddy123 merged commit 07444ad into main Jun 23, 2026
2 checks passed
@veerareddyvishal144 veerareddyvishal144 deleted the feat/routing-resilience-and-quality branch June 23, 2026 08:53
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