Skip to content

[BUG] Claude harness drops compiled skills on turns with an approval-gated MCP server #3029

Closed

Description

@QuentinBisson

Prerequisites

  • I have searched the existing issues to avoid creating a duplicate
  • I am using the latest version of the software
  • I can consistently reproduce this issue

Affected Service(s)

Multiple services / System-wide issue (the claude Harness runtime)

Impact/Severity

Minor inconvenience

Bug Description

When an AgentTemplate on a claude Harness has an MCP tool with requireApproval: true and at least one skill, Claude Code runs without the compiled skills.

The driver passes --setting-sources "" --settings <file> --permission-prompt-tool … whenever an approval broker exists (go/harness/claude/internal/driver/process.go:131-137), and always passes the compiled skills as --add-dir <SkillRoot> (:150-154). Claude Code counts skills found under an --add-dir directory's .claude/skills as part of the project setting source, so --setting-sources "" drops them along with the workspace's own settings.

Steps To Reproduce

The pinned Claude Code shows this without model credentials: the system/init event is the first stream-json line and lists the loaded skills.

mkdir -p /tmp/skills/.claude/skills/compiled-skill /tmp/ws && cd /tmp/ws
printf -- '---\nname: compiled-skill\ndescription: d\n---\nx\n' > /tmp/skills/.claude/skills/compiled-skill/SKILL.md
echo '{}' > /tmp/settings.json
probe() {
  claude -p hi --output-format stream-json --verbose --strict-mcp-config --dangerously-skip-permissions \
    --settings /tmp/settings.json --add-dir /tmp/skills "$@" 2>/dev/null \
    | jq -c 'select(.subtype=="init") | [.skills[] | select(. == "compiled-skill")]'
}
probe                          # as on a turn without approval: ["compiled-skill"]
probe --setting-sources ""     # as on a turn with approval:    []
probe --setting-sources project  #                              ["compiled-skill"]

Expected Behavior

The compiled skills load on every turn, as they do on turns without an approval-gated MCP server.

Actual Behavior

On Claude Code 2.1.260 (PinnedClaudeVersion):

Flags compiled-skill in init.skills
no --setting-sources (turns without approval) yes
--setting-sources "" (turns with approval) no
--setting-sources user no
--setting-sources project yes
--setting-sources local no

Skills under --plugin-dir load with every value.

Proposed fix

Two directions, depending on whether approval turns should stay isolated from ambient config:

  1. Same settings loading on every turn (consistent with fix(harness): Disable bare mode for Claude Code #2923): drop "--setting-sources", "" from the approval branch and keep --settings and --permission-prompt-tool. The approval still holds, since ask wins over allow across sources. On 2.1.260, with permissions.ask: ["mcp__<server>__*"] in the --settings file, a permissions.allow for the same server still reached the permission-prompt tool when planted in:

    • CLAUDE_CONFIG_DIR/settings.json, written as mcp__<server>__*, mcp__<server>__<tool> or mcp__<server>;
    • a trusted workspace's .claude/settings.json.

    An untrusted workspace's permissions.allow is ignored outright. Checked against a stub Messages API, and on a cluster with a claude Harness and an approval-gated MCP server: the call paused at input-required, with the compiled skill listed on the same turn.

  2. Keep isolation, and isolate every turn: pass --setting-sources "" on all turns and deliver compiled skills from somewhere that source does not gate. Of the locations I tried, only --plugin-dir loads with every value, and it renames skills to <plugin>:<skill>.

Option 1 is a one-line change. I can open a PR with it and a driver test asserting --setting-sources is absent.

Environment

  • Application version: kagent main (2026-10-01), Claude Code 2.1.260 (the harness image's pinned binary)
  • Kubernetes: kind

Activity

  1. jstar0 commented on Oct 3, 2026

    @jstar0

    I noticed the issue description already says you can open a PR for the proposed fix. I missed that before posting my claim; please disregard it. I will defer to your implementation and will not duplicate the work.

  2. EItanya commented on Oct 16, 2026

    @EItanya
    Contributor

    Fixed on main by #3203. Compiler-selected Claude skills now load through an explicit plugin manifest and --plugin-dir, so they remain available when approval turns disable settings sources.

    This addresses the dropped-skills path described here. Closing this as resolved; #3191 was also closed as superseded by that fix.

    🤖 AI-assisted triage.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions