Repository navigation
refactor: reuse activated worker placement facts - #169086
Conversation
Pass the committed active placement to maintenance scheduling and remove its native reread. Deprecate remaining synchronous placement readers in favor of existing worker operations; preserve final effect guards and released compatibility.
|
🦞👀 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: needs maintainer review before merge. What this changesThis PR passes the committed active placement to maintenance scheduling and adds deprecation warnings to synchronous placement readers. Example: A plugin calls workerSessionPlacementService.get("session-42").
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: the maintainer-authored refactor removes a redundant activation read while preserving current authority checks and released synchronous contracts; no actionable defect was found. Priority: P3 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherPlacement dispatch commits worker activation and notifies node workspace maintenance, which prepares current placement facts and validates authority before sending retention commands. flowchart TD
A[Placement dispatch] --> B[Placement worker commit]
B --> C[Committed active placement]
C --> D[Activation callback]
D --> E[Maintenance coordinator]
E --> F[Current placement and node checks]
F --> G[Node retention command]
Technical reviewBest possible solution: Reuse the committed activation result for scheduling while retaining maintenance authority checks and the released synchronous SDK compatibility window. Do we have a high-confidence way to reproduce the issue? Current-main source directly establishes the redundant activation read; this is an internal refactor rather than a reported runtime failure. Is this the best way to solve the issue? Passing the existing owner's committed result removes the redundant read without introducing a cache, worker request, or competing authority owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 961bd6b16773. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +29, Tests +5, Docs +7. Total +41 across 7 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 11, 2026, 9:25 AM ET / 13:25 UTC (Revision 2). |
Pass the placement owner's committed active row to Gateway maintenance instead of rereading SQLite and repeating the active-state check after activation. Deprecate synchronous placement readers in favor of their existing worker-backed async counterparts while preserving released SDK compatibility and real effect/recovery authority checks. Accepted edge case: maintenance can consume a committed activation after a later placement transition; existing effect-boundary checks remain authoritative. Proof: focused owner/compatibility tests, one clean Codex review, three alternating SQL measurement pairs, static checks, SDK API comparison, and unchanged T1/dialect ratchets. One fewer SELECT per placement activation, no added worker request; warmed chat workload remains within noise.
What Problem This Solves
Worker activation rereads the placement it just committed before notifying Gateway maintenance, adding a synchronous SQLite read to the activation path.
User Impact
No intended user-visible change. Activation notifications use the committed active placement. External plugins retain the released synchronous placement readers, now deprecated in favor of their existing async counterparts.
Why This Change Was Made
The placement owner passes its committed row through
onActivated; Gateway maintenance consumes that fact instead of callingplacements.get()and repeating the active-state check. The real execution/placement authority guards remain at their effect boundaries.Accepted edge case: maintenance may consume a committed activation after a later placement transition; the maintenance operation retains its existing effect-boundary authority checks. No generation or freshness handshake is added.
This is the placement slice of the SDK async migration. Synchronous placement
get,getMany,list, andlistForReconcileremain only for released compatibility and existing security/recovery callers, emit the SDK migration warning, and point to the async methods. The recovery constructor's initial census needs a separate lifecycle-owner change because delaying it would alter interrupted-claim classification.Evidence
Three alternating base/candidate pairs on the same isolated host, using the shared SQL harness, base
95e0638a1046051eb09cfd23e452a00c095a2bbe, and placement heade2fe26ea78bca0ee9a13da2942081c0404dc6cc7:The +0.224% warmed statement variation is below the 0.5% noise floor and comes from unchanged actor completion/shared-facts and startup work. Whole-workload median: 10,163→10,171 statements, 1,728→1,732 requests. First-turn statements: 1,260→1,266 (+0.476%), from deferred startup work. The boot + connect + first-turn combined median falls 4,243→4,237 statements (−6) with 303→303 requests; the three combined statement samples are base
[4,230, 4,243, 4,259]and candidate[4,237, 4,210, 4,257]. This applies the deferred-startup combined-window rule; no placement activation runs in these phases. Warmed duration ratio: 1.0085. The chat workload does not activate placements, so it demonstrates neutrality, not a placement saving.Per activation: one fewer SELECT, no added worker request. Placement-store lexical T1 inventory: 2→2, because released sync adapters and real effect/recovery guards remain; this PR does not claim lexical T1 elimination.
Focused remote proof passed: provisioning replay, placement store, SDK placement compatibility, recovery events, startup maintenance, and runtime API guardrails (six files, 78 seconds). The replay regression checks that the activation callback receives the persisted active placement.
The final head
533f30e7ae5e8dcd4c11ad2b453eb48ac7c7eccdmerges maincb2a3ce3dda69bd6781411bb0b13ec7b9486b08fto pick up already-landed Knip fixes. The merge had no conflicts and preserves the same seven-file placement delta (+53/−12), so the focused and SQL proof above is reused. Static checks were rerun on the final head.Codex autoreview: clean (one round). Formatting and diff checks passed. Remote check:changed, Madge, SDK surface, SDK API comparison, and inventory/dialect ratchets passed apart from inherited Knip findings. Final-head type-aware oxlint (22s), export-collision checks (30s), SDK surface (6s), and runtime API guardrails (24s) passed. Final-head Knip (98s) reports exactly the same 58 rule/file/symbol findings as main
cb2a3ce3dda69bd6781411bb0b13ec7b9486b08f: zero candidate-only and zero main-only findings. The SDK API comparison adds/removes no entrypoints. No schema, migration, updater, plugin loading, or service-lifecycle contract change; no update cell required.LOC: 7 files, +53/−12. Release-note context: plugin placement readers are deprecated in favor of worker-backed async readers; bundled activation maintenance no longer rereads its committed placement.