Skip to content

refactor(cloud-workers): consolidate provider and environment fixtures - #160445

Merged
steipete merged 3 commits into
mainfrom
codex/dedup-x3-provider
Sep 28, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/dedup-x3-provider

Conversation

@steipete

@steipete steipete commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

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...HEAD totals (test support includes placement-test-fixtures.ts):

Scope Added Deleted Net
Production 25 37 -12
Tests and fixtures 660 1005 -345
Total 685 1042 -357

Tests ran through node scripts/run-vitest.mjs <files> --maxWorkers=4:

Proof Result Measured wall time
27 changed test files, Blacksmith Testbox 727 tests passed 159.08 s
100 direct fixture consumers and inference siblings, three batches 1,438 tests passed 836.07 s
After rebase: 27 changed files plus two dynamic-import consumers 29 files, 737 tests passed 288.85 s
Core production, three Gateway test graphs, extension production and test types Passed before and after rebase —
Changed-file core and extension lint, formatting, diff check Passed —
Codex P2 branch review and import-correction review No accepted/actionable findings —

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 2da0e9a4c85b4976d0c6ac56b3dab57e88f859f6 without 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 queryWorkerEnvironmentStore Kysely 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:architecture passed: 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.

@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 28, 2026, 10:07 AM ET / 14:07 UTC (Revision 2).

ClawSweeper review

What this changes

The 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
Reviewed head: bd8079d1888b4f4fa81e7a5dfa3c5cc59d07e28b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is coherent, reduces duplication, and has reported focused validation; this review found no concrete correctness or security blocker.
Proof confidence 🌊 off-meta tidepool Not applicable: Repository State identifies this as a member-authored internal refactor. The changed production owners are Gateway readiness, bounded inference payload checks, and Crabbox command errors; reported focused test runs support equivalence, but no external-contributor real-setup gate applies. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository State identifies this as a member-authored internal refactor. The changed production owners are Gateway readiness, bounded inference payload checks, and Crabbox command errors; reported focused test runs support equivalence, but no external-contributor real-setup gate applies. No stored-data contract changes.
Evidence reviewed 9 items Introduced readiness change: The branch delegates readiness settlement to the existing inference helper while retaining the readiness-specific aggregate error message.
Settlement semantics: The helper waits for all operations, preserves rejection order and identity, throws a lone original error, and uses the supplied message for multiple distinct errors.
Bounded payload contract: The JSON byte counter reports incomplete traversal when input exceeds its limit, supporting removal of the redundant byte comparison.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -12, Tests -345. Total -357 across 39 files.

View PR surface stats
Area Files Added Removed Net
Source 5 25 37 -12
Tests 34 660 1005 -345
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 39 685 1042 -357

Review metrics

None.

Technical review

Best 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.

Labels

Label changes:

  • add P3: This is an internal, behavior-preserving maintenance refactor with no demonstrated user-facing regression.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository State identifies this as a member-authored internal refactor. The changed production owners are Gateway readiness, bounded inference payload checks, and Crabbox command errors; reported focused test runs support equivalence, but no external-contributor real-setup gate applies. No stored-data contract changes.

Label justifications:

  • P3: This is an internal, behavior-preserving maintenance refactor with no demonstrated user-facing regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository State identifies this as a member-authored internal refactor. The changed production owners are Gateway readiness, bounded inference payload checks, and Crabbox command errors; reported focused test runs support equivalence, but no external-contributor real-setup gate applies. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-28T12:30:19.762Z sha 3693753fc44842841676d7600cf013f5dd7ab673 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/dedup-x3-provider branch from 3693753 to bd8079d Compare September 28, 2026 13:51
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 28, 2026
@steipete
steipete merged commit 026348d into main Sep 28, 2026
252 of 257 checks passed
@steipete
steipete deleted the codex/dedup-x3-provider branch September 28, 2026 14:37
@VACInc

VACInc commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

For traceability, the desktop chat-motion.e2e.test.ts case failed with expected 2 to be greater than 2 in this PR's historical CI job: https://github.com/openclaw/openclaw/actions/runs/36421667092/job/108926300654. Merged PR #160506 subsequently fixed that specific test flake on main by checking smooth-scroll intent and final position instead of sampled-frame count. This is a test-only follow-up; it does not replace this PR's cloud-worker changes or imply that any other CI failures were fixed.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: crabbox gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants