fix: don't let active-skill continuity mask an out-of-scope tool request - #186
Merged
Conversation
checkActiveSkill's fit-checker only judges topic continuity ("is this
still the same task?"), so a mid-task request naming a different
capability (e.g. "use your kubectl access to debug this" while still
inside skill-web-search) passed the fit-check and got silently absorbed
into the active skill -- producing a flat "I can't do that" from the
model instead of ever reaching selectFallbackTool's full-catalog search.
Add hasOutOfScopeToolMatch, reusing the existing toolFitChecker against
candidates outside the active skill's toolIds; a hit now forces
fallthrough to full retrieval instead of trusting the fit-check alone.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JGyJx3E5PHapvYvwK7YyFd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
checkActiveSkill's fit-checker only judges topic continuity ("is this still the same task?"), not whether the request names a capability outside the active skill's owntoolIds. In production, a user mid-debug on a failedweb-fetchcall asked "use your kubectl access to debug it" — the fit-check said "still fits" (same debugging task), so the turn stayed locked inskill-web-search(which explicitly forbids any other tool) instead of ever reachingselectFallbackTool's full-catalog search. The model then flatly denied having kubectl access, even though akubectl-readonlyTool CR exists and is enabled in production.hasOutOfScopeToolMatchingraph.ts, reusing the existingtoolFitChecker(already used by the fallback-tool path) against vector-store candidates NOT already in the active skill'stoolIds. A confirmed out-of-scope match now forces fallthrough to full retrieval + selection instead of trusting the topic-continuity fit-check alone.Test plan
npx vitest run src/agent/graph.test.ts— 137/137 passing, including two new cases: falls through on an out-of-scope tool match (kubectl example), and still reuses the active skill when candidates are already in-scope.apps/agent-orchestratorsuite run; the 3 pre-existing NATS-channel test failures were confirmed present onmainbefore this change (unrelated flake/build issue) viagit stash.tsc --noEmitpre-existing errors innats-agent-channel.ts/nats-job-receiver.tsconfirmed present onmain(stale@controller-agent/messagingbuild), unrelated to this change.🤖 Generated with Claude Code
https://claude.ai/code/session_01JGyJx3E5PHapvYvwK7YyFd