Skip to content

fix: retain ACPX process lease ownership across reconnects - #115247

Merged
shakkernerd merged 4 commits into
mainfrom
workloop/fix-and-land-acpx-process-lease-45769da6
Jul 28, 2026
Merged

shakkernerd merged 4 commits into
mainfrom
workloop/fix-and-land-acpx-process-lease-45769da6

Conversation

@shakkernerd

Copy link
Copy Markdown
Contributor

What Problem This Solves

Persistent ACPX sessions could reconnect with the stable wrapper command after OpenClaw had stripped its lease arguments from the persisted agentCommand. The replacement wrapper then ran outside the original lease identity, leaving stale ownership behind and making later cleanup unable to verify the current process.

Fixes #115177.

Why This Change Was Made

Current main already deletes terminal closed and lost lease rows, so adding a periodic reaper would treat the symptom and introduce recurring process-table work. This change instead keeps one OpenClaw-owned lease identity with the persistent session, updates its PID when ACPX saves a replacement process, serializes overlapping ownership transitions, and retires abandoned leases at existing lifecycle boundaries.

The ownership checks continue to reject foreign gateway/session identities and preserve PID-reuse safety. Direct plugin-local ACP adapter commands remain outside lease injection.

User Impact

Persistent ACPX sessions can reconnect without losing process ownership, reducing stale wrapper processes and lease state after crashes, timeouts, or reconnects without adding background polling.

Thanks @shakkernerd.

Evidence

  • Focused ACPX process-lease, runtime, and service tests passed in Blacksmith Testbox.
  • pnpm check:changed passed on the exact pushed head.
  • Exact-head autoreview completed without a remaining blocker.
  • Coverage includes initial launch, reconnect/PID replacement, concurrent operations, failed launch, terminal cleanup, foreign ownership, stale identity, and unaffected direct-command behavior.
  • git diff --check and the branch worktree are clean.

@shakkernerd
shakkernerd marked this pull request as ready for review July 28, 2026 14:50
@shakkernerd shakkernerd self-assigned this Jul 28, 2026
@shakkernerd
shakkernerd force-pushed the workloop/fix-and-land-acpx-process-lease-45769da6 branch from f633121 to 95f25f6 Compare July 28, 2026 14:51
@shakkernerd
shakkernerd force-pushed the workloop/fix-and-land-acpx-process-lease-45769da6 branch from 95f25f6 to e616188 Compare July 28, 2026 15:24
@shakkernerd
shakkernerd force-pushed the workloop/fix-and-land-acpx-process-lease-45769da6 branch from e616188 to ecb5615 Compare July 28, 2026 15:27
@shakkernerd
shakkernerd force-pushed the workloop/fix-and-land-acpx-process-lease-45769da6 branch from ecb5615 to 0a84717 Compare July 28, 2026 15:32
@shakkernerd
shakkernerd merged commit b6adb8e into main Jul 28, 2026
43 checks passed
@shakkernerd
shakkernerd deleted the workloop/fix-and-land-acpx-process-lease-45769da6 branch July 28, 2026 15:32
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Merged using rebase.

What changed after review:

  • Retained one ACPX process-lease identity and refreshed its PID across persistent reconnects.
  • Preserved retryable PID ownership after partial session-store saves or unavailable process inspection.
  • Kept direct adapter commands and existing configuration/docs contracts unchanged, with focused regression coverage.

Verification:

  • Rebased/refreshed onto current origin/main before pushing.
  • Blacksmith Testbox tbx_01kymky3yet24xnhf3n3m3rm8x: 145 focused ACPX tests and pnpm check:changed passed.
  • GitHub Real behavior proof passed.
  • Auto-review: clean; independent review findings were resolved and rereviewed.
  • GitHub checks: no required checks configured; all applicable exact-head checks passed.

Landed on main:

Thanks @shakkernerd!

vincentkoc added a commit that referenced this pull request Jul 28, 2026
* origin/main:
  test(codex): de-flake attempt turn-watch timing tests (#115258)
  fix: preserve retryable ACPX lease ownership (#115247)
  fix: serialize ACPX lease ownership transitions
  fix: retain ACPX leases across wrapper reconnects
  refactor: parse ACPX lease command identity
  fix: preserve OpenClaw profile env in macOS launch-at-login plist (#99752)
  refactor(config): retire compaction truncateAfterCompaction gate (#115206)
  improve(ui): reduce duplicate chat startup work (#114743)
  fix(ui): keep reconnects, browser tabs, and localized search consistent (#115221)
  perf(pr): cache complete small file lists (#115199)
  perf(sqlite): skip no-op automatic schema repair (#115193)
  docs(browser): correct Docker sandbox setup (#115254)
  fix(ui): avoid duplicate session refreshes during startup (#114764)

# Conflicts:
#	ui/src/pages/agents/panels-tools-skills.browser.test.ts
vincentkoc added a commit that referenced this pull request Jul 28, 2026
* origin/main:
  test(codex): de-flake attempt turn-watch timing tests (#115258)
  fix: preserve retryable ACPX lease ownership (#115247)
  fix: serialize ACPX lease ownership transitions
  fix: retain ACPX leases across wrapper reconnects
  refactor: parse ACPX lease command identity
  fix: preserve OpenClaw profile env in macOS launch-at-login plist (#99752)
  refactor(config): retire compaction truncateAfterCompaction gate (#115206)
  improve(ui): reduce duplicate chat startup work (#114743)
  fix(ui): keep reconnects, browser tabs, and localized search consistent (#115221)
  perf(pr): cache complete small file lists (#115199)
  perf(sqlite): skip no-op automatic schema repair (#115193)
  docs(browser): correct Docker sandbox setup (#115254)
  fix(ui): avoid duplicate session refreshes during startup (#114764)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ACPX reaper only runs at startup — lost leases accumulate indefinitely

1 participant