You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3f6be7a
Browse filesBrowse the repository at this point in the historyBrowse files
fix(runner): keep runner-rescue stashes findable with refs
The runner clears each clone's stash reflog between sessions, so `git stash list` showed none of the sweep's runner-rescue stashes. Only the newest survived, as refs/stash, and the older ones were left for git gc. The sweep now also points a ref under refs/runner-rescue/ at each rescue stash. Names get a counter when one already exists. The sweep adopts an earlier sweep's rescue still in refs/stash, and expires rescue refs after CLAUDE_RUNNER_RESCUE_DAYS. The docs, runner README, skill and SessionStart hook now say to list rescues with `git for-each-ref refs/runner-rescue` and restore one with `git stash apply <ref>`. Leftovers a session stashes itself get a ref too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T3Cc2FfNKgEMqAZMMRVvjp
Copy file name to clipboardExpand all lines: docs/content/workspaces/ai-tools.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -121,5 +121,5 @@ On every start, the runner runs in the `tmux` session `claude-runner` (`tmux att
121
121
122
122
- **Use a workspace only for the runner.** The runner rewrites `~/.gitconfig` and `~/.config/git` before every session. It can't be turned on together with remote control.
123
123
- **Concurrent sessions** (1 to 4) sets how many sessions run at once. They share the workspace's Docker daemon and DDEV, and a skill installed in`~/.claude/skills/coder-shared-workspace` tells them how to stay out of each other's way. For full isolation, use several workspaces with one session each; the same environment secret works in all of them.
124
-
- **Checkouts are cleaned between sessions.** A runner keeps its clones under `~/workspace/runner-<n>`. When a session ends, including when the runner releases it after 30 idle minutes, `claude-runner-sweep` cleans that runner's directory, and it runs again before each runner start. Uncommitted changes become `runner-rescue` stashes in the clone (`git stash list`). Worktrees are removed. Extra clones a session made are deleted if everything in them is pushed, and otherwise moved to `~/.local/state/claude-runner-rescue/`. Everything the sweep does is logged in`~/.local/state/claude-runner-rescue/log`, and rescues are kept for 30 days. If a checkout is still dirty when a session starts, a hook tells Claude to stash the leftovers rather than work around them.
124
+
- **Checkouts are cleaned between sessions.** A runner keeps its clones under `~/workspace/runner-<n>`. When a session ends, including when the runner releases it after 30 idle minutes, `claude-runner-sweep` cleans that runner's directory, and it runs again before each runner start. Uncommitted changes become `runner-rescue` stashes in the clone. The runner clears the stash list between sessions, so each rescue also gets a ref: list them with `git for-each-ref refs/runner-rescue` and restore one with `git stash apply <ref>`. Worktrees are removed. Extra clones a session made are deleted if everything in them is pushed, and otherwise moved to `~/.local/state/claude-runner-rescue/`. Everything the sweep does is logged in`~/.local/state/claude-runner-rescue/log`, and rescues are kept for 30 days. If a checkout is still dirty when a session starts, a hook tells Claude to stash the leftovers rather than work around them.
125
125
- **Pushing to your fork.** Runner and remote-control sessions use the workspace SSH agent: your own agent when you have one forwarded (VS Code, `coder ssh -A`), otherwise the Coder workspace key. Add your fork as an SSH remote, such as `git@github.com:<you>/<repo>`. If you don't forward an agent, add the key that `coder publickey` prints to your GitHub account.
echo"This session was released earlier, and the runner saved what it had left uncommitted. Entries in $rescue_root/log:"
22
22
grep -F -- "$sid""$rescue_root/log"| tail -10
23
-
echo"Stashes are in the checkout named there (find them with: git -C <checkout> stash list | grep runner-rescue). Before restoring one, tell the user what it holds."
23
+
echo"Stashes are in the checkout named there (find them with: git -C <checkout> for-each-ref refs/runner-rescue, and restore one with git stash apply <ref>). Before restoring one, tell the user what it holds."
24
24
fi
25
25
status=$(git -C "$dir" status --porcelain 2>/dev/null)||exit 0
26
26
[ -n"$status" ] ||exit 0
27
27
count=$(printf '%s\n'"$status"| wc -l)
28
28
echo"The checkout $dir is not clean at the start of this session: an earlier session left $count changed or untracked path(s)."
29
-
echo"They are not part of your task. Save them with: git stash push --include-untracked -m \"leftovers from an earlier session\". Then continue in this checkout; do not make a worktree or a new clone to avoid them. See \"Leave the checkout clean\" in the coder-shared-workspace skill."
29
+
echo"They are not part of your task. Save them with: git stash push --include-untracked -m \"leftovers from an earlier session\" && git update-ref refs/runner-rescue/\$(date -u +%Y%m%d-%H%M%S)-leftovers refs/stash. Then continue in this checkout; do not make a worktree or a new clone to avoid them. See \"Leave the checkout clean\" in the coder-shared-workspace skill."
30
30
printf'%s\n'"$status"| head -20
31
31
[ "$count"-le 20 ] ||echo"... and $((count -20)) more"
echo"This session was released earlier, and the runner saved what it had left uncommitted. Entries in $rescue_root/log:"
22
22
grep -F -- "$sid""$rescue_root/log"| tail -10
23
-
echo"Stashes are in the checkout named there (find them with: git -C <checkout> stash list | grep runner-rescue). Before restoring one, tell the user what it holds."
23
+
echo"Stashes are in the checkout named there (find them with: git -C <checkout> for-each-ref refs/runner-rescue, and restore one with git stash apply <ref>). Before restoring one, tell the user what it holds."
24
24
fi
25
25
status=$(git -C "$dir" status --porcelain 2>/dev/null)||exit 0
26
26
[ -n"$status" ] ||exit 0
27
27
count=$(printf '%s\n'"$status"| wc -l)
28
28
echo"The checkout $dir is not clean at the start of this session: an earlier session left $count changed or untracked path(s)."
29
-
echo"They are not part of your task. Save them with: git stash push --include-untracked -m \"leftovers from an earlier session\". Then continue in this checkout; do not make a worktree or a new clone to avoid them. See \"Leave the checkout clean\" in the coder-shared-workspace skill."
29
+
echo"They are not part of your task. Save them with: git stash push --include-untracked -m \"leftovers from an earlier session\" && git update-ref refs/runner-rescue/\$(date -u +%Y%m%d-%H%M%S)-leftovers refs/stash. Then continue in this checkout; do not make a worktree or a new clone to avoid them. See \"Leave the checkout clean\" in the coder-shared-workspace skill."
30
30
printf'%s\n'"$status"| head -20
31
31
[ "$count"-le 20 ] ||echo"... and $((count -20)) more"
0 commit comments