chore(.dev): run wrapper from REPO_ROOT to survive stale-PR checkouts#55
Merged
Conversation
When the agent does `gh pr checkout <stale-PR>` on a Dependabot branch forked before `.dev/` was merged to main, `.dev/` is unlinked from disk. If the wrapper's cwd is `.dev/`, the shell's $PWD becomes a dead inode and every subsequent command — including the queue's `gh pr list` — fails with "Unable to read current working directory." Switch the wrapper to cd into REPO_ROOT at startup and reference prompt files via $SCRIPT_DIR/. REPO_ROOT survives any branch switch the agent makes inside its session. This also fixes the agent's own bash cwd (it inherits the wrapper's cwd via the claude subprocess), so the dance where the agent had to spawn a worktree subagent as a workaround goes away. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
docs-preview | dfe909d | Commit Preview URL Branch Preview URL |
May 13 2026, 02:44 PM |
7 tasks
jrphilo
added a commit
that referenced
this pull request
May 13, 2026
Combines #52 and #53 into a single PR off main, avoiding the rebase cascade after #44/#42/#54/#55 churn. Both are mechanical pnpm.overrides additions: - protobufjs ^7.5.6 — clears alerts #7-14 (GHSA-q6x5-8v7m-xcrf, GHSA-jvwf-75h9-cwgg, GHSA-75px-5xx7-5xc7, GHSA-fx83-v9x8-x52w, GHSA-2pr8-phx7-x9h3, GHSA-66ff-xgx4-vchm, GHSA-685m-2w69-288q). Reached via posthog-js OTLP exporter; not directly imported by our app. - fast-xml-builder ^1.1.7 — clears alerts #3, #4 (GHSA-5wm8-gmm8-39j9, GHSA-45c6-75p6-83cc). Reached via @opennextjs/cloudflare → AWS SDK build/deploy tooling; not directly used. Replaces #52, #53. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jrphilo
added a commit
that referenced
this pull request
May 13, 2026
…er (#57) Combines #52 and #53 into a single PR off main, avoiding the rebase cascade after #44/#42/#54/#55 churn. Both are mechanical pnpm.overrides additions: - protobufjs ^7.5.6 — clears alerts #7-14 (GHSA-q6x5-8v7m-xcrf, GHSA-jvwf-75h9-cwgg, GHSA-75px-5xx7-5xc7, GHSA-fx83-v9x8-x52w, GHSA-2pr8-phx7-x9h3, GHSA-66ff-xgx4-vchm, GHSA-685m-2w69-288q). Reached via posthog-js OTLP exporter; not directly imported by our app. - fast-xml-builder ^1.1.7 — clears alerts #3, #4 (GHSA-5wm8-gmm8-39j9, GHSA-45c6-75p6-83cc). Reached via @opennextjs/cloudflare → AWS SDK build/deploy tooling; not directly used. Replaces #52, #53. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root-causes the "Unable to read current working directory" failure exposed by #54's better error reporting.
When the agent does `gh pr checkout ` on a Dependabot branch forked before `.dev/` was merged to main, `.dev/` is unlinked from disk. If the wrapper's cwd is `.dev/`, the shell's `$PWD` becomes a dead inode and every subsequent command fails — `git` errors with the message above, `gh pr list` fails through it, the queue check exits.
Fix: cd into `REPO_ROOT` at startup instead of `SCRIPT_DIR`. Reference prompt files via `$SCRIPT_DIR/` absolute paths. `REPO_ROOT` is stable across any branch switch.
This also fixes the agent's own bash cwd (it inherits the wrapper's cwd via the `claude` subprocess) — so the workaround where the agent spawned a worktree subagent after its own shell broke goes away too. Faster sessions, no orphan worktrees.
Test plan
🤖 Generated with Claude Code