Repository navigation
refactor(gateway): deslop server methods and worker environments third pass - #161737
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 30, 2026, 5:06 AM ET / 09:06 UTC (Revision 3). ClawSweeper reviewWhat this changesThe branch consolidates Gateway request validation and response handling, Doctor status ordering, and worker bootstrap and workspace helpers without intending to change their results. Merge readiness⛔ Blocked before merge - 3 items remain Keep open. Current main does not contain this distinct cleanup, and source review found no concrete patch defect. The required published-updater compatibility proof remains outstanding. Priority: P3 Review scores
Verification
How this fits togetherGateway RPC handlers turn client requests into diagnostics, plugin details, desktop actions, and node events. The worker-environment layer provisions workers and reconciles their workspaces, returning receipts and placement state to the Gateway. flowchart LR
A[Gateway clients] --> B[RPC handlers]
B --> C[Validation and projections]
C --> D[Client responses]
B --> E[Worker placement]
E --> F[Bootstrap and workspace sync]
F --> G[Worker receipts]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -113, Tests -4. Total -117 across 15 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the shared-owner cleanup once an existing installation can update to the candidate and still report Doctor status and provision a worker successfully. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR claims a behavior-preserving cleanup rather than a current-main defect. Is this the best way to solve the issue? Yes. The branch reuses existing validation and sorting owners and retains the observed authority checks; the update path still needs its required proof. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a1ecef6703d2. LabelsLabel changes: No label changes. Label 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 |
…d pass Reuse canonical validation, sorting, normalization and placement helpers. Consolidate duplicate RPC and workspace projections while preserving wire errors, current-owner revalidation, worker fencing and persisted state. Third-pass maintainer sweep following #159752 and #161284. No user-visible behavior or protocol change is intended. Retain existing recovery assertions.
7c69cf3 to
794b593
Compare
…d pass (openclaw#161737) Third-pass maintainer-requested Gateway cleanup following openclaw#159752 and openclaw#161284. Reuse canonical validation, stable bounded sorting and placement matching; consolidate RPC and workspace projections and remove forwarding wrappers. Preserve protocol, RPC results and errors, live-owner authority, worker lifecycle/fencing and persisted state. No user-visible behavior change is intended. Drop overlaps already landed in openclaw#160444, openclaw#161085 and openclaw#161642. Validation: independent Codex review clean at P0-P2; both import-cycle checks report zero; lint clean; 401 tests passed across 28 files and five Vitest shards, with one existing opt-in Podman skip. Rebased protocol generation has zero drift and SDK export/surface checks pass. Full source reading covered 645 production files at the starting base. Hosted CI run 36693161484 executed its build/test lanes. The sole failed test, session-activity-summaries.test.ts relocated-store recovery (expected 2 to be 3), also fails on unrelated PR openclaw#161714 head 8080a45, run 36692028664 job 109811633901. The changed RPC/workspace code is outside the failing execution path. Land under the explicitly authorized pre-existing-failure exception; retain this failure for the main-CI coordinator.
What Problem This Solves
Third-pass maintainer-requested cleanup of duplicated Gateway RPC adapters and worker-environment helpers, following #159752 and #161284.
User Impact
No intended user-visible change. Gateway protocol, RPC method names/parameters/results/errors, authorization revalidation, worker lifecycle/fencing, and persisted state remain unchanged.
Why This Change Was Made
instanceofwrapper. The recovery test retains its class, cause, and no-rollback assertions.Measured final diff: 113 net production lines removed across 14 production files, plus 4 test lines removed. All changes stay within the two assigned subtrees. The reading pass covered all 645 production files at the starting base; the size-sorted READ log for every production file over 200 lines is below.
Evidence
794b59368258338b94758cf7d5e0750e8d0e7374: full Git tree950898866ca4c8c9bf8f61f749218e0cca96786averified on a fresh remote checkout; bothcheck-madge-import-cycles.tsandcheck-import-cycles.tsreport 0; targeted core lint has 0 warnings/errors.node scripts/run-vitest.mjswith 28 focused owner/importer/boundary files: 401 passed, one existing opt-in Podman skip, across five Vitest shards in 231.00s. Includes fs-safe and extension import-boundary checks.pnpm protocol:check: passed with zero drift.pnpm plugin-sdk:check-exportsandpnpm plugin-sdk:surface:check: passed.check-lint-core-1; that check passes on the current head.checks-node-changed-compact-small-1-1:session-activity-summaries.test.ts/ "readmits a relocated store and fences a delayed result from its previous owner",expected 2 to be 3. The identical case and assertion already failed in unrelated PR test(runtime): remove low-value tests (batch d110) #161714 at head8080a45a385095e4cbc0d59b4203b0f959263369, run 36692028664 / job 109811633901. That PR changes test cleanup and CI selection, not the recap owner. This PR changes neither the recap owner, its storage/transcript dependencies, nor the failing test; the exercised directservice.ensurepath uses mocked model completion and does not call the changed RPC or workspace paths. The downstream CI gate reflects that single inherited failure. Landing uses the explicitly authorized exact-head pre-existing-failure exception; no passing hosted CI claim is made. The recap fixture remains for the main-CI coordinator to repair.pnpm test src/gateway/worker-environments/workspace-accepted-sync.test.ts --maxWorkers=1passed in 40s including cold worker compilation. No tests were added.Proof ran on direct AWS Crabbox lease
cbx_e8e46a107289; final runrun_a38b4376fbeb0b9d55c40d6e3f61ba78. The Blacksmith route did not execute tests; owned Testboxtbx_01m3rgscpq81ak794x6ds6fj4gexpired and is confirmed stopped. After a local Git-seed preparation timeout, the AWS proof used the public base plus the task patch and verified the complete candidate tree before execution. No tests or builds ran on the Mac.No product bug fix is claimed. Existing authority, recovery, cursor, and byte-order contracts were retained where reducing them would change behavior.
Third-pass coverage: all 270 production files over 200 lines
Size is the starting census at
3801005f695. The rebase onto16be7f0f270dropped four overlaps already landed on main. READ means the complete production file was inspected; retained paths have the reason below. Prior passes and subtree history since September 20 were checked before selecting changes.src/gateway/server-methods/config.tssrc/gateway/server-methods/agents.tssrc/gateway/server-methods/send.tssrc/gateway/server-methods/cron.tssrc/gateway/server-methods/doctor.tssrc/gateway/worker-environments/bootstrap.tssrc/gateway/worker-environments/node-worker-tunnel.tssrc/gateway/worker-environments/provider-lifecycle.tssrc/gateway/worker-environments/service.tssrc/gateway/server-methods/chat-abort-runtime.tssrc/gateway/server-methods/update.tssrc/gateway/server-methods/sessions-patch-engine.tssrc/gateway/worker-environments/inference.tssrc/gateway/server-methods/chat-send-admission.tssrc/gateway/server-methods/chat-send-agent-dispatch.tssrc/gateway/worker-environments/placement-dispatch-startup.tssrc/gateway/worker-environments/local-workspace-projection.tssrc/gateway/server-methods/approval-shared.tssrc/gateway/server-methods/chat-send-reply-dispatch.tssrc/gateway/server-methods/sessions-abort.tssrc/gateway/server-methods/sessions-rewind.tssrc/gateway/worker-environments/worker-turn-launcher.tssrc/gateway/worker-environments/node-workspace-transfer-service.tssrc/gateway/worker-environments/node-bootstrap-artifact.tssrc/gateway/server-methods/question.tssrc/gateway/server-methods/chat-send-handler.tssrc/gateway/server-methods/chat-metadata-runtime.tssrc/gateway/server-methods/chat-send-pre-admission.tssrc/gateway/server-methods/chat-abort-handler.tssrc/gateway/worker-environments/node-launch-adapter.tssrc/gateway/server-methods/sessions-sharing.tssrc/gateway/server-methods/sessions-suggestions.tssrc/gateway/server-methods/tools-effective.tssrc/gateway/server-methods/sessions-dispatch.tssrc/gateway/worker-environments/workspace-quiescence-scripts.tssrc/gateway/worker-environments/computer-transport.tssrc/gateway/server-methods/sessions-create.tssrc/gateway/server-methods/models-list-result.tssrc/gateway/worker-environments/worker-turn-rpc.tssrc/gateway/worker-environments/placement-dispatch-pending-results.tssrc/gateway/worker-environments/placement-store.tssrc/gateway/server-methods/nodes.invoke.tssrc/gateway/server-methods/devices.tssrc/gateway/server-methods/board.tssrc/gateway/worker-environments/workspace-sync.tssrc/gateway/server-methods/chat-transcript-persistence.tssrc/gateway/server-methods/terminal.tssrc/gateway/worker-environments/placement-turn-claims.tssrc/gateway/worker-environments/worker-session-tool-executor.tssrc/gateway/worker-environments/inference-runtime.tssrc/gateway/server-methods/system-agent.tssrc/gateway/worker-environments/placement-move-intent.tssrc/gateway/worker-environments/session-attachment-service.tssrc/gateway/server-methods/channels.tssrc/gateway/server-methods/system-changes.tssrc/gateway/worker-environments/worker-turn-execution.tssrc/gateway/worker-environments/environment-access.tssrc/gateway/worker-environments/node-worker-workspace-actions.tssrc/gateway/server-methods/projects.tssrc/gateway/server-methods/sessions-files.tssrc/gateway/server-methods/exec-approval.tssrc/gateway/worker-environments/provider-intent.tssrc/gateway/server-methods/chat-history-handler.tssrc/gateway/worker-environments/live-events.tssrc/gateway/server-methods/workspace-files.tssrc/gateway/server-methods/sessions-mutations.tssrc/gateway/worker-environments/prepared-pool.tssrc/gateway/worker-environments/placement-turn-claim-events.tssrc/gateway/worker-environments/store.tssrc/gateway/worker-environments/placement-dispatch-coordinator.tssrc/gateway/server-methods/control-ui.tssrc/gateway/server-methods/models-auth-status.tssrc/gateway/server-methods/environments.tssrc/gateway/worker-environments/workspace-result-finalize.tssrc/gateway/server-methods/chat-abort-authorization.tssrc/gateway/worker-environments/workspace-reconcile-recovery.tssrc/gateway/server-methods/skills.tssrc/gateway/server-methods/task-suggestions.tssrc/gateway/server-methods/artifacts.tssrc/gateway/worker-environments/placement-record.tssrc/gateway/worker-environments/store-projection.tssrc/gateway/server-methods/shared-types.tssrc/gateway/server-methods/session-change-event.tssrc/gateway/worker-environments/bundle.tssrc/gateway/server-methods/agents-files.tssrc/gateway/worker-environments/workspace-sync-scripts.tssrc/gateway/server-methods/push.tssrc/gateway/worker-environments/workspace-result-staging.tssrc/gateway/worker-environments/placement-dispatch.tssrc/gateway/worker-environments/workspace-accepted-remote-script.tssrc/gateway/worker-environments/placement-session-tool-operations.tssrc/gateway/server-methods/approval.tssrc/gateway/server-methods/message-operation-route.tssrc/gateway/server-methods/chat-send-session.tssrc/gateway/worker-environments/prepared-environment-store.tssrc/gateway/server-methods/chat-restart-recovery.tssrc/gateway/server-methods/chat-send-dispatch-errors.tssrc/gateway/worker-environments/placement-workspace-result.tssrc/gateway/server-methods/sessions-read.tssrc/gateway/server-methods/sessions-compact.tssrc/gateway/worker-environments/workspace-sync-helpers.tssrc/gateway/server-methods/usage.tssrc/gateway/worker-environments/workspace-actual-manifest.tssrc/gateway/worker-environments/session-repository-checkpoints.tssrc/gateway/worker-environments/placement-dispatch-failure.tssrc/gateway/worker-environments/node-workspace-retain-coordinator.tssrc/gateway/worker-environments/provider-owner-lifecycle.tssrc/gateway/server-methods/cron-caller-scope.tssrc/gateway/server-methods/chat-send-source-finalization.tssrc/gateway/server-methods/nodes.pairing.tssrc/gateway/worker-environments/node-enrollment.tssrc/gateway/server-methods/session-catalog-list.tssrc/gateway/server-methods/usage-session-selection.tssrc/gateway/server-methods/session-create-project.tssrc/gateway/worker-environments/repository-project-admission.tssrc/gateway/server-methods/system-agent-approval.tssrc/gateway/worker-environments/placement-turn-authority.tssrc/gateway/server-methods/migrations.tssrc/gateway/worker-environments/credential-broker.tssrc/gateway/worker-environments/transcript-commit.runtime.tssrc/gateway/worker-environments/placement-row-codec.tssrc/gateway/server-methods/nodes.read.tssrc/gateway/server-methods/chat-send-reply-finalization.tssrc/gateway/worker-environments/inference-control-internal.tssrc/gateway/server-methods/sessions-patch-model-selection.tssrc/gateway/worker-environments/project-preparation.tssrc/gateway/worker-environments/placement-dispatch-recovery.tssrc/gateway/worker-environments/worker-turn-admission.tssrc/gateway/worker-environments/node-desktop-carrier.tssrc/gateway/server-methods/themes.tssrc/gateway/server-methods/plugins.tssrc/gateway/server-methods/chat-send-message-injection.tssrc/gateway/server-methods/sessions-patch-archive.tssrc/gateway/worker-environments/placement-reclaim.tssrc/gateway/worker-environments/desktop-tunnel.tssrc/gateway/server-methods/chat-assistant-content.tssrc/gateway/worker-environments/provider-node-provisioning.tssrc/gateway/server-methods/sessions-delete.tssrc/gateway/server-methods/chat-reply-media.tssrc/gateway/server-methods/skills-library.tssrc/gateway/worker-environments/session-placement-lifecycle.tssrc/gateway/server-methods/channel-pairing.tssrc/gateway/worker-environments/node-worker-repository-preparation.tssrc/gateway/server-methods/session-mutation-guards.tssrc/gateway/worker-environments/worker-turn-payload.tssrc/gateway/server-methods/system.tssrc/gateway/worker-environments/placement-turn-claims-store.tssrc/gateway/worker-environments/inference-store.kernel.tssrc/gateway/server-methods/secrets.tssrc/gateway/worker-environments/workspace-manifest.tssrc/gateway/server-methods/workspace-fs.tssrc/gateway/server-methods/users.tssrc/gateway/worker-environments/store-transitions.tssrc/gateway/server-methods/sessions-lifecycle-drain.tssrc/gateway/server-methods/chat-history-page-kernel.tssrc/gateway/worker-environments/placement-move-service.tssrc/gateway/server-methods/chat-send-attachments.tssrc/gateway/server-methods/chat-history-budget.tssrc/gateway/worker-environments/workspace-manifest-worker.tssrc/gateway/worker-environments/transcript-commit-store.tssrc/gateway/worker-environments/workspace-inventory-computation.runtime.tssrc/gateway/server-methods/chat-send-request.tssrc/gateway/server-methods/chat-send-user-turn.tssrc/gateway/worker-environments/ssh.tssrc/gateway/server-methods/plugin-approval.tssrc/gateway/server-methods/session-active-runs.tssrc/gateway/server-methods/conversations.tssrc/gateway/server-methods/config-write-flow.tssrc/gateway/server-methods/usage-date-range.tssrc/gateway/server-methods/chat-history-session-read.tssrc/gateway/worker-environments/store.kernel.tssrc/gateway/worker-environments/workspace-accepted-sync.tssrc/gateway/worker-environments/node-workspace-upload-reader.tssrc/gateway/worker-environments/node-worker-bundle-installer.tssrc/gateway/server-methods/session-catalog-provider-access.tssrc/gateway/server-methods/agent-session-patch.tssrc/gateway/worker-environments/worker-turn-media.tssrc/gateway/worker-environments/workspace-mutation-lock-remote-script.tssrc/gateway/worker-environments/placement-projector.tssrc/gateway/worker-environments/workspace-reconcile-apply.tssrc/gateway/server-methods/tts.tssrc/gateway/worker-environments/workspace-sync-inventory.tssrc/gateway/server-methods/session-catalog-list-lifetime.tssrc/gateway/worker-environments/placement-workspace-journal.tssrc/gateway/server-methods/web-search-status.tssrc/gateway/worker-environments/skill-resource-transfer.tssrc/gateway/server-methods/sessions-subscriptions.tssrc/gateway/server-methods/claws-monitors.tssrc/gateway/server-methods/users-personal-file.tssrc/gateway/server-methods/plugin-host-hooks.tssrc/gateway/worker-environments/service-contract.tssrc/gateway/server-methods/nodes.wake.tssrc/gateway/server-methods/models-auth-status-usage-cache.tssrc/gateway/worker-environments/workspace-result-inventory.runtime.tssrc/gateway/worker-environments/placement-worker-gate.tssrc/gateway/server-methods/update-status.tssrc/gateway/worker-environments/store-row-codec.tssrc/gateway/server-methods/sessions-patch-expectations.tssrc/gateway/worker-environments/tunnel-contract.tssrc/gateway/server-methods/sessions-messaging.tssrc/gateway/server-methods/web-search.tssrc/gateway/server-methods/chat-send-commentary-media.tssrc/gateway/server-methods/chat-broadcast.tssrc/gateway/server-methods/sessions-github.tssrc/gateway/server-methods/chat-send-command-replies.tssrc/gateway/server-methods/agents-workspace.tssrc/gateway/server-methods/session-catalog-entry-snapshot.tssrc/gateway/worker-environments/node-workspace-transfer-http.tssrc/gateway/server-methods/update-report.tssrc/gateway/server-methods/agent-session-prepare.tssrc/gateway/server-methods/chat-user-turn-recorder.tssrc/gateway/server-methods/chat-message-get-handler.tssrc/gateway/worker-environments/project-setup-script.tssrc/gateway/server-methods/approval-visible-record.tssrc/gateway/server-methods/models-auth-status-facts.tssrc/gateway/server-methods/environments.session.tssrc/gateway/server-methods/chat-origin-routing.tssrc/gateway/worker-environments/session-attachment-store.tssrc/gateway/server-methods/approval-record-lookup.tssrc/gateway/server-methods/tools-catalog.tssrc/gateway/server-methods/exec-approvals.tssrc/gateway/server-methods/chat-history-pages.tssrc/gateway/worker-environments/artifact-transfer-http.tssrc/gateway/worker-environments/portal-node-carrier.tssrc/gateway/worker-environments/workspace-reconcile-preflight.tssrc/gateway/server-methods/github-personal-authorization.tssrc/gateway/worker-environments/workspace-hash-memo.tssrc/gateway/worker-environments/worker-turn-attachments.tssrc/gateway/server-methods/session-catalog-visibility.tssrc/gateway/server-methods/agent-session-reset.tssrc/gateway/worker-environments/service-validation.tssrc/gateway/worker-environments/workspace-reconcile-fs.tssrc/gateway/server-methods/approval-request-authority.tssrc/gateway/server-methods/wizard.tssrc/gateway/server-methods/commands-list-result.tssrc/gateway/server-methods/chat-transcript-inject.tssrc/gateway/worker-environments/artifact-transfer-service.tssrc/gateway/server-methods/chat-webchat-media.tssrc/gateway/worker-environments/computer-service.tssrc/gateway/server-methods/audit.tssrc/gateway/server-methods/cron-runs.tssrc/gateway/server-methods/agent-reset-phase.tssrc/gateway/server-methods/web.tssrc/gateway/server-methods/chat-history-delta.tssrc/gateway/server-methods/system-agent-setup-wizard.tssrc/gateway/server-methods/sessions-groups.tssrc/gateway/server-methods/update-admission.tssrc/gateway/server-methods/cron-history.tssrc/gateway/worker-environments/node-worker-workspace-fallback.tssrc/gateway/server-methods/health.tssrc/gateway/worker-environments/local-workspace-archive.tssrc/gateway/server-methods/device-scope-upgrade.tssrc/gateway/server-methods/session-catalog-list-operations.tssrc/gateway/server-methods/session-catalog.tssrc/gateway/server-methods/chat-send-work-admission.tssrc/gateway/worker-environments/placement-disk-space.tssrc/gateway/server-methods/nodes.pending-work.tssrc/gateway/worker-environments/store-validation.tssrc/gateway/server-methods/core-handlers.tssrc/gateway/server-methods/tools-github.tssrc/gateway/server-methods/chat-send-turn-adoption.tssrc/gateway/server-methods/chat-metadata-session-projection.tssrc/gateway/worker-environments/workspace-reconcile-core.tssrc/gateway/worker-environments/workspace-git-base.tssrc/gateway/server-methods/cron-input-validation.tssrc/gateway/server-methods/agents-config-mutations.tssrc/gateway/worker-environments/tunnel.tssrc/gateway/worker-environments/store-mutations.tssrc/gateway/worker-environments/provider-machine-catalog.tssrc/gateway/server-methods/portals.ts