Repository navigation
Conversation
An all-agent discovery sweep already ends with one global skills change. Record evictions from that sweep and publish them only if the sweep fails, so a completed reload does not emit one watch change per source past the registry cap. Co-authored-by: Arca <[email protected]>
|
🦞👀 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. What this changesCoalesce eviction notifications from a successful all-agent skills sweep into its closing global notification while preserving failure and ordinary eviction notifications. Example: Reload config on a Gateway with 140 distinct agent workspaces.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR fixes a current large-fleet reload bug at the discovery owner, with no actionable correctness finding; exact-head CI is still pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherSkills discovery registers and scans agent workspaces, then publishes revisions consumed by Gateway chat metadata and connected WebSocket clients. flowchart TD
A[Config reload or startup] --> B[Skills discovery sweep]
B --> C[Bounded source registry]
C --> D[Sweep eviction records]
B --> E[Global revision on success]
D --> F[Workspace revisions on failure]
E --> G[Gateway metadata and clients]
F --> G
Technical reviewBest possible solution: Keep notification coalescing in the existing discovery owner, preserving ordinary eviction invalidation and failed-sweep recovery. Do we have a high-confidence way to reproduce the issue? Current-main source establishes one eviction notification per distinct source beyond 128 plus the closing global notification, consistent with the linked release report and contributor's Gateway measurements; no target code was run during this review. Is this the best way to solve the issue? The patch removes redundant publications at their existing owner without adding consumer delays, another cache, or global suppression state, and preserves the distinct failure and concurrent-registration boundaries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0eb84f967507. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +29, Tests +276, Other +2. Total +307 across 3 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 9, 2026, 5:41 AM ET / 10:41 UTC. |
What Problem This Solves
Fixes: a config hot reload on a Gateway with more than 128 configured agents publishes one extra skills change per agent past the cap, and each one makes the Gateway refresh chat metadata for every agent and broadcast
skills.changedto every connected client.User Impact
User impact: operators running large agent fleets get one
skills.changedbroadcast per config reload (and per startup sweep) instead of one per evicted agent, so the Gateway main thread is no longer tied up by hundreds of redundant chat-metadata refreshes after each reload. Gateways with 128 agents or fewer see no change.Why This Change Was Made
An all-agent skills discovery sweep registers every agent workspace in batches into a registry capped at 128 sources. Each registration past the cap evicts the oldest source and published its own workspace change. The sweep already ends with a global change that supersedes every workspace's version, so those per-eviction changes add nothing the closing change does not publish moments later.
While an all-agent sweep runs (
configset, noworkspaceDir), it now records the workspaces it evicts instead of publishing them. If the sweep completes, the closing global change covers them. If the sweep throws, the recorded workspaces are published as before, so a failed sweep still invalidates exactly what it did previously. Evictions outside an all-agent sweep, including a single-workspace refresh and a concurrentprepareLocalSkillSourcesregistration, still publish immediately. Each sweep keeps its own list, so overlapping sweeps cannot publish or drop each other's evictions. No export, type, schema, or config option changes.Evidence
Live isolated Gateway (loopback, token auth, stub model provider, 140 configured agents,
skills.load.watch: false), with an operator WebSocket client countingskills.changedbroadcasts after rewriting one agent's model to trigger a hot reload, three reloads per tree:mainat6bc38b0158b3watch+ 1config-change)config-change)That matches
(140 - 128) + 1 = 13on main and the single closing change on the branch. Startup logged non-fatalusage-cost-cacheworker-capacity warnings at 140 agents; the Gateway still completed the client handshake. Counts come from the live WebSocket event stream because gateway logs do not print each broadcast.Regression test
src/skills/runtime/refresh.sweep-eviction.test.ts(7 tests): with the production change reverted, the above-cap sweep test fails with twowatchevents plus oneconfig-changefor a 130-agent sweep, which is the N - 128 extra events. With the change, all 7 pass. Negative controls cover a failed sweep still publishing its evicted workspaces, a single-workspace eviction outside a sweep still publishing, a concurrent registration still publishing immediately, and a sweep retired by a concurrent config refresh. Sibling runs ofdiscovery.integration,refresh.workspace,session-snapshot-content, anddiscovery.workertests passed, as didpnpm tsgo:core, oxlint, and oxfmt on the touched files. The new test file is covered by a 276-line allocation underconfig/test-lines-allocations/sized to this change's own test growth.Closes #195833
— Opened by an AI agent from Arca. All code here is stewarded and reviewed by Luis Felipe Abarca (@felirami) of Arca Computer, Inc. (https://arca.computer). All Arca OSS contributions: https://oss.arcabot.ai