Repository navigation
feat(workers): maintain bounded ready capacity for prepared projects - #143372
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: blocked before merge. Reviewed September 9, 2026, 10:29 PM ET / September 10, 2026, 02:29 UTC (Revision 4). ClawSweeper reviewWhat this changesAdds a bounded pool of prepared cloud workers that later local-project sessions can consume once, with background refill, demand-based expiry, configurable limits, and warm-image state migration. Merge readiness⛔ Blocked before merge - 5 items remain This remains distinct, useful work beyond the merged preparation foundation. No discrete blocking code defect was established; package and migration qualification have progressed, while the explicitly stated native qualification hold remains. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway places sessions on cloud workers provisioned by provider plugins such as Crabbox. This pool uses successful project activity to prepare spare workers, then supplies them to matching session dispatches or cleans them up when demand expires. flowchart TD
A[Successful project session] --> B[Demand and capacity limits]
B --> C[Prepare spare cloud worker]
C --> D[Ready worker inventory]
E[Matching session dispatch] --> D
D --> F[Atomic one-use assignment]
F --> B
D --> G[Expiry or disabled capacity]
G --> H[Confirmed provider deletion]
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one canonical reserve lifecycle with atomic consumption, bounded cleanup custody, and verified upgrade behavior for both omitted settings and explicit zero limits. Do we have a high-confidence way to reproduce the issue? Not applicable as a defect reproduction: this adds ready capacity beyond existing image reuse. Its native pool behavior remains explicitly unqualified in the supplied evidence. Is this the best way to solve the issue? Yes in architecture: extending the existing environment, placement, and provider owners avoids a competing pool store. Operational acceptance still depends on the stated native and upgrade qualification. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f5c406ffbade. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
Maintain bounded ready capacity after successful project activation, consume each worker once with its placement, and retain fixed demand-based expiry and cleanup ownership. Preserve foreground image refresh and migrate warm-image state through Doctor.
0118780 to
a3a6f83
Compare
Move shared record contracts to a leaf without changing runtime behavior. Seed attached-environment ownership in repository-editor and session-create race fixtures so their existing assertions exercise the unchanged atomic activation guard.
|
Merged via squash.
|
…penclaw#143372) * feat(workers): keep prepared workers ready for later sessions Maintain bounded ready capacity after successful project activation, consume each worker once with its placement, and retain fixed demand-based expiry and cleanup ownership. Preserve foreground image refresh and migrate warm-image state through Doctor. * fix(workers): break prepared store type cycles Move shared record contracts to a leaf without changing runtime behavior. Seed attached-environment ownership in repository-editor and session-create race fixtures so their existing assertions exercise the unchanged atomic activation guard.
Share completion projection and settlement, reuse existing command gates and session-source preparation, and remove duplicate response/receipt mirrors. Keep private-source authority, approvals, FIFO, transcript durability, bounded retry behavior, and write-capable shutdown settlement at their existing owners. Best-effort tradeoffs accepted: - Idle source/config changes may retain unused capacity until expiry; allocation and private-source transfer still authorize use (#143372, #143410). - Mid-read model configuration and native availability may keep prepared display facts for that read; catalog/account authority remains (#169253). - Cosmetic health topology and clock rollback use normal refresh or an explicit probe; live lifecycle mismatch checks remain (#128222, #128503). - Bootstrap enrollment overlapping shutdown/reload may fail and retry rather than reject every post-await close interleaving (#133037). - Late internal completion reducers are not persisted; completion stays idempotent and final-intent receipt validation remains (#168592). - An in-flight plugin UI catalog may finish against its selected registry; HTTP asset disclosure still checks current authority (#134943, #169449). These removed guards have speculative/synthetic provenance, not cited human actual-use incidents. Keep the human-reported memory-flush retry bound (#85645). The Phase E standalone session memory backend and its tests are untouched.
* refactor(gateway): consolidate reply and worker preparation paths Share completion projection and settlement, reuse existing command gates and session-source preparation, and remove duplicate response/receipt mirrors. Keep private-source authority, approvals, FIFO, transcript durability, bounded retry behavior, and write-capable shutdown settlement at their existing owners. Best-effort tradeoffs accepted: - Idle source/config changes may retain unused capacity until expiry; allocation and private-source transfer still authorize use (#143372, #143410). - Mid-read model configuration and native availability may keep prepared display facts for that read; catalog/account authority remains (#169253). - Cosmetic health topology and clock rollback use normal refresh or an explicit probe; live lifecycle mismatch checks remain (#128222, #128503). - Bootstrap enrollment overlapping shutdown/reload may fail and retry rather than reject every post-await close interleaving (#133037). - Late internal completion reducers are not persisted; completion stays idempotent and final-intent receipt validation remains (#168592). - An in-flight plugin UI catalog may finish against its selected registry; HTTP asset disclosure still checks current authority (#134943, #169449). These removed guards have speculative/synthetic provenance, not cited human actual-use incidents. Keep the human-reported memory-flush retry bound (#85645). The Phase E standalone session memory backend and its tests are untouched. * refactor(gateway): consolidate dispatch and trusted result projections * refactor(workers): trust admitted preparation facts
…2342) * refactor(gateway): consolidate reply and worker preparation paths Share completion projection and settlement, reuse existing command gates and session-source preparation, and remove duplicate response/receipt mirrors. Keep private-source authority, approvals, FIFO, transcript durability, bounded retry behavior, and write-capable shutdown settlement at their existing owners. Best-effort tradeoffs accepted: - Idle source/config changes may retain unused capacity until expiry; allocation and private-source transfer still authorize use (openclaw#143372, openclaw#143410). - Mid-read model configuration and native availability may keep prepared display facts for that read; catalog/account authority remains (openclaw#169253). - Cosmetic health topology and clock rollback use normal refresh or an explicit probe; live lifecycle mismatch checks remain (openclaw#128222, openclaw#128503). - Bootstrap enrollment overlapping shutdown/reload may fail and retry rather than reject every post-await close interleaving (openclaw#133037). - Late internal completion reducers are not persisted; completion stays idempotent and final-intent receipt validation remains (openclaw#168592). - An in-flight plugin UI catalog may finish against its selected registry; HTTP asset disclosure still checks current authority (openclaw#134943, openclaw#169449). These removed guards have speculative/synthetic provenance, not cited human actual-use incidents. Keep the human-reported memory-flush retry bound (openclaw#85645). The Phase E standalone session memory backend and its tests are untouched. * refactor(gateway): consolidate dispatch and trusted result projections * refactor(workers): trust admitted preparation facts
Related: #134931. Builds on #143227; public-repository admission remains separate in #143410.
What Problem This Solves
Prepared images save setup work, but each new cloud session still waits for a machine to start and enroll. This change keeps bounded ready capacity for the next session on the same eligible local project and profile.
Why This Change Was Made
Successful session activation creates demand for a spare worker. Assigning that worker and its placement happens atomically, each enrolled node can be consumed once, and refill stays within the capacity limit and demand's original idle window. Expiry, restart and failed cleanup retain ownership until provider deletion is confirmed.
Allocation, consumption, demand and cleanup stay together because they jointly define usable capacity. The completed-workspace foundation has already landed, so this PR contains only the pool change and its integration fixes. It uses schema 17 fields from that foundation. Doctor migrates the Crabbox warm-image envelope from v2 to v3 while preserving allocations, captures and retirement obligations.
User Impact
A matching session can use an already prepared worker while its replacement starts in the background. The default is one spare per eligible local project/profile, capped at four across the Gateway. Ready workers incur running-machine charges; preparing workers and unconfirmed cleanup count against the cap. Setting either applicable limit to zero drains unused capacity while preserving active sessions and ordinary image reuse.
Reserves require an eligible dedicated Linux profile. Failed dispatch does not renew demand, and refill or Gateway restart does not extend expiry. A miss retains ordinary provisioning and image refresh. Repository-only admission is a separate PR.
Evidence
Reviewed head:
691a2aa4b21c018e680587f8629302256330a06b.a3a6f832for migration code unchanged by the final correction. Synthetic capture and retirement records retained their ownership facts; schema remained 17.The native proof uses synthetic model responses with real installed Gateway/worker processes and AWS operations. Timings are host-observed and include transport. Concurrent contention, omitted-limit saturation to four, and a live zero-toggle were outside this native campaign; focused tests cover the relevant ownership and policy branches. Machine0 and Daytona remain unqualified because current working access is unavailable.