Repository navigation
refactor(agents-gateway): deslop agents and gateway - #165907
Conversation
Derive internal contracts from their schema, factory, and runtime owners; simplify proven internal states and local forwarding layers while preserving public output and lifecycle boundaries.
|
🦞👀 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 October 5, 2026, 10:06 PM ET / October 6, 2026, 02:06 UTC. ClawSweeper reviewWhat this changesThe branch replaces duplicate agent and Gateway type declarations with their existing owners and simplifies internal guards, forwarding helpers, and stream-result capture. Merge readiness⛔ Blocked before merge - 2 items remain Keep open: this remains useful, distinct cleanup, and the recorded member/admin authority excludes automatic closure. Source review found no concrete blocking defect. Priority: P3 Review scores
Verification
How this fits togetherThe Gateway validates client requests and supplies agent runs with session, credential, and execution context. Agent runtime code then calls providers and settles messages, usage, and transcript work for downstream responses. flowchart LR
A[Client requests] --> B[Gateway validation]
B --> C[Agent run preparation]
D[Schema and runtime contracts] --> C
C --> E[Provider transport]
E --> F[Stream settlement]
F --> G[Session state and replies]
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep schema and runtime producers authoritative while preserving existing wire shapes, persisted formats, and lifecycle validation. Do we have a high-confidence way to reproduce the issue? Not applicable: this proposes behavior-preserving cleanup rather than a reported bug; no failing runtime path was established during this read-only review. Is this the best way to solve the issue? Yes: deriving duplicate contracts from existing producers follows repository ownership guidance, and the inspected runtime simplifications preserve upstream validation and settlement boundaries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0c7a83dd65c6. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Landing the reviewed head
All selected type, lint, dependency, baseline, architecture, and other runtime-test jobs passed. Independent review and the remote validation described in the PR remain valid. These inherited failures belong to the main CI coordinator; this is not a claim of green hosted CI. |
Derive agent and Gateway contracts from their schema, parser, factory, and runtime owners; simplify proven internal states and small forwarding layers. Retain named SDK declaration boundaries and all wire, persisted-data, plugin-input, and live-authority validation. Removes 1,042 net production lines. Remote production/test type checks, focused runtime tests, lint, unused-export scans, assertion safety, both zero-cycle gates, SDK API comparison, and independent review support the change. Public SDK exports do not grow. Closes openclaw#165907. Hosted CI: all selected type/lint/dependency/baseline/architecture and other test jobs passed. Landed under the inherited-failure exception for the source-map-js advisory and the independently reproduced sessions activity fixture failure introduced by main commit 8f677ff; see PR evidence.
What Problem This Solves
Agent and Gateway code maintains duplicate declarations for contracts already owned by schemas, parsers, factories, and runtime types. Internal callers also repeat checks for states their producers exclude.
User Impact
No intended user-visible behavior change. Configuration keys, protocol and persisted-data shapes, CLI output, model-facing tool descriptions, and UI behavior are preserved. Wire, plugin, persisted-data, and live-authority validation stays in place.
Why This Change Was Made
This batch removes 1,042 net production lines (+595/−1,637) across agents and Gateway code. No code moves outside the monorepo; tests, fixtures, documentation, generated files, and ratchets are excluded from that measurement.
Simplifications and ownership
this: voiddeclarations.The runtime-plan leaf contract and named SDK service interfaces retain their independent declarations. Catalog-specific context-window metadata and canonical tool/audio type references remain explicit where their owners differ from the wider schema.
Evidence
Candidate:
376675539fbbc9154c18b594c94f5ede1e04a9c4, based on381b1e05d7f0fa572fdf085e7714d4f90864d4b5.pnpm tsgo:prod, the six-file integration/correction selection (133 tests), type-aware native core lint (103 files, zero warnings/errors), the assertion ratchet, and all production/script/full-tree unused-export scans (zero entries).check-madge-import-cycles.tsandcheck-import-cycles.tsreported zero cycles on that tree.f4908eee.as constbranch and successful typechecking.Validation caught an incomplete catalog-type substitution and a poll-timer substitution incompatible with the existing controlled-clock test; both were removed. Named auth-limiter and service interfaces were retained for declaration-generation boundaries. No assertions, timeouts, retries, or skips were weakened. The final rebase preserves the new auth-worker code and drops three overlapping comment-only edits. Hosted CI will validate the published head.
Hosted CI attribution
Exact-head CI: https://github.com/openclaw/openclaw/actions/runs/37402143477 (candidate
376675539fbbc9154c18b594c94f5ede1e04a9c4; tested mergea07f68217e16aeabf1f704d3e0d1b3f50b3533c0onto0c7a83dd65c676b1c224458d06ce4bdb69ea51ac).security-fastfails production dependency auditing onsource-map-jsadvisory GHSA-68fv-2mgg-jv7q. The same advisory fails current main run https://github.com/openclaw/openclaw/actions/runs/37402399816 atc20c6e5822d741c03831cac8ad805aace1735de3. This batch does not change package manifests, the lockfile, or the audit owner.checks-node-changed-compact-large-19failssessions.abort-agent-scope.test.ts→ “marks listed sessions active when the embedded or channel reply run registry owns the session id”: expected thesess-weixinresolver mock to be called, received zero calls. The identical assertion fails independent PR run https://github.com/openclaw/openclaw/actions/runs/37402164985/job/112072099860 atcba67cba259f4a910f5f78b871296bebbf19530f. Main commit70cfa76a35450625b7d070b753e6778fbb78ffd8, merged after this branch's base, introduced an inventory exclusion increateVisibleActiveSessionRunProjector. The fixture supplies a row and mocks the downstream resolver without registering an embedded/reply/projected/subagent inventory owner, so that new branch returns before the mock. This PR changes neither that fixture nor its resolver, registry inventory, list handler, or presentation call path. Nearby session type/key simplifications do not supply or remove any active-run inventory; the synthetic projection fixture bypasses the changed row-scope implementation. The coordinator owns this inherited fixture failure.Complete paginated exact-head accounting: 181 check runs, 115 successful, three failed (the two roots above plus downstream
openclaw/ci-gate), 61 skipped, one neutral, and one cancelled duplicate Auto response run. No test or check job remains pending. All type, lint, dependency, baseline, architecture, and other selected test jobs passed. The aggregate gate log reports the inherited security and Node-shard failures; the cancelled Auto response is separate from CI and a succeeding Auto response is recorded on the same head. The authorized inherited-failure exception applies to exact head376675539fbbc9154c18b594c94f5ede1e04a9c4; this does not describe CI as green.