Skip to content

refactor(subagents): own session Swarm summaries - #206545

Merged
vincentkoc merged 2 commits into
mainfrom
refactor/gateway-subagent-owner-swarm-summary
Nov 27, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
refactor/gateway-subagent-owner-swarm-summary

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Gateway session rows still own the collector-status, grouping, and member-selection decisions for Swarm summaries. This is the next slice of the maintainer-requested subagent ownership cleanup after #206444 and #206479.

User Impact

No user-visible change. Session lists and events preserve their existing summary counts, ordering, limits, and omission of private child content.

Why This Change Was Made

Move the summary implementation beside the registry read types and collapse its parallel group/member maps into one group accumulator. Both gateway consumers call the same owner, and the old module is deleted without a compatibility export. Selected groups discard their private member buffers before returning the wire summary.

Caller Question delegated to the subagent owner
session-utils-row.ts Summary for initial row materialization
session-row-projection-context.ts Summary after a registry publication
gateway-fresh-array-measure.ts The same summary operation under bounded synthetic load

Mechanical caller updates

  • Update the two gateway imports and the existing session-swarm-summary.test.ts import.
  • Update the benchmark's dynamic source path and type reference.
  • Move the exact two unicorn/no-array-sort suppression entries with the renamed file in lint-suppressions.test.ts; no new suppression is introduced.

Scope and measurements

Against 89d1fd016979f5052277669bfec947b92152e8c0, production lines across touched files are net −2: runtime −5 and benchmark +3. Tests are +1. The 121 campaign-listed gateway files have 43 → 42 registry/announce importer files, 68 → 67 total subagent importer files, and 1,307 → 1,307 subagent-mentioning lines. Gateway loses the 86-line policy module; its replacement is 81 lines.

Gateway summary decision functions: 1 → 0. Group/member indexes: 2 → 1. Remaining imports of the removed gateway module and operations on the removed member map: 0. The owner retains its three production callers (two gateway paths and the benchmark). Code-sloppiness scans are complete: function SLOC 61 → 56, CC 18 → 17, score 48.6167 → 48.4758, no clone lines or parse failures.

Evidence

  • Native Node summary probe on base and candidate: 10,000 collectors across 40 groups, compact and selected-parent results have identical SHA-256 hashes. This is functional equivalence evidence, not a performance claim.
  • 200 deterministic base/candidate comparisons cover varied collector states, owner filtering, groups and both detail modes. Inputs stay frozen and no private member-buffer property reaches the output.
  • Oxfmt, syntax checks for all six changed files, git diff --check, signed commit, and session-identity ratchet pass (1,549 files; 6,170 existing pins).
  • Fresh independent autoreview of the complete net-negative candidate against the pinned base, P0–P2: scoped-clean. It confirms output parity and omission of private member data. Full repository reference search separately confirms no remaining imports of the deleted module; the gateway test filename is intentionally unchanged.
  • Hosted review also passes on c533fb11a0f862ac5603f2cf8d7345fbf4aef873, with no findings or merge blockers.
  • This managed checkout is code-only because the shared dependency install is unqualified. Current-head CI for c533fb11a0f862ac5603f2cf8d7345fbf4aef873: 45981537436, 46 passed, 27 planned skips. No local dependency-backed test result is claimed.
  • Prior-head manual CI for a675a7f1793d63b2874a23dcb7917ca40037f435: 45975078055. Build, typechecks, lint and every executed test job passed. This precedes the accumulator consolidation.
  • Its dependency check reports the unused plugin export releaseReplacedNamespaces. Scheduled main 45973857636, at the exact base 89d1fd016979f5052277669bfec947b92152e8c0, reports the identical error in job 140421182413. The PR failure is job 140425672511. Both full-tree Knip reports pass; the failing production report is outside this cutover.
  • Prior-head ready-PR CI: 45976728107, 46 passed, 27 planned skips. It precedes the accumulator consolidation. The earlier manual-run failure remains attributed above; it is not claimed fixed by this green run.

@vincentkoc vincentkoc self-assigned this Nov 27, 2026
@clawsweeper

clawsweeper Bot commented Nov 27, 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 scripts Repository scripts agents Agent runtime and tooling size: XS labels Nov 27, 2026
@clawsweeper clawsweeper Bot added the P2 Normal backlog priority with limited blast radius. label Nov 27, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review November 27, 2026 09:48
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 27, 2026
@clawsweeper

clawsweeper Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: passed.

What this changes

Moves Swarm summary construction into the subagent registry and combines group counts and member buffers in one accumulator.

Example: A parent has 30 retained collectors: 25 completed and 5 failed.

  • Before: The Gateway summary owner returns done: 25 and failed: 5.
  • After: The subagent registry owner returns the same counts.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, correct refactor supported by source comparison, reported in-process equivalence checks, and successful exact-head CI.
Proof confidence 🦐 gold shrimp (3/6) No user-visible change requires new shipped-entry-point proof; the body reports native owner comparisons, exact-head CI succeeds, and historical screenshots are not counted as current-head execution.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: No user-visible behavior change is intended; Gateway code currently owns interpretation of subagent collector summaries.
Reason: Maintainer-authored direction is established, and the change places collector interpretation beside registry read types while removing the previous owner.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR completes a focused ownership cleanup, and no blocking defect was found.

Reviewed head: c533fb11a0f862ac5603f2cf8d7345fbf4aef873

Before merge

None.

Findings

None.

Tests

  • Suggested test cut src/gateway/session-swarm-summary.test.ts:276-280: This snapshot invocation repeats the top-level omission assertion immediately below; retain the nested-session assertion.
    • A global snapshot with populated Swarm data and no agentId omits top-level swarm. Fault: Expose top-level swarm for an unscoped global key while leaving unknown-key handling intact. src/gateway/session-swarm-summary.test.ts:284: The global table row invokes the surviving snapshot with the same populated summary and absent agentId, so the leaked property fails this assertion. Input: src/gateway/session-swarm-summary.test.ts:254-256, src/gateway/session-swarm-summary.test.ts:257-259, src/gateway/session-swarm-summary.test.ts:281-284
    • An unknown-key snapshot with populated Swarm data and no agentId omits top-level swarm. Fault: Expose top-level swarm for an unscoped unknown key while retaining the global-key omission. src/gateway/session-swarm-summary.test.ts:284: The unknown table row still invokes the surviving snapshot without agentId, exposing the leaked property to this assertion. Input: src/gateway/session-swarm-summary.test.ts:254-256, src/gateway/session-swarm-summary.test.ts:257-259, src/gateway/session-swarm-summary.test.ts:281-284
Agent review details

How this fits together

Compact registry records and parent identity enter the summary builder; bounded counts and optional child details feed session-row materialization and refresh.

flowchart TD
  A[Subagent registry records] --> B[Subagent summary owner]
  B --> C[Initial session row]
  B --> D[Session row refresh]
  C --> E[Session lists and descriptions]
  D --> F[Session events]
Loading

Technical review

Best possible solution:

Retain one registry-owned summary builder with direct consumer imports and no compatibility wrapper.

Do we have a high-confidence way to reproduce the issue?

This is an internal ownership refactor; source inspection establishes the existing Gateway-owned policy rather than a user-visible failure.

Is this the best way to solve the issue?

The move follows the existing subagent ownership boundary, removes the superseded module, and simplifies accumulation without changing the output contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against b431a1ebeb9e.

Provenance checked

  • Retained Swarm outcomes and bounded disclosure keeps the original intent (b66ab5b: Keep completed collector outcomes visible after child cleanup, with bounded group and child detail for the authorized parent.)
  • Compact registry reads keeps the original intent (e633da5: Move session-list registry reads off the event loop while preserving retained collector summaries.)
  • Private-array sorting keeps the original intent (7dd7fcc: Avoid redundant copies of private arrays while preserving ordering and caller-owned inputs.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit b66ab5b adds src/gateway/session-swarm-summary.ts:9 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b66ab5bb4685; files: src/gateway/session-swarm-summary.ts)
  • Vincent Koc: Raw commit 8ae5dd4 adds src/gateway/session-row-projection-context.ts:10 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 8ae5dd44d938; files: src/gateway/session-row-projection-context.ts)

PR surface

Source -5, Tests +1, Other +3. Total -1 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 14 19 -5
Tests 2 3 2 +1
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 6 3 +3
Total 6 23 24 -1

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus test LOC Production net −2; tests net +1 Runtime shrinks by five lines, benchmark imports grow by three, and the suppression inventory gains one explanatory line.

Labels

Label changes:

No label changes.

Label justifications:

  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-27T10:20:22.189Z sha a675a7f :: passed. :: none

Reviewed November 27, 2026, 5:44 AM ET / 10:44 UTC (Revision 2).

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@vincentkoc
vincentkoc merged commit 937f6ed into main Nov 27, 2026
151 checks passed
@vincentkoc
vincentkoc deleted the refactor/gateway-subagent-owner-swarm-summary branch November 27, 2026 10:53
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 28, 2026
* refactor(subagents): own session Swarm summaries

* refactor(subagents): remove parallel summary member index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts 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