Skip to content

🤖 fix: harden remote base repo normalization#3496

Open
ethanndickson wants to merge 1 commit into
mainfrom
workspace-setup-jets
Open

🤖 fix: harden remote base repo normalization#3496
ethanndickson wants to merge 1 commit into
mainfrom
workspace-setup-jets

Conversation

@ethanndickson

Copy link
Copy Markdown
Member

Summary

Harden SSH/Coder remote project base repositories so Mux treats .mux-base.git as an internal bare common git directory rather than a user checkout. The runtime now strips shared checkout config, keeps the base HEAD on an internal sentinel ref, and creates worktrees without relying on the base repo HEAD being trunk.

Background

A poisoned shared base repo config can make every newly-created linked worktree inherit core.worktree or core.bare from .mux-base.git, causing workspace repo verification to fail. Separately, leaving the bare base repo HEAD on trunk can make tools such as Graphite believe trunk is checked out at .mux-base.git.

Implementation

The SSH runtime now normalizes base repos by unsetting core.bare and core.worktree via --git-dir plumbing, then points HEAD at refs/mux-internal/base-head. The warm fast-path performs the same best-effort cleanup before reusing a snapshot. Worktree creation now uses a detached worktree add followed by checkout -B/-b inside the new worktree so the base repo HEAD can remain on the internal sentinel.

Validation

The focused SSH integration regression covers the incident shape: core.bare cleanup, core.worktree cleanup, sentinel HEAD, and warm fast-path repair of a poisoned base repo. Local static-check also passed before pushing.

Risks

Risk is concentrated in SSH/Coder remote workspace creation and fork paths. The detached-add flow intentionally preserves the existing branch semantics but changes the order from one worktree-add command to worktree-add plus checkout, so rollback would be to restore direct worktree add and only keep config cleanup.


Generated with mux • Model: openai:gpt-5.5 • Thinking: xhigh • Cost: $27.40

Keep SSH remote .mux-base.git repositories from leaking shared checkout config into linked worktrees. The runtime now strips core.bare/core.worktree, keeps the base HEAD on an internal sentinel ref, and creates new worktrees via detached checkout before attaching the workspace branch so the base repo never masquerades as trunk.

---

_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `$27.40`_

<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=27.40 -->
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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