Skip to content

fix(agent): restore skill matching and context population on TUI queries#1017

Merged
bug-ops merged 1 commit intomainfrom
fix/skill-matching-context-population
Feb 27, 2026
Merged

fix(agent): restore skill matching and context population on TUI queries#1017
bug-ops merged 1 commit intomainfrom
fix/skill-matching-context-population

Conversation

@bug-ops
Copy link
Owner

@bug-ops bug-ops commented Feb 27, 2026

Summary

  • When QdrantSkillMatcher returns an empty result set (embed error or Qdrant unavailable), rebuild_system_prompt now falls back to all registered skills instead of running with an empty active-skill list
  • Added auto_detect_context_window to SubProvider and ModelOrchestrator; build_provider now calls it for AnyProvider::Orchestrator so that auto_budget_tokens returns a non-zero value and prepare_context injects semantic recall, summaries, and cross-session memories

Root causes

  1. Skill matching: empty scored vec passed through unchanged → zero active skills, no fallback
  2. Context budget: only AnyProvider::Ollama was interrogated for context window size; orchestrator was silently skipped → context_budget = Noneprepare_context returned early on every query

Test plan

  • cargo clippy --workspace -- -D warnings passes with zero warnings
  • cargo nextest run --workspace --lib --bins — 2963 tests pass
  • TUI: enter query with Qdrant unavailable → skills panel shows all registered skills
  • TUI: enter query with orchestrator provider → context panel shows memory/summary entries

Two independent bugs caused skills and context to be absent when queries
were entered through the TUI dashboard:

1. Skill matching fallback: when QdrantSkillMatcher returns an empty
   result set (embed error or Qdrant unavailable), rebuild_system_prompt
   now falls back to all registered skills instead of producing an empty
   active-skill list, keeping the agent functional.

2. Orchestrator context window detection: build_provider only handled
   AnyProvider::Ollama; ModelOrchestrator was never interrogated for a
   context window size. Add auto_detect_context_window to SubProvider and
   ModelOrchestrator and call it from build_provider so that
   auto_budget_tokens returns a non-zero value and prepare_context can
   inject semantic recall, summaries, and cross-session memories.
@github-actions github-actions bot added bug Something isn't working size/S llm LLM provider related rust core labels Feb 27, 2026
@bug-ops bug-ops enabled auto-merge (squash) February 27, 2026 21:21
@bug-ops bug-ops merged commit a70e0b2 into main Feb 27, 2026
25 checks passed
@bug-ops bug-ops deleted the fix/skill-matching-context-population branch February 27, 2026 21:22
@bug-ops bug-ops mentioned this pull request Feb 27, 2026
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core llm LLM provider related rust size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant