fix(jobs): bind claude-code's ~/.claude writable in bwrap sandbox (item #127) - #508
Conversation
#127) Agentflare-Agent: opencode Agentflare-Branch: task/127-bwrap-sandbox-has-no-writable-bind-for-c Agentflare-Item: 127
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 5 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Comment |
Agentflare-Agent: opencode Agentflare-Branch: task/127-bwrap-sandbox-has-no-writable-bind-for-c Agentflare-Item: 127
What changed
Sandboxed claude-code jobs now get a writable
~/.claudeinside the bwrap sandbox, so OAuth refresh can complete (item #127).Root cause:
~/.claudeheld.credentials.jsonbut the sandbox only ever bound home dirs read-only (HOME_CACHE_DIRS) or via the opencode-only overlay. claude-code's OAuth refresh flow writes.oauth_refresh.lockand rewrites.credentials.jsonvia temp-file+rename — both hit EROFS on the read-only root, so every dispatched job failed auth with401 OAuth access token has expired, while the same token refreshed fine interactively.Fix (
crates/agentflare-jobs/src/sandbox/bwrap/mod.rs):CLAUDE_DATA_DIR_RELATIVE = ".claude"const +is_claude_code()helper (final-path-component match, mirroringis_opencode).build_bwrap_args_with_home, when the resolved command is claude-code:~/.claudeexists →--overlay-src+--tmp-overlay: reads pass through to the host's real credentials, writes (refresh lock + rotated token) land in an invisible tmpfs discarded on exit — the refresh completes but nothing persists back to the host's real~/.claude.~/.claudeabsent → plain--tmpfsso claude-code can create.credentials.json(re-auths into the discard-on-exit overlay).Tests
claude_data_dir_overlaid_when_present— existing~/.claudegets the overlay pair.claude_data_dir_uses_tmpfs_when_absent— absent dir gets--tmpfs, no overlay.non_claude_command_gets_no_claude_specific_mount— an opencode job (with~/.claudepresent) gets no claude overlay; proves the gate is command-based.cargo clippy -p agentflare-jobs --all-targetsclean.