Skip to content

fix(jobs): bind claude-code's ~/.claude writable in bwrap sandbox (item #127) - #508

Merged
getappz merged 3 commits into
masterfrom
task/127-bwrap-sandbox-has-no-writable-bind-for-c
Aug 15, 2026
Merged

fix(jobs): bind claude-code's ~/.claude writable in bwrap sandbox (item #127)#508
getappz merged 3 commits into
masterfrom
task/127-bwrap-sandbox-has-no-writable-bind-for-c

Conversation

@getappz

@getappz getappz commented Aug 15, 2026

Copy link
Copy Markdown
Owner

What changed

Sandboxed claude-code jobs now get a writable ~/.claude inside the bwrap sandbox, so OAuth refresh can complete (item #127).

Root cause: ~/.claude held .credentials.json but 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.lock and rewrites .credentials.json via temp-file+rename — both hit EROFS on the read-only root, so every dispatched job failed auth with 401 OAuth access token has expired, while the same token refreshed fine interactively.

Fix (crates/agentflare-jobs/src/sandbox/bwrap/mod.rs):

  • New CLAUDE_DATA_DIR_RELATIVE = ".claude" const + is_claude_code() helper (final-path-component match, mirroring is_opencode).
  • In build_bwrap_args_with_home, when the resolved command is claude-code:
    • ~/.claude exists → --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.
    • ~/.claude absent → plain --tmpfs so claude-code can create .credentials.json (re-auths into the discard-on-exit overlay).

Tests

  • claude_data_dir_overlaid_when_present — existing ~/.claude gets 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 ~/.claude present) gets no claude overlay; proves the gate is command-based.
  • Full crate lib suite: 29 passed; cargo clippy -p agentflare-jobs --all-targets clean.

#127)

Agentflare-Agent: opencode
Agentflare-Branch: task/127-bwrap-sandbox-has-no-writable-bind-for-c
Agentflare-Item: 127
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 5 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b708b1e0-a3be-4a55-b8a6-9346c4c78a69

📥 Commits

Reviewing files that changed from the base of the PR and between 1358248 and 635ed77.

📒 Files selected for processing (1)
  • crates/agentflare-jobs/src/sandbox/bwrap/mod.rs

Comment @coderabbitai help to get the list of available commands.

shiva and others added 2 commits August 15, 2026 18:23
Agentflare-Agent: opencode
Agentflare-Branch: task/127-bwrap-sandbox-has-no-writable-bind-for-c
Agentflare-Item: 127
@getappz
getappz merged commit ca0d591 into master Aug 15, 2026
16 checks passed
@getappz
getappz deleted the task/127-bwrap-sandbox-has-no-writable-bind-for-c branch August 15, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant