Fix lifecycle validation teardown leaks - #366
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughThe PR makes daemon shutdown await actor and server teardown, adds lifecycle-validation orphan detection and cleanup, and integrates cleanup results into restart summaries, rendered diagnostics, and repair events. Signal handlers now await shutdown and use signal-specific exit codes. ChangesLifecycle runtime management
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Sequence Diagram(s)sequenceDiagram
participant Restart
participant OrphanCleanup
participant Runtime
participant Diagnostics
Restart->>OrphanCleanup: await lifecycle orphan cleanup
Restart->>Runtime: build restart plan
Restart->>Diagnostics: report counts and repair event
Diagnostics-->>Restart: rendered restart result
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/daemon.ts (1)
447-476: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy liftStop accepting project work before snapshotting actors.
The server remains active while Line 459 snapshots actors. A concurrent route can create an actor afterward; Line 468 then clears it without calling
stop(), leaking its project service during shutdown. Close admission and drain in-flight ensures before the snapshot, or keep draining actors until none remain.As per coding guidelines, changes under
src/*.tsrequireyarn build, and CLI runtime verification must use a local release asset.🤖 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 `@src/daemon.ts` around lines 447 - 476, Update stopUnlocked() to close project-work admission and await/drain in-flight requests before snapshotting this.projectActors. Ensure no route can create an actor after the actors array is captured; then stop all captured actors before clearing the map and completing shutdown. Validate the change with yarn build and CLI runtime verification using a local release asset.Source: Coding guidelines
🤖 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.
Inline comments:
In `@src/lifecycle-orphans.ts`:
- Around line 97-117: Separate attempted, confirmed-cleaned, and failed orphan
targets in src/lifecycle-orphans.ts lines 97-117, counting a PID as cleaned only
after confirmed exit and preserving errors for unsuccessful cleanup. In
src/runtime-restart.ts lines 894-904, derive cleaned counts from confirmed
successes and append cleanup errors to summary.failures. In
src/runtime-restart.ts lines 932-945, emit the cleanup event whenever errors
exist, including when no target was successfully removed.
---
Outside diff comments:
In `@src/daemon.ts`:
- Around line 447-476: Update stopUnlocked() to close project-work admission and
await/drain in-flight requests before snapshotting this.projectActors. Ensure no
route can create an actor after the actors array is captured; then stop all
captured actors before clearing the map and completing shutdown. Validate the
change with yarn build and CLI runtime verification using a local release asset.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 292017b5-a876-4fec-a35d-47274a5f8dd9
📒 Files selected for processing (8)
src/daemon.test.tssrc/daemon.tssrc/lifecycle-orphans.test.tssrc/lifecycle-orphans.tssrc/main.tssrc/repair-events.tssrc/runtime-restart.test.tssrc/runtime-restart.ts
|
Review loop follow-up: CodeRabbit is green on 648b8aa, and the independent sub-agent review found no correctness issues. Local validation for this phase passed: yarn typecheck, yarn lint, yarn build, full yarn test (174 files / 2523 tests), plus an isolated live orphan-cleanup smoke that removed a fake lifecycle validation node daemon and tmux session without touching wrapper processes. |
Summary
Validation
Summary by CodeRabbit