Skip to content

session-distill: Cross-Repo Promotion races a concurrent session in the shared PLUGINS_REPO checkout #2113

Description

@laurigates

Skill

session-plugin:session-distill — the Cross-Repo Promotion ([PROMOTE]) hand-off.

What happened

The promote hand-off instructs:

PLUGINS_REPO="$HOME/repos/laurigates/claude-plugins"
git -C "$PLUGINS_REPO" fetch origin
git -C "$PLUGINS_REPO" switch -c <branch> origin/main
# ... Write/Edit the SKILL.md under "$PLUGINS_REPO" ...

It operates directly on the shared, long-lived local checkout of claude-plugins. In this portfolio that checkout is frequently a contended checkout — another Claude session was actively working in it (branch fix/redundant-write-permission-rule, editing .claude/rules/agentic-permissions.md). The sequence raced:

  1. My session switch -c'd the promote branch and edited SKILL.md.
  2. The concurrent session's operation autostashed my in-flight edit (it appeared as stash@{0}: … carried-over justfile-expert edit) and moved HEAD to its own branch.
  3. My git add/commit then found "nothing to commit, working tree clean" — the edit had been stashed away under me.

A git worktree add <my-branch> then failed (already used by worktree) because HEAD had moved again between calls. I recovered by making an isolated git clone --single-branch of the promote branch, re-applying the edit there, committing, and pushing — which cannot touch the contended checkout (landed as claude-plugins#2110).

Suggested fix

The promote hand-off should be isolated from the shared PLUGINS_REPO working tree by construction, since a promote can fire mid-session while a coworker session owns that checkout. Options:

  • Do the promote in a throwaway git clone --depth 1 --single-branch --branch <b> (or a dedicated git worktree), edit + commit + push there, then remove it — never switch -c the shared checkout.
  • At minimum, cross-reference the existing shared-checkout rules (repos/.claude/rules/concurrent-session-pr-check.md, shared-checkout-branch-isolation.md, git-plugin:git-coworker-check) in the promote section, and gate on a coworker check before mutating PLUGINS_REPO.

Evidence

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions