← Back to Pull requests

test: wait for the pane's shell to exit before removing the isolation test's directory #1169

Closed
unknown closed this pull request without merging on Oct 12, 2026 09:13 UTC
View on GitHub
unknown unknown commented on Oct 11, 2026 20:28 UTC
Author

claude-interactive-isolation.test.ts ("classic Claude pane-shell isolation") sometimes fails in its cleanup on macOS runners with ENOTEMPTY: directory not empty, rmdir '…/claude-isolation-…'. The assertions had already passed, and a rerun passed.

Why the directory isn't empty:

  • The test removes its temporary directory right after tmux kill-server.

  • The pane runs an interactive Bash whose HISTFILE is in that directory. When the server hangs up, Bash writes its history as it exits. On macOS that's /bin/bash 3.2, which opens the file with create-and-truncate.

  • If rmSync has already unlinked history by then, Bash creates it again, and the final rmdir fails.

  • The tmux socket can't cause this, because the server only removes it. Removal can't make the directory non-empty, and force: true ignores it.

  • This is read from the source and from the two failures. I couldn't reproduce it on demand.
  • The change, in the test only:

  • It records the interactive Bash's PID from the rc's own snapshot ($$, the first field of rcInitial). It doesn't use #{pane_pid}, which can be a wrapper shell that tmux starts the command through and that exits first.

  • After kill-server, it waits up to 5 seconds for that shell to exit (process.kill(pid, 0) until it throws). It then removes the directory with maxRetries: 5 in every case. Cleanup runs after the test body rather than in finally, and errors are reported in order: the test's own failure, then "pane shell did not exit within 5 s" if the shell is still alive, then a removal error.

  • The assertions are unchanged. A failed assertion still fails the test, since the cleanup runs in the same finally as before.
  • 🤖 Generated with Claude Code

    https://claude.ai/code/session_01WfCu2MmcrSGRNX9Rjv1h6u

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    Tests
    Improved reliability of interactive isolation test cleanup by waiting for the pane’s shell process to exit before removing temporary files. Temporary-directory removal is retried if needed, and cleanup errors are reported after any test failure or shell-exit timeout. This helps ensure cleanup problems are surfaced clearly without obscuring the original test failure.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 298 lines (+223 / -75) across 3 files Reviewer: mvschwarz Review duration: 764m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 298 lines diff across 3 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.341
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #1169"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45% (MEDIUM) · Higher = larger blast radius
    45%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.8% · Safe to merge
    17.8%