Skip to content

fix(skills): return None instead of truthy stub when skill load fails (#17283)#17330

Closed
Bartok9 wants to merge 1 commit into
NousResearch:mainfrom
Bartok9:fix/17283-skill-stub-overwrites-prompt
Closed

fix(skills): return None instead of truthy stub when skill load fails (#17283)#17330
Bartok9 wants to merge 1 commit into
NousResearch:mainfrom
Bartok9:fix/17283-skill-stub-overwrites-prompt

Conversation

@Bartok9

@Bartok9 Bartok9 commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #17283 — webhook gateway skill auto-loader returns truthy stub string instead of None on load failure, silently overwriting the user's prompt.

Root Cause

build_skill_invocation_message() returned "[Failed to load skill: <name>]" when _load_skill_payload() failed. The webhook handler at gateway/platforms/webhook.py:401-405 checks if skill_content: and substitutes the prompt — a truthy stub passes that check, replacing the real user payload with a 42-character stub.

Additionally, _load_skill_payload() caught all exceptions with a bare except Exception: return None and logged nothing, making the failure invisible in gateway logs.

Fix

  1. Return None from build_skill_invocation_message() when payload loading fails (consistent with the unknown-command path that already returns None)
  2. Add logger.warning() calls in _load_skill_payload() for both exception and success=false paths so failures are visible in logs
  3. Regression test verifying None is returned (not a truthy string) when payload load fails

Why this works

The webhook caller already handles None correctly — if skill_content: is False for None, so the original user prompt is preserved. The fix aligns the failure path with what callers expect.

Testing

$ python3 -m pytest tests/agent/test_skill_commands.py -xvs -o 'addopts='
======================= 36 passed in 1.58s =======================

All 36 existing tests pass + 1 new regression test.

…NousResearch#17283)

build_skill_invocation_message() returned a formatted string
'[Failed to load skill: <name>]' when _load_skill_payload() failed.
This truthy string caused webhook callers to overwrite the user's
prompt with the stub, silently dropping the real payload.

Root cause: the webhook handler checks 'if skill_content:' and
substitutes the prompt — a truthy stub satisfies that check.

Fix:
- Return None from build_skill_invocation_message() on load failure
  (consistent with the unknown-command path)
- Add logger.warning() calls in _load_skill_payload() so failures
  are visible in gateway logs instead of silently swallowed
- Add regression test

Fixes NousResearch#17283
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent loop, run_agent.py, prompt builder tool/skills Skills system (list, view, manage) platform/webhook Webhook / API server labels Apr 29, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #14752 — same root cause: build_skill_invocation_message() returns truthy error string instead of None on load failure. Both PRs fix by returning None. #14752 also addresses the CLI path (#14713). See also #11200, #11408 for the same cluster.

@Bartok9

Bartok9 commented Apr 30, 2026

Copy link
Copy Markdown
Contributor Author

Good catch @alt-glitch — this is indeed a dup of my earlier #14752 which also covers the CLI path (#14713). Closing this one in favor of that PR which has broader scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder P2 Medium — degraded but workaround exists platform/webhook Webhook / API server tool/skills Skills system (list, view, manage) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Webhook gateway — skill auto-loader returns 'Failed to load skill' stub instead of None, silently dropping user prompt after extended uptime

2 participants