Skip to content

fix(review-runs): edit .claude/skills/ in a writable worktree - #219

Merged
max-sixty merged 1 commit into
mainfrom
hourly/review-24235684411
Apr 10, 2026
Merged

max-sixty merged 1 commit into
mainfrom
hourly/review-24235684411

Conversation

@tend-agent

Copy link
Copy Markdown
Collaborator

Summary

The review-runs skill's Step 6 tells the bot to edit .claude/skills/ files and open a PR, but the checkout's .claude/ directory is bind-mounted read-only under the Claude Code 2.1.97+ sandbox — the same RCE-vector protection that PR #216 handled for .github/ in the nightly skill. In-place edits fail with OSError: [Errno 30] Read-only file system, and the bot has to diagnose the mount and set up a worktree mid-run.

Add the worktree pattern to Step 6 so the bot opens the fix PR from a writable worktree under $TMPDIR from the start.

Evidence

Run 24233412050 (tend-review-runs on max-sixty/worktrunk, 2026-04-10 07:47Z, session 8adb40c1-4b13-4d11-97dc-bcbbe461b468.jsonl) decided to add transient-failure guidance to .claude/skills/running-tend/SKILL.md (creating PR max-sixty/worktrunk#2050). The bot:

  1. Ran git checkout -b daily/review-runs-24233412050 on the workspace checkout.
  2. Called Edit on .claude/skills/running-tend/SKILL.md → permission error from the harness.
  3. Fell back to python3 write on the same path → OSError: [Errno 30] Read-only file system: '.claude/skills/running-tend/SKILL.md'.
  4. Ran mount | grep claude to diagnose.
  5. Tried git worktree add /tmp/claude-1001/wt-review daily/review-runs-24233412050 — failed because the branch was already checked out in the workspace.
  6. Had to git worktree remove --force, git checkout main, then recreate the worktree.
  7. Finally edited inside the worktree, committed, pushed, and opened the PR.

Confirmed in this review-reviewers session's sandbox:

$ mount | grep -E "\.claude|\.github"
/dev/root on /home/runner/work/tend/tend/.claude type ext4 (ro,...)
/dev/root on /home/runner/work/tend/tend/.github type ext4 (ro,...)

Same root cause as PR #216: claude-code-action restores .claude/, .mcp.json, .claude.json, .gitmodules, and .ripgreprc from the base branch as RCE-vector protection, and Claude Code 2.1.97+ bind-mounts them read-only.

Gate assessment

  • Confidence: High. Structural — the mount is deterministic and would produce the same failure on every review-runs session that tries to edit .claude/skills/ in place. One observed occurrence this run plus an independent confirmation via mount in this review-reviewers session. Same class of failure as PR fix(nightly): regenerate workflows in a writable worktree #216 (.github/ in nightly), which has already been accepted upstream as a structural fix.
  • Classification: Structural sandbox mount.
  • Magnitude: Targeted fix — adds one worktree snippet to Step 6 of an existing skill file, mirrors the pattern PR fix(nightly): regenerate workflows in a writable worktree #216 introduced for nightly Step 5.

Passes both gates. Paired with the simplification that most review-runs fix PRs already want a branch anyway, the worktree pattern adds no overhead.

Test plan

  • Diff reviewed — docs-only change to plugins/tend-ci-runner/skills/review-runs/SKILL.md.
  • Verified plugins/tend-ci-runner/skills/review-runs/SKILL.md is not under the read-only .claude/ mount (writable in this session).
  • Next review-runs invocation on an adopter repo edits .claude/skills/ via the new worktree pattern on the first try.

The review-runs skill's Step 6 tells the bot to edit `.claude/skills/`
files in place, but the checkout's `.claude/` directory is bind-mounted
read-only under the Claude Code 2.1.97+ sandbox (the same RCE-vector
protection that PR #216 handled for `.github/` in the nightly skill).
In-place edits fail with `OSError: [Errno 30] Read-only file system`.

Add the worktree pattern to Step 6 so the bot opens the fix PR from a
writable worktree under `$TMPDIR` from the start, instead of hitting the
error and diagnosing the mount mid-run.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@tend-agent tend-agent added the claude-behavior Behavioral issues found by review-reviewers label Apr 10, 2026
@max-sixty

Copy link
Copy Markdown
Owner

test whether using a worktree actually helps

@tend-agent

Copy link
Copy Markdown
Collaborator Author

Tested locally in this session and via an already-merged end-to-end case.

Local (this sandbox):

  • Workspace checkout: python3 write to /home/runner/work/tend/tend/.claude/skills/test.txt → OSError: [Errno 30] Read-only file system (same error the review-runs session hit).
  • git worktree add "$TMPDIR/wt-test" -b … HEAD → python3 write to $TMPDIR/wt-test/.claude/skills/test.txt → succeeded, 27 bytes. mount | grep "$TMPDIR/wt-test" shows zero bind mounts, so the worktree's .claude/ is backed by normal tmpfs-writable storage.

End-to-end (real CI): The review-runs session cited in the PR body (8adb40c1-4b13-4d11-97dc-bcbbe461b468) did the worktree dance ad-hoc after hitting the EROFS and successfully opened max-sixty/worktrunk#2050, which modifies .claude/skills/running-tend/SKILL.md (+26 lines). That PR is the end-to-end proof that editing, committing, pushing, and gh pr create all work from a $TMPDIR worktree in a CI sandbox. The fix here just codifies that recovery path into Step 6 so the next session doesn't have to rediscover it.

One nit I noticed while testing: git worktree remove from inside the workspace emits a harmless could not write config file .git/config: Device or resource busy warning (because .git/config sits next to the read-only bind-mounted paths and git tries to touch the config on removal). The worktree and branch are still cleaned up correctly, but it's worth being aware of if someone sees it in a future session's logs.

@max-sixty
max-sixty merged commit f7dfe75 into main Apr 10, 2026
3 checks passed
@max-sixty
max-sixty deleted the hourly/review-24235684411 branch April 10, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude-behavior Behavioral issues found by review-reviewers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants