Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesCancel active environment reconciliation during suspension, bound provider inspections, and preserve interrupted provisioning for recovery. Example: Suspension begins while an 85-second provider inspection is pending.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR repairs a source-confirmed reconciliation cancellation gap; no actionable defect was found in the production change or scheduler-test repair. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Gateway environment service coordinates provider observations, provisioning, placement recovery, and shutdown through existing operation queues and lifecycle guards. flowchart TD
A[Gateway suspension or shutdown] --> B[Reconciliation cancellation]
B --> C[Environment service]
C --> D[Provider inspection]
C --> E[Provider mutation queue]
D --> F[Release cancelled observation]
E --> G[Await producer settlement]
F --> H[Preserve lease for recovery]
G --> H
Technical reviewBest possible solution: Retain the existing lifecycle owners while cancelling observations promptly and joining write-capable producers through settlement. Do we have a high-confidence way to reproduce the issue? Main checks suspension before admission but does not cancel admitted reconciliation, and its provider queue retains pending inspections; the supplied baseline and Gateway scenarios exercise that path. Is this the best way to solve the issue? The patch fixes cancellation at the existing service owner, separates observations from mutations, and keeps provisioning recovery identity without introducing a parallel lifecycle owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5c1432f10bba. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +67, Tests +84, Docs +4, Other +35. Total +190 across 12 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 20, 2026, 1:11 PM ET / 17:11 UTC (Revision 2). |
|
@clawsweeper re-review The CI failure in the reversible-suspension scheduler test is fixed on |
|
🦞👀 Re-review progress:
|
91fd772 to
3c9c30f
Compare
…penclaw#178538) * fix(gateway): cancel in-flight environment reconciliation on suspend * test(gateway): await resumed environment inspection
What Problem This Solves
Fixes a shutdown delay when worker-environment reconciliation starts immediately before suspension and a provider inspection remains pending. Follow-up to #177756.
User Impact
Suspension now cancels an already-running environment reconciliation. Read-only inspections have a 15-second budget and late replies cannot hold the reconcile guard or change environment state. Resuming permits the next sweep to retry the same environment.
Why This Change Was Made
The startup/60-second sweep already stopped admitting new candidates during suspension, but did not cancel admitted work. Provider inspection also shared the mutation queue's requirement to retain the underlying promise after cancellation. The service now releases cancelled observations while retaining actual provider mutations until settlement.
Maintenance interruption has a distinct cancellation reason: it preserves the lease and provisioning operation ID instead of recording user-requested destruction. Runtime installation keeps its existing transfer-sized budget. Pending-operation traces now distinguish bootstrap and transport teardown.
The original production trace did not identify the exact nested await. This change repairs the reproduced inspection and suspension gaps; it does not claim that every write-capable cleanup can be abandoned or that all possible shutdown delays are eliminated.
Evidence
An 85-second HTTP inspection was already active before suspension. Two concurrent baseline/candidate pairs ran under an exclusive measurement lock, swapping the 16-core CPU halves between pairs, with separate synthetic state and ports.
Baseline reconciliation remained active one second after suspension and waited for the HTTP reply. The fixed reconcile guard took 0 ms in both runs; both active placements and their manifests were retained. The baseline produced the same pending-span pattern as the reported stall. These timings cover the real placement/environment sidecars, not full Gateway process shutdown.
Full-Gateway proof on
91fd772d21b8f63fc2cc7e1e345fce1a55a84dde: an actual CLI Gateway loaded a registered provider and a persisted ready environment, began an 85-second HTTP inspection, receivedgateway.suspend.prepare, then SIGTERM. The cancellation-aware provider exited cleanly in 563.63 ms after SIGTERM; the suspend RPC took 46.96 ms. The remote response never completed. Reopening SQLite confirmed the same ready environment/lease with no destruction request.A second full-process case deliberately ignored the inspection signal. Reconciliation and its guard still released immediately, but the plugin lifetime retained its raw call for the existing five-second retirement grace. Final cleanup traced 5,131.8 ms, narrowly missing the five-second full-process target; exact process-exit latency was not captured because the deadline assertion fired. The lease was preserved. This plugin ownership boundary is unchanged.
No Testbox/Crabbox lease was allocated. Both harnesses used synthetic state in a Linux sandbox. The full-process fixture used a real Gateway, registered provider, SQLite, and HTTP transport; its unreachable remote was seeded and had no running worker process. Production restart verification and identification of the original production nested await remain outstanding.
Production source: +102/−35 lines (net +67); the stat excluding tests/docs also includes +54/−19 benchmark lines, for net +102. Tests: +104/−20 lines (net +84). Production code grows to carry cancellation lifetime and reason, enforce the read budget, and expose the previously opaque wait. No new user configuration, schema, dependency, or compatibility path.