Skip to content

feat: Codex App worktree and sandbox compatibility#901

Open
arittr wants to merge 10 commits intodevfrom
drew/pri-823-codex-app-compat
Open

feat: Codex App worktree and sandbox compatibility#901
arittr wants to merge 10 commits intodevfrom
drew/pri-823-codex-app-compat

Conversation

@arittr
Copy link
Copy Markdown
Collaborator

@arittr arittr commented Mar 24, 2026

Summary

Makes superpowers skills work correctly in Codex App's sandbox environment, where the agent runs in an externally-managed worktree with detached HEAD.

Key changes:

  • Environment detection added to using-git-worktrees (Step 0) and finishing-a-development-branch (Step 1.5) — detects linked worktrees and detached HEAD via read-only git commands
  • Sandbox-aware finishing — when in a detached HEAD worktree, the agent commits work and outputs a handoff payload instead of trying to branch/push/PR (which would fail)
  • Worktree cleanup guard — prevents accidental deletion of externally-managed worktrees
  • codex-tools.md — documents environment detection patterns and Codex App finishing flow
  • Automated tests for environment detection logic

Test plan

  • Shell tests for environment detection (normal repo, linked worktree, detached HEAD)
  • Manual test results documented in plan
  • End-to-end test in Codex App sandbox

🤖 Generated with Claude Code

@arittr
Copy link
Copy Markdown
Collaborator Author

arittr commented Mar 24, 2026

This change is part of the following stack:

Change managed by git-spice.

@arittr arittr changed the base branch from dev to drew/fix-frontmatter-docs March 24, 2026 00:36
@arittr arittr force-pushed the drew/pri-823-codex-app-compat branch from 0e5b633 to c24dc43 Compare March 24, 2026 00:36
@arittr arittr force-pushed the drew/fix-frontmatter-docs branch from 71a04cd to 1830941 Compare March 24, 2026 01:19
@arittr arittr changed the base branch from drew/fix-frontmatter-docs to drew/subagent-read-claude-md March 24, 2026 01:20
@arittr arittr force-pushed the drew/pri-823-codex-app-compat branch from c24dc43 to 3feeb2e Compare March 24, 2026 01:20
@arittr arittr force-pushed the drew/subagent-read-claude-md branch from 457abac to 0cc80b1 Compare March 24, 2026 01:43
@arittr arittr force-pushed the drew/pri-823-codex-app-compat branch from 3feeb2e to c498704 Compare March 24, 2026 01:43
Drew Ritter and others added 10 commits March 23, 2026 18:47
Skip worktree creation when already in a linked worktree. Includes
sandbox fallback for permission errors on git worktree add.
Clarify that skill ensures a workspace exists, not that it always creates one.
…ion (PRI-823)

Detect externally managed worktrees with detached HEAD and emit handoff
payload instead of 4-option menu. Includes commit SHA and data loss warning.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Re-detect externally managed worktree at cleanup time and skip removal.
Also fixes pre-existing inconsistency: cleanup now correctly says
Options 1 and 4 only, matching Quick Reference and Common Mistakes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…(PRI-823)

Clarify that using-git-worktrees ensures a workspace exists rather than
always creating one.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…PRI-823)

Document the git-dir vs git-common-dir detection pattern and the Codex
App's native finishing flow for skills that need to adapt.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests git-dir vs git-common-dir comparison in normal repo, linked
worktree, detached HEAD, and cleanup guard scenarios.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Defers $TEMP_DIR expansion to execution time and quotes the variable
inside the trap, protecting against paths with spaces.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tion (PRI-823)

Path A (detached HEAD in externally managed worktree) was unreachable
because Step 1 halted on test failure before Step 1.5 could detect the
restricted environment. Reorder so detection runs first — Path A now
skips test verification entirely since the toolchain may not be available
in sandbox environments.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update codex-tools.md to reference Step 1 (was Step 1.5) after the
finishing skill reorder. Add manual Codex App test results table to
the design spec — 4/5 passed, 1 N/A (sandbox doesn't block git writes
in Local threads).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@arittr arittr force-pushed the drew/pri-823-codex-app-compat branch from c498704 to 20fabcd Compare March 24, 2026 01:48
@arittr arittr changed the base branch from drew/subagent-read-claude-md to dev March 24, 2026 01:48
@obra obra added enhancement New feature or request codex Issues related to OpenAI Codex support worktrees Git worktree management no-obvious-human-review Submission shows no evidence of human review labels Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex Issues related to OpenAI Codex support enhancement New feature or request no-obvious-human-review Submission shows no evidence of human review worktrees Git worktree management

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants