Skip to content

fix: isolate console and agent lifecycle ownership - #13

Merged
h3zh1 merged 3 commits into
chainreactors:masterfrom
dust-life:rem-lifecycle-ownership-fix
Oct 2, 2026
Merged

h3zh1 merged 3 commits into
chainreactors:masterfrom
dust-life:rem-lifecycle-ownership-fix

Conversation

@dust-life

Copy link
Copy Markdown

What changed

This fixes REM lifecycle ownership so independent Consoles and Agent generations do not close or remove one another.

  • Scope Console.Close to the root tree owned by that Console.
  • Keep shared parent transport ownership at the root; closing a child no longer closes the shared transport.
  • Serialize Fork publication with parent and child lifecycle locks.
  • Reject closed Agents and different pointers that collide on the same ID.
  • Remove registry and parent-child entries by exact pointer, protecting replacement generations.
  • Prevent closed children or late cleanup from republishing or deleting a newer generation.
  • Preserve a stopped child alias for a later generation.
  • Add regression coverage for duplicate Fork, Fork versus Close, Add versus Close, closed Add, generation replacement, alias rebuild, and independent Console transports.

Validation

  • go test -race ./agent
  • go test -race ./runner -run 'Test(Console|Agent|.*Ownership|.*Fork|.*Close|.*Restart|.*Reconnect)' -count=1 -timeout=120s
  • go vet ./agent ./runner
  • Real loopback service restart/reconnect test passes for the candidate and clean base.

The full Runner race matrix is not claimed as green. The clean base reproduces the simplex address race, memory helper race/failure, and Unix listener readiness failures. The full matrix also has an unresolved timeout and another Bridge race that were not individually compared with the base; those are outside this focused lifecycle change.

The change is limited to lifecycle ownership and regression tests. It does not add protocol or network features.

0x00 and others added 3 commits October 1, 2026 15:39
A multi-channel server (tcp+udp+ws) spawns one Console per channel from the
same RunnerConfig. Per-console ownership rejected channel attaches arriving
at sibling consoles, breaking connhub load_distribution. Move the owned set
into a consoleScope shared per RunnerConfig; consoles from different runners
stay isolated.

Also remove a redundant unconditional Agents.Delete in the connhub reconnect
loop (Agent.Close already removes the exact pointer) and use
CompareAndDelete in the FFI CleanupAgent teardown.
@h3zh1
h3zh1 merged commit 49b2672 into chainreactors:master Oct 2, 2026
51 of 52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants