fix(skills): inject published skills when Auto-approve is off (#6643)

With Auto-approve OFF the agent loop asked get_relevant_skills for
min_confidence=2.0, meant as 'published only'. The gate applies the
confidence check to published skills too, and confidence is 0-1, so no
user skill was ever injected, published or not. The explicit-activation
path already treats OFF as status == published.

Add a published_only flag to get_relevant_skills and pass it from both
callers that used the sentinel (relevance injection and the skill
preflight). Auto-approve ON is unchanged: a skill still needs a passing
audit and the confidence threshold.

Fixes #6634
This commit is contained in:
Harshit Ojha
2026-10-13 21:02:23 +01:00
committed by GitHub
parent 0e2c08300e
commit b5b76fe46d
3 changed files with 35 additions and 7 deletions
+8 -4
View File
@@ -10325,9 +10325,10 @@ def _has_matching_skill_for_turn(
))))
if max_items == 0:
return False
published_only = not prefs.get("auto_approve_skills", True)
min_confidence = (
2.0
if not prefs.get("auto_approve_skills", True)
0.0
if published_only
else float(prefs.get(
"skill_min_confidence",
get_setting("skill_autosave_min_confidence", 0.85),
@@ -10344,6 +10345,7 @@ def _has_matching_skill_for_turn(
threshold=0.25,
max_items=max_items,
min_confidence=min_confidence,
published_only=published_only,
))
except Exception as exc:
logger.debug("skill preflight failed (non-fatal): %s", exc)
@@ -14952,8 +14954,9 @@ def _build_system_prompt(
# confidence threshold. Approve OFF → published-only (no draft
# passes). Approve ON → drafts at/above the chosen confidence
# (0 = "All"). Falls back to the global default setting.
if not _prefs.get("auto_approve_skills", True):
_skill_min_conf = 2.0 # nothing draft clears it → published only
_skill_published_only = not _prefs.get("auto_approve_skills", True)
if _skill_published_only:
_skill_min_conf = 0.0 # published_only decides eligibility
else:
try:
_skill_min_conf = float(_prefs.get(
@@ -14976,6 +14979,7 @@ def _build_system_prompt(
max_items=_skill_max_injected,
min_confidence=_skill_min_conf,
available_toolsets=relevant_tools,
published_only=_skill_published_only,
) if _skill_max_injected > 0 else []
else:
# Explicit client activation chooses which eligible skill