Skip to content

refactor(gateway): trim roster and worker fixture duplication - #158656

Merged
steipete merged 1 commit into
mainfrom
perf/d1a-state-worker-deslop
Sep 26, 2026
Merged

steipete merged 1 commit into
mainfrom
perf/d1a-state-worker-deslop

Conversation

@steipete

Copy link
Copy Markdown
Contributor

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 normalizeAgentId returns a nonempty normalized ID or main.

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

  • Production: +2 / -8, net -6 LOC. Tests: +2 / -25, net -23 LOC.
  • Focused proof: node scripts/run-vitest.mjs src/gateway/agent-list.test.ts src/gateway/event-web-push.storage-scope.test.ts --maxWorkers=1 passed 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.
  • Test audit: retained the stronger roster boundary test and every Web Push ordering, overload, settlement, and close test. No new production test seam or copied behavior.
  • Formatting and git diff --check passed. Changed-check classification: core and core tests.
  • Candidate test execution: roster 114 ms; Web Push storage scope 54 ms. The focused command's remaining wall time was setup/compilation.
  • Independent Codex autoreview passed both the pre-commit diff and committed branch at P0–P2, with no actionable findings. Branch review included the canonical normalizer, roster entries, retained roster tests, and worker command type as source evidence.
  • Active-PR file exclusions were checked again before publication: no overlap.
  • Blacksmith Testbox 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.ts passed its initial guards, production typecheck, and 15 test type graphs, then failed after 1,010.75 s command wall time on TS2459 in ui/src/e2e/control-ui-retained-assets.e2e.test.ts:17 (the old ControlUiRootState import). 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.
  • Reused the same Testbox to run every remaining selected lint/guard check plus the nine test graphs that the known UI error prevented from starting. All passed (exit 0; 706.47 s command wall time). Across both runs, all 24 other test type graphs passed. The original full check-changed result remains failed and is not represented as green.
  • Testbox stopped after proof. No schema, public API, or runtime behavior changes; no visual changes.

@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS labels Sep 26, 2026
@steipete
steipete marked this pull request as ready for review September 26, 2026 04:52
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 26, 2026
@clawsweeper

clawsweeper Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 26, 2026, 12:59 AM ET / 04:59 UTC.

ClawSweeper review

What this changes

This 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
Reviewed head: 9a55ce09a3e761eb069a94975b7b28af23887fda

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A small, coherent cleanup whose source contracts and retained test support the intended behavior.
Proof confidence 🌊 off-meta tidepool Not applicable: Repository admin permission makes the external-contributor proof gate inapplicable. The retained roster test exercises the list function with real temporary directories, and the Web Push change only types a mocked fixture; the PR reports focused tests, but this review did not execute them. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository admin permission makes the external-contributor proof gate inapplicable. The retained roster test exercises the list function with real temporary directories, and the Web Push change only types a mocked fixture; the PR reports focused tests, but this review did not execute them. No stored-data contract changes.
Evidence reviewed 8 items Introduced change: The pinned PR delta changes only the roster implementation, one roster test, and a type-only Web Push test fixture.
Normalizer contract: The normalizer returns a valid normalized ID or the nonempty default ID, so the removed truthiness filter cannot exclude another result.
Retained roster coverage: The retained test checks an explicit roster, both system-agent directories, exclusion of an ordinary directory, ordering, asynchronous discovery, and membership refresh.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -6, Tests -23. Total -29 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 2 8 -6
Tests 2 2 25 -23
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 4 33 -29

Review metrics

None.

Technical review

Best 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.

Labels

Label changes:

  • add P3: This is a small internal cleanup with no claimed user-visible behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository admin permission makes the external-contributor proof gate inapplicable. The retained roster test exercises the list function with real temporary directories, and the Web Push change only types a mocked fixture; the PR reports focused tests, but this review did not execute them. No stored-data contract changes.

Label justifications:

  • P3: This is a small internal cleanup with no claimed user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository admin permission makes the external-contributor proof gate inapplicable. The retained roster test exercises the list function with real temporary directories, and the Web Push change only types a mocked fixture; the PR reports focused tests, but this review did not execute them. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Dallin Romney: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit c6da2a9 into main Sep 26, 2026
268 checks passed
@steipete
steipete deleted the perf/d1a-state-worker-deslop branch September 26, 2026 05:18
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant