Repository navigation
refactor(cloud-workers): consolidate provider and environment fixtures - #160445
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: needs maintainer review before merge. Reviewed September 28, 2026, 10:07 AM ET / 14:07 UTC (Revision 2). ClawSweeper reviewWhat this changesThe branch shares cloud-worker and Crabbox test fixtures, reuses the inference error-settlement helper for environment readiness, and simplifies equivalent payload and command checks. Merge readiness✅ Ready for maintainer review Keep this PR open. Current main still duplicates worker readiness settlement, and the branch offers a coherent cleanup with no concrete introduced defect found in the reviewed diff. The earlier merged placement-fixture PR covers adjacent work, not this remaining change. Priority: P3 Review scores
Verification
How this fits togetherThe Gateway manages cloud-worker environments for session placement and inference, while the Crabbox plugin provisions and tears down cloud machines. Stored environment state and provider results feed those paths; callers receive readiness, execution, or error outcomes. flowchart LR
A[Session placement] --> B[Gateway environment service]
C[Stored environment state] --> B
B --> D{Ready and authorized?}
D -->|Yes| E[Provider and worker execution]
D -->|No| F[Error to caller]
E --> G[Inference result]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -12, Tests -345. Total -357 across 39 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep one shared owner for equivalent fixture setup and readiness error settlement while retaining distinct replay, teardown, and authority assertions. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR addresses duplicated implementation and test setup, not a reported runtime failure; current main still shows the duplicated readiness loop. Is this the best way to solve the issue? Yes. Reusing the existing settlement helper and consolidating equivalent fixtures is a narrow approach, and the reviewed tests retain distinct behavior cases. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3e0def1451b3. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
3693753 to
bd8079d
Compare
|
For traceability, the desktop |
openclaw#160445) * refactor(cloud-workers): consolidate provider and environment fixtures * test(crabbox): merge shared fixture imports * test(cloud-workers): read fixture fallback ports through Kysely
What Problem This Solves
Cloud-worker provider, environment, and Crabbox tests repeat fixture construction, while readiness duplicates inference's failure-settlement algorithm.
User Impact
No user-visible behavior change. All existing test cases and assertions remain; readiness gains a shared-error identity case. Sandbox command policy, authority checks, lifecycle ordering, and timeout policies stay unchanged.
Why This Change Was Made
Consolidate catalog, store, provisioning, replay, and provider-construction fixtures under their shared owners, and table-drive the distinct reclaim-success and terminal tool-stream cases. Keep late-bound reopened stores, fresh mocks, differing desktop inputs, and the two Crabbox teardown adapters intact.
Readiness now uses the existing inference settlement owner, preserving ordered unique error identities, the original lone error, and both aggregate messages. Production cleanup also removes redundant checks already guaranteed by the bounded JSON counter and folds repeated Crabbox exit-code conditions.
Evidence
Maintainer-requested behavior-preserving deduplication. No test cases were deleted. The Crabbox construction/enrollment extraction was retained because it shrinks the fixture layer; its distinct teardown semantics were not combined.
git diff --numstat origin/main...HEADtotals (test support includesplacement-test-fixtures.ts):Tests ran through
node scripts/run-vitest.mjs <files> --maxWorkers=4:The consumer union covers 129 test files. Blacksmith Testbox run used a verified full source tree and per-file hashes. The remote combined command initially ended on eight duplicate import declarations; those were consolidated, extension lint passed locally, and all changed suites passed again after the correction and rebase. Both task-owned Testboxes were stopped.
The local broad run hit a 90-second timeout in
server.placement-abandonment.test.ts; the same case passed on Testbox in 30.277 seconds. No timeout or assertion was weakened, and this is not claimed as a flake fix. An initial graph selector also hit the unrelated UI shard root-count budget; the canonical relevant graphs passed.Initial submission fetched and rebased onto
2da0e9a4c85b4976d0c6ac56b3dab57e88f859f6without conflicts. Both commits are patch-identical across the rebase; resolve-undo is empty.Architecture CI repair
The moved fallback-port query was no longer covered by the old test-file naming exemption. It now uses the existing
queryWorkerEnvironmentStoreKysely builder and sync executor, with the same selected columns, environment binding, and ascending position order. No guard or allowlist was changed.Rebased onto
b27c79ba156268f6ca730f3797cc6ab919046340, including the merged placement consolidation in #160439. Resolved the import conflict by retaining its dispatch identity and active-placement helper alongside the environment-store fixture. Resolve-undo is empty.On the combined head, all eight commands owned by
check:architecturepassed: import cycles, Madge, deprecated API usage, wrapper shadowing, deprecated JSDoc, Kysely schema verification, Kysely guardrails, and database-first legacy-store checks. The six store/placement files passed all 76 tests in 365.09 seconds wall time. Core production plus the Gateway server, methods, and other test graphs, changed-file lint/format, diff checks, and a fresh P2 branch review also passed.Repair commit:
bd8079d1888b4f4fa81e7a5dfa3c5cc59d07e28b.