Repository navigation
fix(reef): stop exposing retired account runtime - #129131
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 5:32 AM ET / 09:32 UTC. ClawSweeper reviewWhat this changesThis PR replaces Reef’s mutable active-runtime slot with generation-bound cancellation that retires borrowed outbound, friendship, and review capabilities when an account stops or is replaced. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessNo blocking patch defect found: the re-review P1 is addressed by an account-owned generation fence that reaches the borrowed owners and their final effects. Keep this active maintainer PR open for normal exact-head merge validation; local current-main comparison was unavailable in this checkout. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherReef is a bundled channel plugin whose account startup constructs encrypted messaging, pairing, trust, and review components. Channel sends and Reef commands use that active account runtime, which ultimately performs relay requests or updates channel-owned state. flowchart LR
A[Account startup or replacement] --> B[Generation authority]
B --> C[Active Reef runtime]
C --> D[Flow friends and reviews]
D --> E[Relay and state effects]
A --> F[Abort or cleanup]
F --> B
B --> G[Reject retired work]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +80, Tests +362. Total +442 across 12 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one Reef-local generation authority created before account-owned components and checked immediately before relay or privileged state effects; merge after normal exact-head validation. Do we have a high-confidence way to reproduce the issue? Yes. The exact-head regression scenarios pause guard, reconcile, and command work, then abort or replace the account before releasing the paused operation; this review did not execute them. Is this the best way to solve the issue? Yes. Binding cancellation into the account-owned flow, friend manager, and review store is stronger than relying only on a fresh global-runtime lookup because it also fences already-borrowed capabilities. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 315969f6693e. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles) |
|
@clawsweeper re-review The retained-capability P1 is addressed on |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
* fix(reef): retire stopped runtime ownership Refs openclaw#129063 * fix(reef): fence borrowed runtime authority Refs openclaw#129063
Closes #129063
AI-assisted: Claude Code and Codex.
What Problem This Solves
Fixes an issue where stopping or replacing a running Reef account left both the retired account's global runtime and already-borrowed outbound, pairing, friendship, and review capabilities usable while shutdown was draining or after it completed.
Why This Change Was Made
Reef now creates one generation-specific authority before constructing the account-owned flow, friend manager, and review store. Account abort or replacement revokes that authority through the owners themselves, so callers cannot omit or substitute the generation fence. Cleanup clears the global slot only when the retiring generation still owns it.
The same authority reaches final relay I/O, deferred friendship serialization, trust expansion, review decisions, and command reads. Fail-closed friendship tombstones and ambiguous outbound friend-request intent remain durable during cancellation.
User Impact
Stopped Reef accounts no longer handle outbound messages or privileged Reef commands through stale transport, key, guard, trust, or review state. Work that began before abort is stopped before its final relay or privileged state effect, while a replacement account remains usable even when an earlier generation finishes shutting down late.
Evidence
getActiveReef()still returned the stopped account.node scripts/run-vitest.mjs extensions/reef/src/channel.test.ts extensions/reef/src/runtime.test.ts extensions/reef/src/outbound.test.ts extensions/reef/src/config-schema.test.ts extensions/reef/src/friends.test.ts— 69 tests passed on the final owner-bound implementation.node scripts/run-vitest.mjs extensions/reef— 308 tests passed.node scripts/check-changed.mjs -- extensions/reef/runtime-api.ts extensions/reef/src/channel.test.ts extensions/reef/src/channel.ts extensions/reef/src/config-schema.test.ts extensions/reef/src/flow.ts extensions/reef/src/friends.test.ts extensions/reef/src/friends.ts extensions/reef/src/outbound.test.ts extensions/reef/src/runtime.test.ts extensions/reef/src/runtime.ts extensions/reef/src/state.ts extensions/reef/src/transport.ts— passed formatting, production/test typechecking, lint, plugin boundaries, dead-code checks, and import-cycle checks. The only advisory is the existing test temp-directory fixture style.reefPlugin.gateway.startAccount, encrypted flow, friend manager, review store, and transport boundaries are exercised with deterministic final-effect assertions instead.