fix(pi): point pi at config dir via PI_CODING_AGENT_DIR instead of redirecting HOME#243
Open
dgokeeffe wants to merge 1 commit into
Open
fix(pi): point pi at config dir via PI_CODING_AGENT_DIR instead of redirecting HOME#243dgokeeffe wants to merge 1 commit into
dgokeeffe wants to merge 1 commit into
Conversation
…directing HOME Pi honors the PI_CODING_AGENT_DIR env var to resolve its config directory (~/.pi/agent), so redirecting /Users/david.okeeffe to APP_DIR/pi-home was unnecessary. The HOME redirect broke macOS keychain default resolution under ucode: the Security framework looks for the login keychain under the redirected HOME, finds none, and security default-keychain returns 'A default keychain could not be found'. As a result gh auth, the git credential helper, and any keychain-backed tool failed inside pi. Setting PI_CODING_AGENT_DIR to the existing PI_CONFIG_DIR preserves config isolation (models.json/settings.json/sessions still land under APP_DIR/pi-home/.pi/agent) while leaving /Users/david.okeeffe as the user's real home, so the login keychain stays discoverable. Tests: the two pi e2e sites monkeypatched PI_UCODE_HOME/PI_CONFIG_PATH to redirect pi at a tmp home. They now also patch PI_CONFIG_DIR (read by build_runtime_env) and PI_SETTINGS_PATH/PI_SETTINGS_BACKUP_PATH (previously masked because the HOME redirect made pi read settings from the un-patched real APP_DIR path).
dgokeeffe
force-pushed
the
fix/pi-config-dir-env
branch
from
July 26, 2026 00:38
650cbc6 to
fa12598
Compare
Author
|
Rebased onto current main and tightened after review: the test now explicitly proves HOME is preserved, stale HOME-based comments/docstrings were updated, and focused validation is 42 passed / 29 workspace-gated skips with Ruff clean. A maintainer CI approval/review is now the remaining gate. |
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.
Problem
Pi redirected
$HOMEtoAPP_DIR/pi-hometo isolate its configuration. On macOS that also changed default keychain resolution, causinggh auth, git credential helpers, and other keychain-backed tools to fail inside Pi.Fix
Set Pi's supported
PI_CODING_AGENT_DIRenvironment variable instead of replacingHOME:Pi continues to store
models.json,settings.json, and sessions under the existing ucode-private agent directory, while subprocesses keep the real user home and can resolve the login keychain normally.Test changes
PI_CONFIG_DIR, models, settings, and backup paths consistently in both Pi E2E fixtures.build_runtime_env()setsPI_CODING_AGENT_DIRand preserves an existingHOME.Validation
uv run ruff check src/ucode/agents/pi.py tests/test_agent_pi.py tests/test_e2e.py tests/test_e2e_user_agent.pyuv run pytest tests/test_agent_pi.py tests/test_e2e_user_agent.py::TestPiUserAgent tests/test_e2e.py -q— 42 passed, 29 workspace-gated tests skippedThis remains an independent one-commit, four-file fix based on current
main.