fix: preserve gh cli auth config#167
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 2 minutes and 17 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR introduces logic to resolve the GitHub CLI configuration directory based on environment variables and platform-specific fallbacks, with comprehensive tests validating environment precedence across Windows and Unix-like systems. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~18 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Code Review
This pull request implements logic to resolve the GitHub CLI configuration directory across different platforms and integrates it into the server environment setup. It also includes comprehensive tests for various environment configurations. The review feedback recommends making path utilities injectable to better support cross-platform testing and suggests adding support for lowercase appdata environment variables on Windows.
954327d to
789a4df
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/desktop-electron/src/main/server.ts`:
- Around line 75-90: The env merge is duplicated in buildServerEnv: create a
single mergedEnv (e.g., const mergedEnv = { ...shellEnv, ...process.env }) and
use mergedEnv both when calling githubConfigDir and when spreading into the
returned object (replace the two occurrences of { ...shellEnv, ...process.env }
and the later ...process.env with mergedEnv) so precedence is preserved and
maintenance drift is avoided; keep other returned keys (OPENCODE_*,
PAWWORK_RUNTIME_*, XDG_DATA_HOME) unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 545529b0-d3ce-45c3-9854-bfef599fd5a9
📒 Files selected for processing (2)
packages/desktop-electron/src/main/server.test.tspackages/desktop-electron/src/main/server.ts
789a4df to
63aefcb
Compare
Summary
Preserve GitHub CLI authentication for PawWork agent commands by deriving
GH_CONFIG_DIRbefore the desktop server overwritesXDG_CONFIG_HOMEwith PawWork's isolated config directory.Why
PawWork's desktop server correctly isolates opencode state under the app user data directory, but
ghalso usesXDG_CONFIG_HOMEto locatehosts.yml. After the isolation change, agent-rungh auth statuslooked in PawWork's config directory and reported that the user was not logged in even though the normal terminal login still worked.Related Issue
No issue. This is a narrow regression fix with a reproduced root cause.
How To Verify
Manual env repro:
env -u GH_CONFIG_DIR -u GH_TOKEN -u GITHUB_TOKEN XDG_CONFIG_HOME="$isolated_config" gh auth statusreports not logged in.env -u GH_TOKEN -u GITHUB_TOKEN XDG_CONFIG_HOME="$isolated_config" GH_CONFIG_DIR="$gh_auth_dir" gh auth statussees the existing login.Screenshots or Recordings
Not applicable. No visible UI change.
Checklist
dev, and my PR title and commit messages use Conventional Commits in EnglishSummary by CodeRabbit
Bug Fixes
Tests