Skip to content

fix(process): release retired broker request references - #200567

Merged
RomneyDa merged 1 commit into
mainfrom
fix/broker-retired-request-retention
Nov 17, 2026
Merged

RomneyDa merged 1 commit into
mainfrom
fix/broker-retired-request-retention

Conversation

@RomneyDa

Copy link
Copy Markdown
Member

Problem

The release qualification proxy-retention test reproduces on exact main base 5fb231527f4f14d83bc27067879370debe4d2b7a: one completed command proxy remains alive after closing its broker. A synthetic heap snapshot traces the strong reference through the retained broker error stack, its failure callback context, and the retired request map. Later retirement looks at the replacement map, leaving the captured old map populated.

Change

  • Clear the retired request map after notifying its requests of failure.
  • Release the separate file-output list only after native/writer settlement and output notification.
  • Cover both one-command and five-command retention cases.

No admission, restart, process ownership, native settlement, or error-reporting policy is changed. No prewarming, forced collection changes, or weakened lifetime assertion. Self-simplification retained a three-line production fix; independent review was waived by the release owner.

Evidence

  • Exact-main original regression: failed, retained 1 instead of 0.
  • Fixed original regression plus file-output, transport-retirement and host-scope settlement: 42 tests passed.
  • Final parameterized lifetime cases: 2/2 passed (one and five commands); the 41 unchanged sibling tests remain passing evidence.
  • 12 GiB canonical core typecheck, canonical targeted lint, format and diff checks: passed.

These are local results, not release qualification. The separate Bun session-authorization failures remain unresolved. Main-first release backport waits for a verified merge.

@clawsweeper

clawsweeper Bot commented Nov 17, 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.

@RomneyDa
RomneyDa enabled auto-merge (squash) November 17, 2026 11:22
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 17, 2026
@RomneyDa
RomneyDa merged commit 9a38762 into main Nov 17, 2026
126 checks passed
@RomneyDa
RomneyDa deleted the fix/broker-retired-request-retention branch November 17, 2026 11:32
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 17, 2026
@clawsweeper

clawsweeper Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR releases retired broker request references after failure notification and file-output settlement.

Example: Run one /bin/sh command with exit 0, wait for completion, then close its broker.

  • Before: The PR reports that one completed command proxy remains reachable after garbage collection.
  • After: The reported fixed regression retains zero proxies.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, source-supported repair with reported red/green real-process regression coverage; validation was inspected rather than independently executed.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored internal lifetime repair is outside the contributor proof gate; supplied evidence exercises the production host with real broker and shell processes, but establishes no full Gateway memory qualification.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Completed command proxies can remain in memory after their broker closes.
Reason: The maintainer-authored change restores an existing lifetime invariant without adding policy, configuration, or another lifecycle owner.

Regression provenance

Regression provenance — verified: source commit db4b2edd6d08 by Peter Steinberger; canonical PR #197975 (blame-to-merge-commit).

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR fixes a source-confirmed retention defect still present on current main, with no actionable correctness or security findings.

Priority: P2
Reviewed head: 413f07030617d3d646aed2d70e1be403d9fdce02

Before merge

None.

Findings

None.

Agent review details

How this fits together

The spawn broker host translates command requests into broker IPC, tracks child proxies, and settles results and native cleanup when the transport closes.

flowchart LR
  A[Command caller] --> B[Broker host]
  B --> C[Broker process]
  C --> D[Native command]
  C --> E[Transport retirement]
  E --> F[Notify request failures]
  F --> G[Release retired references]
  E --> H[Join native writer cleanup]
  H --> G
Loading

Technical review

Best possible solution:

Clear the existing retired collections at their final ownership boundaries while preserving failure notification and native writer settlement.

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

The captured-map lifetime is visible in current source, and the existing real-process regression supplies a concrete reproduction; this read-only review did not execute it.

Is this the best way to solve the issue?

The patch is the smallest complete repair using the existing host owner: release the retired map after notification and the output list after settlement.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Broker failure diagnosis and native settlement keeps the original intent (db4b2ed: Move runtime failure diagnosis off the main thread while keeping native-close settlement independent.)
  • Completed proxy lifetime regression keeps the original intent (67cedc3: The original broker implementation included collection of completed proxies among its lifecycle guarantees.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit db4b2ed adds src/process/spawn-broker/host.ts:477 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: db4b2edd6d08; files: src/process/spawn-broker/host.ts)

PR surface

Source +3, Tests 0. Total +3 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 3 0 +3
Tests 1 2 2 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 5 2 +3

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.

Labels

Label changes:

  • add P2: The demonstrated impact is retained command-proxy memory after broker retirement, without evidence of an urgent outage or unbounded production growth from this defect.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: The demonstrated impact is retained command-proxy memory after broker retirement, without evidence of an urgent outage or unbounded production growth from this defect.
  • 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.

Reviewed November 17, 2026, 6:32 AM ET / 11:32 UTC.

RomneyDa added a commit that referenced this pull request Nov 17, 2026
RomneyDa added a commit that referenced this pull request Nov 18, 2026
…0216)

Move private socket directory creation and cleanup to the existing broker
process. Keep exclusive admission, private permissions, startup errors,
and joined cleanup. Parent crash cleanup follows successful readiness.
Accept the recoverable private directory orphan before readiness.

(cherry picked from commit 775be7a)

Release adaptation: retain the stable inline 103-byte socket path bound
instead of importing the newer socket-directory helper. Reuse the saved
real cold-resource regression with direct filesystem spies instead of
introducing the later all-filesystem observation helper.

Required companion: #200453 (22d5c87)
will follow to preserve the parent-decided directory in broker bootstrap.
#200320 source capture, #200370 host/readiness interface, #200567 retired
request cleanup, and 4a9273a export correction are separate owners,
not prerequisites for this stable private-directory lifetime.

Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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