Skip to content

feat(orchestration,llm): AdaptOrch topology advisor + CoE entropy routing#3099

Merged
bug-ops merged 4 commits intomainfrom
adaptorch-coe-routing
Apr 17, 2026
Merged

feat(orchestration,llm): AdaptOrch topology advisor + CoE entropy routing#3099
bug-ops merged 4 commits intomainfrom
adaptorch-coe-routing

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Apr 17, 2026

Summary

  • AdaptOrch (zeph-orchestration): 16-arm Thompson Beta-bandit classifies goals into TaskClass variants and samples a TopologyHint (Sequential / Parallel / Cascade / Adaptive) injected into the planner prompt before planning. State persists to disk on graceful shutdown. Zero overhead when [orchestration.adaptorch] enabled = false.
  • CoE (zeph-llm/router): chat_with_extras() returns ChatExtras { entropy } for providers with logprobs support (OpenAI, Compatible, Ollama). Router uses intra-entropy threshold and inter-divergence (1-cosine)/2 to escalate uncertain responses to a configured secondary provider. Gated to Ema/Thompson strategies only. Zero overhead when [llm.coe] enabled = false.

Closes #2434, #2505.

Changes

  • crates/zeph-orchestration/src/adaptorch.rsTopologyAdvisor, TaskClass, TopologyHint, Thompson arm state
  • crates/zeph-llm/src/router/coe.rsCoeRouter, ChatExtras, run_coe, inter-divergence computation
  • crates/zeph-llm/src/provider.rschat_with_extras() trait method + per-provider impls
  • crates/zeph-orchestration/src/plan.rsplan_with_hint() planner integration
  • src/runner.rs — bootstrap wiring for both features
  • Config: [orchestration.adaptorch] and [llm.coe] blocks (both enabled = false by default)

Test plan

  • cargo nextest run --workspace --lib --bins — 8122 tests pass
  • cargo +nightly fmt --check — clean
  • cargo clippy --workspace -- -D warnings — clean
  • Live session test required before merge (LLM serialization gate): run cargo run --features full -- --config .local/config/testing.toml and verify at least one multi-turn round-trip completes without 400/422 errors
  • Playbook: .local/testing/playbooks/orchestration.md — scenarios for AdaptOrch hint injection and CoE escalation
  • Coverage rows added to coverage-status.md (status: Untested — pending live session)

bug-ops added 3 commits April 17, 2026 14:08
…router

AdaptOrch (#2434): 16-arm Thompson Beta-bandit classifies goals into four
TaskClass variants and samples a TopologyHint (Sequential/Parallel/Cascade/
Adaptive) injected into the planner prompt. Outcomes recorded synchronously;
arm table persists to disk on graceful shutdown. Enabled via
[orchestration.adaptorch] config block.

CoE (#2505): per-call ChatExtras { entropy } returned by chat_with_extras()
for OpenAI, Compatible, and Ollama providers via logprobs. Router applies
intra-entropy threshold and inter-divergence (1-cosine)/2 to escalate
uncertain primary responses to a secondary provider. Gated to Ema and
Thompson routing strategies. Configured via [llm.coe] block.
H1: fix multibyte panic in adaptorch classify() — use chars().take(400)
H2: eliminate double LLM call in CoE — run_coe now accepts pre-obtained
    primary text + ChatExtras; router/mod.rs switches to chat_with_extras()
H3: remove unimplemented max_secondary_calls_per_turn field from CoeConfig
    and CoeConfig TOML (pre-v1.0 clean removal)
H4: fix plan cache bypassed for Hybrid hint — use_cache now checks
    prompt_sentence().is_none() so Hybrid falls through to cache
S-M-2: replace inner unwrap() in BetaDist::sample with expect() + comment
P1: add 10s timeout on embed calls in inter_divergence()
P2: fix double lock in sample_arm — clone arms under lock, then acquire rng
G1: add async tests for recommend() — valid JSON path and timeout fallback
G2: add sample_arm test verifying reinforced arm is preferred
G5: add three async run_coe tests — keep_primary, secondary failure, intra
    escalation
@github-actions github-actions Bot added documentation Improvements or additions to documentation llm zeph-llm crate (Ollama, Claude) rust Rust code changes core zeph-core crate dependencies Dependency updates enhancement New feature or request size/XL Extra large PR (500+ lines) labels Apr 17, 2026
@bug-ops bug-ops enabled auto-merge (squash) April 17, 2026 12:10
@bug-ops bug-ops merged commit 9965acd into main Apr 17, 2026
32 checks passed
@bug-ops bug-ops deleted the adaptorch-coe-routing branch April 17, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core zeph-core crate dependencies Dependency updates documentation Improvements or additions to documentation enhancement New feature or request llm zeph-llm crate (Ollama, Claude) rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

1 participant