fix: refresh stale runner PATH snapshots - #75
Conversation
📝 WalkthroughWalkthroughAdds ChangesPATH Snapshot Staleness Detection and Auto-Restart
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
Sources/Services/RunnerManager.swift (1)
1253-1266: ⚡ Quick winRemove duplicate remote-idle confirmation in the stale-scan loop.
runnerIsConfirmedIdle(_:)is invoked in both the scan phase and the restart phase, which doublesghService.listRemoteRunnerscalls for the same runner without adding safety (the restart path already re-validates idleness).♻️ Suggested simplification
private func restartRunnersWithStalePathSnapshots(candidateIDs: Set<UUID>? = nil) async { var staleRunnerIDs: [UUID] = [] let runnerSnapshot = runners for runner in runnerSnapshot { guard runner.status == .running else { continue } guard !runner.busy else { continue } if let candidateIDs { guard candidateIDs.contains(runner.id) else { continue } } let isolation = runner.effectiveIsolationMode(global: currentSettings.isolationMode) guard isolation != .container else { continue } guard processManager.isProcessAlive(for: runner.id) else { continue } guard let runnerDir = try? RunnerDirectory.path(for: runner.id, isolation: isolation) else { continue } guard RunnerEnvironment.pathSnapshotNeedsRefresh(in: runnerDir) else { continue } - guard await runnerIsConfirmedIdle(runner) else { continue } staleRunnerIDs.append(runner.id) } for id in staleRunnerIDs { await restartRunnerForPathSnapshotRefresh(id) } }Also applies to: 1293-1295
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Sources/Services/RunnerManager.swift` around lines 1253 - 1266, The stale-scan loop in RunnerManager contains a redundant call to runnerIsConfirmedIdle(runner) that duplicates idle confirmation already performed during the restart phase. Remove the guard statement that calls await runnerIsConfirmedIdle(runner) from the scan loop (the line with guard await runnerIsConfirmedIdle(runner) else { continue }) since the restart path re-validates idleness, eliminating unnecessary duplicate calls to ghService.listRemoteRunners for the same runner.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@Sources/Services/RunnerManager.swift`:
- Around line 1253-1266: The stale-scan loop in RunnerManager contains a
redundant call to runnerIsConfirmedIdle(runner) that duplicates idle
confirmation already performed during the restart phase. Remove the guard
statement that calls await runnerIsConfirmedIdle(runner) from the scan loop (the
line with guard await runnerIsConfirmedIdle(runner) else { continue }) since the
restart path re-validates idleness, eliminating unnecessary duplicate calls to
ghService.listRemoteRunners for the same runner.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d4ecb74d-24e6-4026-98cd-6b1f700c924b
📒 Files selected for processing (3)
Sources/Services/RunnerEnvironment.swiftSources/Services/RunnerManager.swiftTests/MacRunnerTests/MacRunnerTests.swift
|
🎉 This PR is included in version 1.17.4 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
.pathsnapshots that are missing Homebrew tool directoriesRoot Cause
Live runners created before the PATH fix kept running with old
.pathsnapshots like/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin, so Actions could not resolve Homebrew-installed tools such as/opt/homebrew/bin/npm. Restarting the runners manually fixed the immediate failure, but Mac Runner should repair this state at the runner-management layer.Validation
ditto-apprunners rewrote.pathwith/opt/homebrew/binafter restartgit diff --checkswift testattempted but blocked by existing local toolchain/repo issues: missingPreviewsMacrosfor#Previewand existing Containerization actor-isolation diagnostics inRunnerManagerSummary by CodeRabbit
New Features
Tests