fix(pi): point pi at config dir via PI_CODING_AGENT_DIR instead of redirecting HOME - #243
fix(pi): point pi at config dir via PI_CODING_AGENT_DIR instead of redirecting HOME#243dgokeeffe wants to merge 2 commits 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).
650cbc6 to
fa12598
Compare
|
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. |
|
Rebased on current The remaining blocker is outside my control. Because these are fork PRs, every CI run has ended in @asujithan @rohita5l — could one of you approve the workflow runs? I'd suggest starting with this PR: it's the smallest of the four (+17 / −7, 4 files). It stops One heads-up on the Happy to take the other three (#223, #239, #217) one at a time after this one lands. |
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.