Skip to content

refactor(subagents): share ordered read membership - #163092

Merged
steipete merged 1 commit into
mainfrom
codex/subagent-membership-index
Oct 1, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/subagent-membership-index

Conversation

@steipete

@steipete steipete commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Subagent snapshot reads maintain separate ordered membership owners for run IDs and session relationships, duplicating update and invalidation plumbing.

User Impact

No intended behavior change. Exact-run waits retain their eager lookup, session relationships remain lazy, and reads preserve insertion order and current owner publications. No migration or operator action is required.

Why This Change Was Made

Use the existing session-read lookup for both kinds of membership and remove the standalone run-ID class and duplicate cache lifecycle. The complete cutover removes 27 production lines without changing schema, dependencies, or tests.

Evidence

All 77 existing owner cases passed across four files (138.84-second wrapper). Selected checks and independent Codex P2 review passed; removed class/getter names have no remaining production references.

Synthetic 1,000/10,000/50,000-record probes retained constant-work first exact lookup and post-publication lookup. At 50,000 records, registration medians stayed about 152ms; 10,000 broad publications changed from 12.09ms to 22.48ms, approximately 1 microsecond more per publication, with no size-dependent scan. These are one bounded five-iteration comparison, not a sustained-throughput claim. No production Gateway was modified.

@clawsweeper

clawsweeper Bot commented Oct 1, 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 agents Agent runtime and tooling size: M labels Oct 1, 2026
@steipete
steipete marked this pull request as ready for review October 1, 2026 23:33
@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 Oct 1, 2026
@clawsweeper

clawsweeper Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 1, 2026, 7:38 PM ET / 23:38 UTC.

ClawSweeper review

What this changes

The PR combines subagent run-ID and session-relationship lookup membership while preserving ordered reads and lazy session indexing.

Merge readiness

✅ Ready for maintainer review

Keep open: this is a coherent internal simplification that remains distinct from current main. Source review found no actionable correctness or security defect.

Priority: P3
Reviewed head: fa6e714a3fd3a718f642e5fcfb8d18d62491db9a

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable consolidation with existing boundary coverage and no actionable defect found.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied Repository State identifies a member-authored internal refactor, so the external-contributor proof gate does not apply. Reported existing registry cases and bounded probes support the shared lookup’s ordering and publication behavior; no runtime execution was independently performed here, and 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: The supplied Repository State identifies a member-authored internal refactor, so the external-contributor proof gate does not apply. Reported existing registry cases and bounded probes support the shared lookup’s ordering and publication behavior; no runtime execution was independently performed here, and no stored-data contract changes.
Evidence reviewed 8 items Pinned introduction and merge result: Reviewed the merge-base-to-head changes. The raw test-merge record has the pinned base followed by the exact PR head as parents; its result contains the same registry changes, rather than the unrelated endpoint drift.
Lookup behavior and ownership: The shared lookup retains insertion positions across updates, indexes both physical run IDs and collector aliases, and lazily rebuilds session relationships from current record references. Map set/delete/clear and keyed publications update that same lookup; broad publications invalidate session buckets.
Persisted cache lifecycle: Full publications replace the snapshot and its derived lookup; named publications update snapshot rows and shared membership together. Database admission and private-snapshot boundaries remain unchanged. The altered lookup is process-local state, with no introduced stored schema or serialized-format change.
Findings None None.
Security None None.

How this fits together

OpenClaw’s subagent registry combines live run records with persisted snapshots for waits and session queries. Derived lookup indexes select relevant records before the read layer hydrates and consumes their current payloads.

flowchart TD
  A[Live run records] --> C[Shared ordered membership]
  B[Persisted snapshot records] --> C
  D[Owner publications] --> C
  C --> E{Requested read scope}
  E --> F[Exact run lookup]
  E --> G[Lazy session relationships]
  F --> H[Selected current run payloads]
  G --> H
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -27. Total -27 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 5 112 139 -27
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 112 139 -27

Review metrics

None.

Technical review

Best possible solution:

Keep one publication-owned ordered membership index, with eager exact-run selection and lazily rebuilt session relationships.

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

Not applicable: the PR proposes behavior-preserving consolidation rather than reporting a failing user flow. Existing boundary tests were inspected, but execution was outside this read-only review.

Is this the best way to solve the issue?

Yes: extending the existing membership owner removes duplicate lifecycle plumbing while retaining exact lookup, session invalidation, and ordering contracts.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is internal cleanup with no intended user-visible behavior change or identified urgent defect.
  • 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: The supplied Repository State identifies a member-authored internal refactor, so the external-contributor proof gate does not apply. Reported existing registry cases and bounded probes support the shared lookup’s ordering and publication behavior; no runtime execution was independently performed here, and no stored-data contract changes.

Label justifications:

  • P3: This is internal cleanup with no intended user-visible behavior change or identified urgent defect.
  • 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: The supplied Repository State identifies a member-authored internal refactor, so the external-contributor proof gate does not apply. Reported existing registry cases and bounded probes support the shared lookup’s ordering and publication behavior; no runtime execution was independently performed here, and no stored-data contract changes.

Evidence

What I checked:

  • Pinned introduction and merge result: Reviewed the merge-base-to-head changes. The raw test-merge record has the pinned base followed by the exact PR head as parents; its result contains the same registry changes, rather than the unrelated endpoint drift. (fa6e714a3fd3)
  • Lookup behavior and ownership: The shared lookup retains insertion positions across updates, indexes both physical run IDs and collector aliases, and lazily rebuilds session relationships from current record references. Map set/delete/clear and keyed publications update that same lookup; broad publications invalidate session buckets. (src/agents/subagents/registry/subagent-session-read-scope.ts:67, fa6e714a3fd3)
  • Persisted cache lifecycle: Full publications replace the snapshot and its derived lookup; named publications update snapshot rows and shared membership together. Database admission and private-snapshot boundaries remain unchanged. The altered lookup is process-local state, with no introduced stored schema or serialized-format change. (src/agents/subagents/registry/subagent-registry-read-cache.ts:150, fa6e714a3fd3)
  • Existing boundary coverage: Read the existing tests covering live-only deletion, collector alias movement, replacement, current publication consumption, database retirement, and private read scopes. The captured PR body reports 77 passing existing cases and bounded before/after probes; those results were not independently rerun during this read-only review. (src/agents/subagents/registry/subagent-registry-read-snapshot.test.ts:119, fa6e714a3fd3)
  • Still distinct from main and release: Both fetched main and v2026.9.7 retain the separate run-ID lookup class. This consolidation is therefore not already present in either inspected revision. (src/agents/subagents/registry/subagent-run-id-lookup.ts:7, bd058c2d9999)
  • Feature-history routing: Current-main history identifies Peter Steinberger’s selected-snapshot and retained-membership work and Jason (Json)’s collector-wait work. GitHub verified the associated handles and that perf(subagents): copy only selected runs in read snapshots #161690 merged as 7d409f7. A local blame/deeper-parent inspection failed while fetching unavailable objects, so no source-line introduction attribution is claimed. (src/agents/subagents/registry/subagent-registry-memory.ts, 7d409f750d84)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • fuller-stack-dev: 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 f4c6545 into main Oct 1, 2026
202 checks passed
@steipete
steipete deleted the codex/subagent-membership-index branch October 1, 2026 23:53
@steipete

steipete commented Oct 1, 2026

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

agents Agent runtime and tooling P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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