fix(lab): rebind CL-08 runtime ownership across server replacement - #1719
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughLab activation now separates static registrations from server-owned runtime bindings. Automation dependencies and route execution are rebound per owner, with idempotent cleanup and isolated startup errors. Tests cover successor ownership, same-process restart, and scheduler lifecycle. ChangesLab activation runtime lifecycle
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to The PR makes a localized lifecycle fix for CL-08 runtime ownership and adds regressions for successor handoff and same-process restart behavior; no actionable merge-blocking risk remains beyond normal checks and review. Sequence Diagram(s)sequenceDiagram
participant LabActivation
participant ServerResourceOwnership
participant AutomationScheduler
LabActivation->>ServerResourceOwnership: Install runtime binding
ServerResourceOwnership-->>LabActivation: Establish active owner
LabActivation->>AutomationScheduler: Start automation
AutomationScheduler-->>LabActivation: Return startup result
LabActivation->>ServerResourceOwnership: Release predecessor binding
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
|
✅ Deterministic PR hygiene checks passed. |
Summary
Root cause
Follow-up to #1447.
activateLab()cached activation byconfigDirfor the process lifetime. Later lifecycle hardening madesetLabAutomationDispatchDeps()and the scheduler server-owner scoped. When that owner released, CL-08 dispatch authority and its scheduler were removed, but the process-wide activation cache still said the root was active. A replacement server then returned early fromactivateLab()and never restored CL-08 runtime authority.The same mismatch also meant an overlapping same-root successor could not take ownership before its predecessor released.
Fix
The activation record now keeps static Lab slots separate from the current runtime binding. Runtime cleanup updates that record through the existing server-resource owner. A fresh config object can take over an active root, while already-seen predecessor configs cannot steal authority back on a later management request. If the current runtime owner has already ended, the next activation can rebind even when the same config object is reused.
The existing dispatcher token semantics remain authoritative: the successor is installed first, then predecessor release becomes a no-op for the successor scheduler and dispatch authority.
Verification
devSHA81ada7cd092d4be3b25f3013c996cd3262a2f99b.dev: 2 commits ahead, 0 behind.src/lib/lab-activation.tsandtests/lab-activation.test.ts.gh, so local test/typecheck execution is not available. GitHub Actions is the execution authority for this branch.Scope
No user-facing configuration, database migration, dependency, environment-variable, routing-policy, or documentation changes.
Checklist
Summary by CodeRabbit
New Features
Bug Fixes