Repository navigation
refactor(gateway): trim roster and worker fixture duplication - #158656
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: needs maintainer review before merge. Reviewed September 26, 2026, 12:59 AM ET / 04:59 UTC. ClawSweeper reviewWhat this changesThis PR simplifies the gateway agent roster, removes a duplicate roster test, and uses the shared worker-command type in a Web Push storage test fixture. Merge readiness✅ Ready for maintainer review Keep open: current main has not adopted this bounded cleanup, and the inspected contracts support the branch’s behavior-preserving intent. Priority: P3 Review scores
Verification
How this fits togetherThe Gateway combines configured agents and agent directories into a roster used by session and usage views. Separately, a Web Push storage test simulates worker commands using the production command contract. flowchart LR
A[Agent configuration] --> C[Gateway roster]
B[Agent directories] --> C
C --> D[Session and usage views]
E[Web Push operations] --> F[Shared worker command type]
F --> G[Web Push storage test]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -6, Tests -23. Total -29 across 3 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep roster membership covered at the gateway list boundary and type worker fixtures from the shared production contract. Do we have a high-confidence way to reproduce the issue? Not applicable: the PR reports internal duplication rather than a broken user flow, and the duplication is visible in the pinned source. Is this the best way to solve the issue? Yes: the normalizer and worker contract already own the relevant behavior, while the retained roster test protects the deleted test’s observable cases. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5da1262bc896. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
Removes a small amount of roster and worker-fixture duplication left in the merged performance campaign changes.
User Impact
No user-visible behavior change. Roster membership, ordering, asynchronous disk discovery, Web Push storage ordering, validation, and authority checks remain unchanged.
Why This Change Was Made
The roster now uses the canonical system-agent entries directly. Its post-normalization truthiness filter is redundant because
normalizeAgentIdreturns a nonempty normalized ID ormain.The async roster regression already covers the removed test's explicit roster, system-agent membership, and exclusion of regular disk directories; it additionally proves nonblocking reads and membership refresh after removal. The Web Push storage fixture now derives its command union from
SqliteWorkerCommand<WebPushWorkerOperations>instead of copying the production mapped type.This is deliberately a small reduction. The shared state-read contract, validation, dispatch, and session transcript worker files overlap active PRs and are untouched. Pairing metadata allowlists, persisted-data guards, diagnostic currentness checks, and avatar lifecycle checks remain because they enforce real boundaries.
Evidence
node scripts/run-vitest.mjs src/gateway/agent-list.test.ts src/gateway/event-web-push.storage-scope.test.ts --maxWorkers=1passed 14 tests in 88.17 s wall time. Baseline passed 15 tests in 155.39 s; worker compilation dominates these timings, so this is not a performance claim.git diff --checkpassed. Changed-check classification: core and core tests.tbx_01m3dy7nmdgf4p390zxeqwdpjc: run 36216796224, with all three candidate file hashes verified.node scripts/check-changed.mjs -- src/gateway/agent-list.ts src/gateway/agent-list.test.ts src/gateway/event-web-push.storage-scope.test.tspassed its initial guards, production typecheck, and 15 test type graphs, then failed after 1,010.75 s command wall time on TS2459 inui/src/e2e/control-ui-retained-assets.e2e.test.ts:17(the oldControlUiRootStateimport). Both implicated files are byte-identical to the branch base. Main already carries the owning fix da8149b8ba7d; this PR does not modify those active-lane files.check-changedresult remains failed and is not represented as green.