Repository navigation
refactor(gateway): deslop gateway - #158228
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 25, 2026, 4:19 PM ET / 20:19 UTC (Revision 7). ClawSweeper reviewWhat this changesThe branch consolidates Gateway authentication, session, chat, HTTP, worker, and Control UI handling while fixing pre-aborted worker rejection handling and malformed Claude history rows. Merge readiness⛔ Blocked before merge - 3 items remain Keep this PR open under the maintainer’s review-only request. Current main lacks the two focused fixes, exact-head CI passed, and the inspected authority and delivery paths show no concrete introduced defect. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway receives client requests and agent events, checks authority, and routes work to session, chat, plugin, and worker owners. Those owners return responses and events or interact with storage and external services. flowchart LR
A[Clients and agents] --> B[Gateway requests]
B --> C[Auth and authority checks]
C --> D[Session, chat, and worker handlers]
D --> E[Storage and external services]
E --> F[Responses and events]
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Preserve the existing Gateway wire, authority, and storage contracts while retaining the two focused regression fixes; leave landing to ordinary maintainer review. Do we have a high-confidence way to reproduce the issue? Yes at source level for the two incidental defects: current main leaves a pre-aborted operation unobserved and accepts a JSONL null root as a row. This read-only review did not execute either path. Is this the best way to solve the issue? Yes for the inspected paths: the branch reuses existing Gateway owners and preserves the checked authority boundaries. The breadth still warrants ordinary maintainer review. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 37b7e7813469. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
0dd9f7e to
a0f2eb2
Compare
610240d to
c350cde
Compare
Consolidate Gateway request, projection, auth, transport, and lifecycle plumbing through existing owners while preserving wire and authority contracts. Observe source-promise rejection for pre-aborted worker operations and skip malformed Claude JSONL roots without losing surrounding valid history.
c350cde to
9abc9a4
Compare
|
@clawsweeper re-review Final evidence is now recorded in the PR body for head Compatibility assessment from the complete Git diff: changed paths are confined to This request is review-only. Keep the PR open and unmerged. |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
* refactor(gateway): deslop gateway Consolidate Gateway request, projection, auth, transport, and lifecycle plumbing through existing owners while preserving wire and authority contracts. Observe source-promise rejection for pre-aborted worker operations and skip malformed Claude JSONL roots without losing surrounding valid history. * refactor(gateway): keep history projection cap private * refactor(gateway): own wake attempt types in state store * refactor(gateway): retain named trusted proxy origin guard * refactor(gateway): satisfy lint contracts in deslop paths
What Problem This Solves
Gateway request and lifecycle code repeats small parsing, projection, forwarding, and cleanup flows even after the earlier subsystem passes.
User Impact
This refactor preserves RPC names, params/results, protocol version, persisted schemas, and auth/pairing/approval decisions. Existing live-authority checks remain at their original boundaries. Two malformed-input/cancellation defects found during the sweep are fixed below. Existing config defaults, durable-secret inference, stored-state formats, retention, and update inputs are unchanged; no migration is required.
Why This Change Was Made
The changes remove 2,169 net production lines by routing equivalent flows through existing owners and removing redundant intermediate representations. The assertion ratchet is reduced by exactly 30 removed assertions across 14 files. The earlier validation-options and allow-once/allow-always consolidations remain intact.
Simplifications and rationale
Fixes found along the way
nullrows could throw in Claude fallback-history and activity readers. The canonical row decoder now rejects non-object roots so existing malformed-row handling skips them and retains valid surrounding turns.Evidence
All required checks are green on
9abc9a4e1cdccc1b38f478332c20b76b456ee83c: CI completed with 149 successful jobs and 17 workflow skips. OpenGrep, both CodeQL workflows, and security review also passed. Independent P2 review covered the full sweep and every corrective patch; no actionable findings remain.Blacksmith Testbox proof of the sealed
610240d9e59c5836789d7bd637b334e6a8a2a991candidate passednode scripts/check-changed.mjs(1,768 seconds, all 25 test-type graphs plus production types, lint, selected tests, and guards),pnpm build(654 seconds),pnpm protocol:checkwith zero generated drift,pnpm plugin-sdk:check-exports, andpnpm plugin-sdk:surface:check. The exact lint stripe passed; OpenGrep reported zero findings using the unchanged repository rulepack and exclusions. Its report retained 10 parser/internal partial-analysis notices.Subsequent rebases preserved the reviewed patch and current main's authority boundaries. Exact-head CI logs confirm 478 passing cases across all ten identified rebase-contract files: auth/redaction, network attribution, HTTP probes and MCP admission, startup auth, configured-owner authority, compaction, and Team Reports scheduling. The latest rebase was entirely patch-identical. The unrelated scheduler import failure was repaired by the owning main commit
7c4866c73b31; current-head CI passed all 36 scheduler cases.Negative controls reproduced both fixed defects on the original code. The earlier broad batch passed 7,156 cases and exposed four agent-deletion failures introduced by a null/truthiness simplification; restoring the original predicate fixed all four without changing assertions. Follow-up batches passed 965 cases across 38 files (one existing skip), 275 across 17 files, and 285 across 12 files. These batches overlap and are not an additive test count. CI also identified a stale export, a type-only cycle, and lint/security-boundary requirements; all were repaired without suppressions or weakened checks. No protocol/schema/config compatibility exception was added.
Changed-test costs on Linux Testbox
Measured with
pnpm test <file> --maxWorkers=1; wall seconds include runner and worker preparation. The twelve files retain 323 test cases in total. The CI column sums logged test-case durations on the exact green head and excludes shared worker/build setup; the Testbox column is full command wall time.worker-environments/node-worker-abort.test.tsnode-wake-state.test.tscli-session-history.claude-input.test.tscli-session-history.test.tscontrol-ui-routing.test.tsserver-http.node-workspace-transfer.test.tsworker-environments/node-enrollment.test.tsworker-environments/node-worker-bundle-installer.test.tsworker-environments/node-worker-bundle-transfer-service.test.tsworker-environments/node-worker-bundle-transfer.test.tsworker-environments/store-endpoints.test.tsworker-environments/worker-bootstrap-artifact-transfer.test.tsThe existing integration files above 30 seconds verify artifact transport and node-enrollment lifecycle contracts. Worker-bundle preparation dominates the transfer files; the enrollment file retains its existing lifecycle cases. The added malformed-row cases execute in milliseconds, and this change adds no per-case sleeps, retries, or Gateway boots.
Remote proof leases and cleanup
Provider:
blacksmith-testbox, throughscripts/crabbox-wrapper.mjs. Completed proof batches verified their source snapshots and used frozen dependencies; only one execution command ran per lease. All leases are stopped. Hosting workflow cancellation during lease cleanup is distinct from the command exit recorded below.tbx_01m3ce3d02kpsy3a98e64phbcqtbx_01m3cm3f9x53nejezm9k1a26h6pnpm buildpassed in 512s. Broadrun-vitestfound the four corrected agent-deletion failures. Later prepared follow-up was cancelled before execution for rebase.tbx_01m3csk3zfrrk0kkt00kxcxqqatbx_01m3cwf1qx9ev71f1zbye7j97jpnpm deadcode:fullpassed (141s);pnpm check:architecturepassed (215s, zero cycles); wake-state and 17-file integration tests passed. The changed-code run was superseded by the lint corrections.tbx_01m3cy3qaakv0n0ge885897ftscheck-changed, protocol, SDK checks, and build. Wrapper exit 0.