Skip to content

fix: bound outbound bootstrap state and preserve workspace locks - #120939

Merged
steipete merged 2 commits into
mainfrom
steipete/eager-poincare-4c8cad
Aug 9, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/eager-poincare-4c8cad

Conversation

@steipete

@steipete steipete commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where long-running gateways resolving many distinct unknown outbound channel IDs could retain an unbounded number of bootstrap outcomes within one config and registry generation.

Also fixes a current-main CI blocker discovered during exact-head validation: a workspace mutation contender could reclaim a drained receiver group's lock in the brief interval before the still-live controller released it.

Why This Change Was Made

Bounds each per-config bootstrap outcome cache to a 64-entry LRU while preserving successful handles and failed-attempt suppression. Config changes and active registry generation changes still invalidate the owning cache, and eviction permits a later retry.

Workspace lock identities now carry both authoritative lifetimes: the controller PID that owns final release and the detached receiver process-group PID whose descendants must remain fenced. Reclamation waits until both are dead, while strict release ownership checks remain unchanged.

This change was AI-assisted and manually reviewed.

User Impact

Gateways keep outbound bootstrap memory bounded under invalid, mistyped, or highly dynamic channel traffic without repeating plugin discovery for resident unavailable channels. Cloud-worker workspace publication and retry cleanup no longer fail when a receiver group drains immediately before controller release.

Evidence

  • node scripts/run-vitest.mjs src/infra/outbound/channel-bootstrap.runtime.test.ts src/infra/outbound/channel-resolution.test.ts — 33 tests passed.
  • node scripts/check-changed.mjs -- src/infra/outbound/channel-bootstrap.runtime.ts src/infra/outbound/channel-bootstrap.runtime.test.ts — passed via Testbox tbx_01kzjgf0b5qq6rgsr8qdx9es8v.
  • Workspace lock focused suites passed 5 consecutive runs: 3 files and 29 tests per run.
  • node scripts/check-changed.mjs -- src/gateway/worker-environments/workspace-mutation-lock-remote-script.ts src/gateway/worker-environments/workspace-mutation-remote-script.test.ts src/gateway/worker-environments/workspace-sync-scripts.test.ts — passed via Testbox tbx_01kzjm4g1f4cwpa2aa22ypsyaa.
  • git diff --check and targeted oxfmt --check — passed.
  • Both uncommitted change sets received clean Codex-backed autoreview results with no accepted/actionable findings.
  • The gateway repair addresses the repeated exact-head CI failures in checks-node-compact-large-5 from run 31298027433.

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Aug 9, 2026
@steipete
steipete marked this pull request as ready for review August 9, 2026 06:03
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S and removed size: XS labels Aug 9, 2026
@steipete steipete changed the title fix: prevent unknown outbound channels from growing bootstrap state fix: bound outbound bootstrap state and preserve workspace locks Aug 9, 2026
@steipete

steipete commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready proof for exact head 843e1cf70ff9d2d4e2b2e55848f050e0916f8789:

  • node scripts/run-vitest.mjs src/infra/outbound/channel-bootstrap.runtime.test.ts src/infra/outbound/channel-resolution.test.ts — 33/33 passed.
  • node scripts/check-changed.mjs -- src/infra/outbound/channel-bootstrap.runtime.ts src/infra/outbound/channel-bootstrap.runtime.test.ts — green on Testbox tbx_01kzjgf0b5qq6rgsr8qdx9es8v.
  • node scripts/run-vitest.mjs src/gateway/worker-environments/workspace-mutation-remote-script.test.ts src/gateway/worker-environments/workspace-sync-scripts.test.ts src/gateway/worker-environments/workspace-sync-tunnel.test.ts — 3 files / 29 tests passed in each of 5 consecutive bounded runs.
  • node scripts/check-changed.mjs -- src/gateway/worker-environments/workspace-mutation-lock-remote-script.ts src/gateway/worker-environments/workspace-mutation-remote-script.test.ts src/gateway/worker-environments/workspace-sync-scripts.test.ts — green on Testbox tbx_01kzjm4g1f4cwpa2aa22ypsyaa.
  • git diff --check and targeted oxfmt --check — passed.
  • Exact-head CI: run 31299897618 completed green, including openclaw/ci-gate.
  • Codex-backed autoreview was clean for both change sets, with no accepted/actionable findings.

The initial exact-head validation failure was checks-node-compact-large-5 in run 31298027433. It exposed a current-main workspace lock race: the detached receiver group could drain before the still-live controller performed final release, so a contender could mistake the lock owner for dead and reclaim it prematurely. The second commit records both authoritative lifetimes—the controller PID and receiver process-group PID—without weakening strict release ownership checks.

Known proof gaps: none.

@steipete
steipete merged commit caf7762 into main Aug 9, 2026
129 of 130 checks passed
@steipete
steipete deleted the steipete/eager-poincare-4c8cad branch August 9, 2026 07:08
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 10, 2026
…nclaw#120939)

* fix(outbound): bound channel bootstrap outcomes

* fix(cloud-workers): preserve workspace lock controller ownership
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant