Skip to content

Honor PI_CODING_AGENT_DIR for Pi MCP and skills - #6839

Merged
jerm-dro merged 1 commit into
mainfrom
jerm-dro/pi-agent-dir-paths
Oct 15, 2026
Merged

jerm-dro merged 1 commit into
mainfrom
jerm-dro/pi-agent-dir-paths

Conversation

@jerm-dro

@jerm-dro jerm-dro commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Why: Support Pi in LLM gateway setup #6818 made thv llm setup write Pi's models.json under $PI_CODING_AGENT_DIR, but Pi's MCP config (mcp.json), global skills directory, and install detection still hardcoded ~/.pi/agent. A user with the variable set got gateway config in their custom directory while MCP servers and skills landed in the default one (review comment).
  • What:
    • Add a declarative ConfigDirEnvVar field to clientAppConfig and set it to PI_CODING_AGENT_DIR on the Pi entry, replacing the Pi-specific ClientType check in buildLLMSettingsPath.
    • Resolve the override in one helper (configDirOverride, keeping the existing ~ and relative-path handling) and route every Pi path through it: MCP config (register, create, GetConfigPath via a new buildMCPConfigPath), IsClientInstalled, global skills (<dir>/skills/<name>), and LLM settings.

Type of change

  • Bug fix

Test plan

  • Unit tests (task test)
  • Linting (task lint-fix)

Ran the pkg/client and pkg/skills unit tests directly (go test -race), not the full task test suite. Added TestPiAgentDirOverrideAppliesToMCPAndSkills, which failed before the fix (mcp.json resolved under ~/.pi/agent) and passes after.

Does this introduce a user-facing change?

Yes, for Pi users who set PI_CODING_AGENT_DIR:

  • Before: thv client register pi wrote ~/.pi/agent/mcp.json, thv skill install (user scope) wrote to ~/.pi/agent/skills/, and Pi counted as installed only if ~/.pi/agent existed, even though thv llm setup used $PI_CODING_AGENT_DIR/models.json.
  • After: all of these resolve under $PI_CODING_AGENT_DIR. Users without the variable see no change.

Special notes for reviewers

  • Existing MCP registrations or skills already written to ~/.pi/agent for users with the variable set are not migrated; they will need to re-register.
  • Assumes Pi (and its MCP adapter) reads mcp.json and skills from PI_CODING_AGENT_DIR, per the review comment; not independently verified against Pi.

🤖 Generated with Claude Code

thv llm setup already wrote models.json under $PI_CODING_AGENT_DIR,
but the Pi MCP config (mcp.json) and global skills still resolved
to ~/.pi/agent. A user with the variable set ended up with gateway
config in their custom dir and MCP servers and skills in the default.

Move the override into a declarative ConfigDirEnvVar field on the
client entry and resolve it in one place, so MCP config, client
detection, global skills, and LLM settings all agree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the size/S Small PR: 100-299 lines changed label Oct 15, 2026
@codecov

codecov Bot commented Oct 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.29630% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 79.68%. Comparing base (9732005) to head (265772d).

Files with missing lines Patch % Lines
pkg/client/config.go 93.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6839      +/-   ##
==========================================
- Coverage   79.71%   79.68%   -0.04%     
==========================================
  Files         817      817              
  Lines       83411    83421      +10     
==========================================
- Hits        66492    66473      -19     
- Misses      16914    16943      +29     
  Partials        5        5              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jerm-dro
jerm-dro merged commit 87ed79d into main Oct 15, 2026
47 of 48 checks passed
@jerm-dro
jerm-dro deleted the jerm-dro/pi-agent-dir-paths branch October 15, 2026 20:53
@github-actions github-actions Bot mentioned this pull request Oct 19, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR: 100-299 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants