Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Repository: luvs01/opencodex/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 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. |
✅ READY
Hygiene✅ Deterministic PR hygiene checks passed. |
37b3d5b to
bf4e97d
Compare
…lab-shutdown-issue Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> # Conflicts: # tests/lab/lab-automation-review-regressions.test.ts
The management route sits outside the data-plane drain gate, so a request accepted before listener teardown can call enqueueManualLabRun after runOptionalShutdownHooks already snapshotted the registry. The per-run hook it then registers is never invoked, and on an install where the Lab was never activated nothing had set shutdownRequested either, so the dispatch could continue past drainAndShutdown. The registry now reports whether the sweep ran; enqueueManualLabRun refuses post-sweep enqueues outright and re-checks after registering so a run that raced the snapshot still has its teardown applied inline. Co-Authored-By: Epinephrine <luvs01@hanmail.net>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Already addressed at head by 9e453a9:
|
A policy PUT (or CLI automation enable) resuming after runOptionalShutdownHooks() bypassed the manual-run-only gate added in 9e453a9: startLabAutomationScheduler registered an orphaned hook, reset shutdownRequested to false, and left a live interval dispatching Lab work outside the completed sweep. startLabAutomationScheduler now mirrors enqueueManualLabRun: an entry gate on didRunOptionalShutdownHooks() requests shutdown and returns, and a post-registration re-check keeps the latch set instead of starting a timer the completed snapshot cannot reach. The registration stays live so a repeat sweep still tears the scheduler down. Also clarifies the ANALYSIS finding: hooksRan is process-lifetime — every production drainAndShutdown caller exits or hands off to a new OS process, so there is no in-process restart; the test reset models one. Adds matching manual-run coverage (rejected after the sweep, dispatched again after a test reset) and an outcome-level regression test driving the applySchedulerPolicy path. Co-Authored-By: Epinephrine <luvs01@hanmail.net>
|
Fixed in e46307f.
Regression coverage added:
|
|
Clarified in e46307f: production has no in-process restart after a sweep. Both With that semantics settled, the scheduler side now behaves like the manual path: the previous "a scheduler restarted after shutdown is stoppable again" test (which assumed a live post-sweep start) is split into |
|
E2E verification of the Lab automation golden path — ran this branch as a real foreground server (
One scheduled run |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Summary
/api/lab/automation/runexecutions from continuing pastdrainAndShutdownwhen Lab was never activated, by ensuring manual runs register a shutdown hook so they are cancelled like other Lab activities.src/lab/automation/orchestrator.tsusingregisterOptionalShutdownHook(...), detached in afinallyso the hook cannot leak after completion; a completed sweep is treated as already fired — the run is refused instead of queued.startLabAutomationSchedulernow gates ondidRunOptionalShutdownHooks()— a policy PUT or CLI enable resuming after the sweep can no longer register an orphaned hook, resetshutdownRequested, and leave a live interval dispatching Lab work outside the completed sweep.hooksRanas a process-lifetime latch: productiondrainAndShutdowncallers exit or hand off to a new OS process, so there is no in-process restart;resetOptionalShutdownHooksForTestsmodels the fresh process.applySchedulerPolicypath), and the test-reset re-arm equivalents for both.Verification
bun run typecheck— clean.bun test --isolate tests/lib/optional-shutdown-hooks.test.ts tests/lab/lab-automation-review-regressions.test.ts— 28 pass.bun test --isolateovertests/lab/lab-automation.test.ts,lab-activation.test.ts,lab-automation-ingwannu-regressions.test.ts,lab-automation-management-http.test.ts,core-lab-boundary.test.ts, coderabbit/persisted-cap regression files — all pass; only a pre-existing unnamed afterEach hook timeout inlab-activation.test.tsreproduces on Windows even without this change.bun run privacy:scan,bun run structure:check— pass.--isolatemode.Checklist
Codex Task
Link to Devin session: https://app.devin.ai/sessions/cfc5342a3c4d4b7eb9c1b57b2adca7c6
Open in Devin Desktop: https://app.devin.ai/desktop/session/cfc5342a3c4d4b7eb9c1b57b2adca7c6?variant=devin
Requested by: @luvs01