Repository navigation
refactor(gateway): deslop gateway - #164022
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
|
|
Codex review: blocked before merge. Reviewed October 3, 2026, 12:30 AM ET / 04:30 UTC (Revision 2). ClawSweeper reviewWhat this changesSimplifies Gateway authentication, request, session, and lifecycle code, preserves primary-email avatar precedence during upstream errors, and removes the June Control UI bootstrap alias. Merge readiness⛔ Blocked before merge - 8 items remain Keep open: this useful, maintainer-owned cleanup has repairable validation defects and is not established as superseded. Priority: P3 Review scores
Verification
How this fits togetherThe Gateway receives requests from browser clients, CLI clients, plugins, and workers. It authenticates callers, coordinates session and approval owners, and returns responses and lifecycle events. flowchart LR
A[Browser and CLI clients] --> C[Gateway request handling]
B[Plugins and workers] --> C
C --> D[Authentication and live authority]
D --> E[Session and approval owners]
E --> F[Storage and transport operations]
F --> G[Responses and lifecycle events]
Before merge
Findings
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the owner-based simplifications with canonical types, behavior-aware security scanning, and verified preservation of session recovery and ordering contracts. Do we have a high-confidence way to reproduce the issue? Yes for the type and scanner defects: the pinned source and verified merge result establish their triggers. Runtime failures are recorded, but this read-only review did not reproduce or attribute them. Is this the best way to solve the issue? Yes in direction: reusing existing owners reduces competing implementations. The proposed cutover still needs the concrete type and validation-contract repairs identified below. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f98f41c9d0d2. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What 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
HistoryReview history (1 earlier review cycle)
|
d2c5f48 to
6dc7513
Compare
* refactor(gateway): deslop gateway root flows * fix(gateway): preserve avatar fallback precedence and await fixture readiness * refactor(gateway): keep projection and test owners within line budgets * refactor(gateway): align simplified calls with concrete contracts * fix(gateway): repair cleanup types and test fixtures
What Problem This Solves
Gateway root modules carry unused options, single-caller forwarding layers, duplicate projections, and manually implemented flows that already have canonical owners.
User Impact
Gateway configuration, persisted data, authorization, and protocol payloads remain unchanged. The avatar proxy now preserves primary-email precedence on an upstream error instead of querying another linked email. The pre-July compatibility route
/__openclaw/control-ui-config.json, used by v2026.6.1 clients, is removed under the July 2026-and-newer migration policy; current bootstrap routes remain supported.Why This Change Was Made
This is one Gateway-root cleanup batch, with 1,080 net production lines removed. It keeps lifecycle, authority, ordering, and lazy-loading boundaries while removing machinery around them:
The sweep retained non-enumerable lifecycle metadata projection, MCP schema comparison that ignores symbol metadata, voice-transcript receipt ordering, and existing database/schema compatibility where removal would change a current contract. Tests that only supplied the deleted private knobs were adjusted or removed; behavioral assertions remain.
Fixes Found Along the Way
The Gravatar loop treated a failed primary-email lookup like a definite miss and queried another linked email, contradicting the original primary-first disclosure contract. It now stops on an upstream error and returns the existing temporary-error response. A table-driven extension of the existing endpoint test retains 404 fallback coverage and adds 503 coverage; before the fix, the new case observed two upstream fetches instead of one.
The publication singleflight test now waits for repository entry explicitly and always releases and joins both requests. Avatar worker fixtures await catalog preparation and register cleanup. The config watcher fixture awaits initialization before starting its existing watcher-ready deadline. Assertions and timeout values remain unchanged.
Evidence
Codex review completed; accepted findings were corrected. The small fixture and line-budget follow-ups also received clean independent reviews.
Broad focused run before the final rebase: 106 files / 2,825 tests, with 2,820 passing and five failures. The initial explicit-gate singleflight repair passed 20 executions; its final simplified wait also passed in the full publication suite. The remaining failures were time budgets in session category reconciliation, authenticated assistant-media metadata, recovery delivery, and watcher startup; the watcher setup ordering was repaired, but its 20-run probe still hit a separate settings-write deadline once. These are not claimed as proven inherited CI failures.
Gravatar 503 regression failed before the production fix (two upstream fetches instead of one). Both 404/503 cases passed 20 executions with unique uncached fixture emails; command wall time 324.04s. Four real-worker avatar cases passed 20 executions each after catalog preparation.
Both import-cycle checks reported zero on the rebased import graph: madge 148.53s and runtime-value check 101.17s. Subsequent compiler corrections changed no imports.
Changed-file validation caught and resolved two line-cap violations, then stopped at the stale node-host max-lines baseline. Rebased onto main including its existing baseline fix; no duplicate baseline fix added.
Remote validation was unavailable after three Blacksmith attempts and a sanitized AWS allocation attempt. No remote tests completed. These results use the authorized low-priority local fallback, one heavy command at a time. Linux repeated-run proof was not available; the first hosted CI results are recorded below.
Final rebased candidate: 253/254 tests passed across 11 files, with only the same 8,193-row category-reconciliation case exceeding its unchanged 120-second budget (126.27s). All prior media, recovery-delivery, watcher-startup, and publication-singleflight failures passed. The full avatar suite, cold-archive search, projection status patches, observer completion, shutdown, and post-attach startup suites also passed. Command wall time: 1,004.98s. This is a partial local result, not an all-green claim.
Core typechecking passed after correcting item-schema narrowing, dropping an unused private readOnly field, and supplying the required session identity in the placement fixture (41.48s). Fresh review of those corrections is clean through P2; all 121 affected tests across eight files passed (308.94s wrapper wall time). The first hosted run completed with failures; the blockers are listed below.
Targeted lint passed for all changed Gateway files. The final local-variable cleanup in cron notifications passed all 32 owner tests (135.11s wrapper wall time). No test assertion or timeout was weakened.
CI Corrections
The original run on
d2c5f4890cadcf41c6cbe7c616957352f3f3c12ffailed. No failure is waived as inherited. The branch was rebased onto main through84268dbd8658245ac56ba99df0254cd46abec358; the reviewed corrective head is6dc75130a6289a74c3c8512398a6f42f6b05c7fd. Hosted CI passed and this PR was squash-merged as92dc2b187cb708653a5daa6a7dfe400e42f8d600.TranscriptReadWindowSessionEntry.updatedAtupdatedAt; the provision fixture also supplies the concrete worktreebranchandrepoRoot. Core production, core-test shards, and all four root test-type partitions pass on the correction candidate; the merged production graph is rechecked after rebase.RateLimitCheckResult,ChatRunRegistrypnpm deadcode:dependenciescompleted successfully (both production and all-exports passes).ee4020c7039; the conflict was only the local variable name.4ec1118e7cctargets the apply phase instead of counting verification calls. Both cases and the complete 31-test lifecycle file pass after rebase.9e34368e594from #164025 stops matching words inside watchdog inline source. Local replay then exposed whole-hostpsoutput overflowing its buffer: the fixture now enumerates only PPID/PID and reads exact child argv through the existing owner, failing explicitly for unreadable live children. Complete local replay still reached its unchanged 360-second deadline; the complete hosted exact-head E2E passed in 99.767s. No inherited waiver was used.agents.entriesand explicitmodelPolicyrepaired both cases: replacement turn passed in 49.34s and shutdown in 25.34s. Final rebase incorporates the byte-identical main fixaa7e16bbca8from #163906. Hosted cases passed in 9.451s and 8.281s.Independent Codex review of the final correction patch is clean through P2. All 126 corrected-owner tests across five files pass (679.87s wrapper wall time with
--maxWorkers=1); the 31-test deletion lifecycle file also passes. Both rotation E2Es pass in the serialized replay. That combined two-file command took 563.47s because the carrier reached its unchanged 360-second deadline; this is not an all-green local E2E claim.Core production, core-test and four root test-type partitions; full dependency/dead-export scans; changed lint/format; line, assertion, SQLite-worker and timeout-race ratchets; config docs, plugin boundaries, schema, database-store, media, sidecar, webhook and pairing-scope guards passed. The final rebased production typecheck passes. Both cycle gates report zero on corrective head
6dc75130a6289a74c3c8512398a6f42f6b05c7fd: Madge 104.78s and runtime-value 46.24s.The native typed smoke build passed with verified build/runtime stamps and all 151 public SDK subpaths. An earlier build compiled successfully but rejected its final stamp after a baseline edit during preparation; it was rebuilt through the native owner with frozen inputs. A subsequent E2E attempt contended with simultaneous type/lint artifact owners and hit setup deadlines; those checks were completed before the serialized replay. No deadline, buffer cap, assertion, retry, or skip was relaxed. The carrier observation was narrowed at its producer instead of enlarging its output buffer.
New remote attempts ran no tests: Testbox admission timed out, AWS provisioning failed, and Hetzner refused allocation at its account capacity. Newly allocated leases were stopped/released. No remote success is claimed.
The final conflict repair retains canonical main's MCP fixture.
git range-diffshows all four original implementation commits unchanged and only the already-landed MCP/rotation fixture changes dropping from the corrective commit. Remaining corrective code is unchanged from the clean review. Hosted exact-head CI passed before squash merge; no inherited-failure exception was used.Exact-head CI run completed successfully for
6dc75130a6289a74c3c8512398a6f42f6b05c7fd, with no failed or pending jobs. Opengrep OSS also passed. Pinned squash auto-merge landed92dc2b187cb708653a5daa6a7dfe400e42f8d600; its ancestry onorigin/mainand its exact merged tree were independently verified.