Skip to content

enrich: start the branch cache refresh in its own session - #436

Merged
m4ttheweric merged 2 commits into
mainfrom
cd-refresh-detach
Sep 25, 2026
Merged

m4ttheweric merged 2 commits into
mainfrom
cd-refresh-detach

Conversation

@m4ttheweric

@m4ttheweric m4ttheweric commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

rt cd: the background cache refresh leaves the shell's process group

rt cd runs inside the shell's $(...), which shares the shell's process group. With a warm branch cache, the picker kicks off a background revalidation (spawnCacheRefresh) that stayed in that group for its whole GitLab/Linear round trip. herdr counts it as the pane's foreground job, so flock's launcher, which waits for the pane to go idle after rt cd, came back 10 to 15 seconds late.

What changed

  • spawnCacheRefresh spawns with detached: true, as rt's other background spawns (trash.ts, prune.ts, user-path.ts) already do.
  • Options moved into cacheRefreshSpawnOptions() so a test can pin them.

Verification

  • New enrich-refresh-detached.test.ts; the enrich suite (35 tests) passes.
  • Probed by hand: an unref'd Bun.spawn child inside $(...) stays in the shell's pgid; with detached: true it gets its own.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LW34UkBwoPSwp672E7Bh3Y

Summary by CodeRabbit

  • Bug Fixes
    • Cache refreshes now run independently of the terminal session that starts them, rather than being tied to its foreground process group. Refresh output no longer appears in the terminal, while the existing runtime environment is preserved. This helps refreshes continue without interfering with terminal activity.

rt cd runs inside the shell's $(...), which shares the shell's process group. The warm-cache revalidation it kicked off stayed in that group for its whole network round trip, so herdr (and flock's launcher, waiting for the pane to go idle after rt cd) read the pane as busy for 10 to 15 seconds after the picker closed. detached: true gives it a session of its own, as rt's other background spawns already do.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01LW34UkBwoPSwp672E7Bh3Y
@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Warning

Review limit reached

Next included review available in 50 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 84 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 7520a254-87be-4cd1-b449-5f356238160d

📥 Commits

Reviewing files that changed from the base of the PR and between 2a18b5b and b0c3ee0.

📒 Files selected for processing (2)
  • lib/__tests__/enrich-refresh-detached.test.ts
  • lib/enrich.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 2f20ca7f-4b87-448d-bfdd-abffbf76e7f0

📥 Commits

Reviewing files that changed from the base of the PR and between b983acc and 2a18b5b.

📒 Files selected for processing (2)
  • lib/__tests__/enrich-refresh-detached.test.ts
  • lib/enrich.ts

Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.


📝 Walkthrough

Walkthrough

The cache refresh spawn options now come from an exported helper. The helper preserves the child environment, ignores all three stdio streams, and sets detached mode. A test checks these option values.

Changes

Cache refresh process spawning

Layer / File(s) Summary
Define and validate spawn options
lib/enrich.ts, lib/__tests__/enrich-refresh-detached.test.ts
spawnCacheRefresh uses options returned by cacheRefreshSpawnOptions(). The helper sets the child environment, ignored stdio, and detached: true. The test checks these values.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 2a18b

The cache refresh is configured to run detached, and the focused test checks its spawn options. No actionable merge-blocking risk is evidenced; the PR is ready for normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: spawning the branch cache refresh in its own session.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01LW34UkBwoPSwp672E7Bh3Y
@m4ttheweric
m4ttheweric merged commit 03825aa into main Sep 25, 2026
6 checks passed
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