Skip to content

refactor: extract ACP manager runtime handle cache - #88725

Merged
steipete merged 1 commit into
mainfrom
refactor/acp-manager-runtime-handle-cache
May 31, 2026
Merged

steipete merged 1 commit into
mainfrom
refactor/acp-manager-runtime-handle-cache

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

  • Extract ACP manager runtime-handle cache ownership into ManagerRuntimeHandleCache
  • Move cached handle matching, status reuse checks, close/clear, observability, and idle eviction out of manager.core.ts
  • Keep AcpSessionManager focused on session orchestration and runtime lifecycle decisions

Verification

Behavior addressed: internal ACP manager refactor only; no protocol or user-visible behavior change intended.
Real environment tested: local macOS checkout, Node/pnpm repo tooling.
Exact steps or command run after this patch:

  • pnpm test src/acp/control-plane/manager.runtime-handles.test.ts src/acp/control-plane/runtime-cache.test.ts src/acp/control-plane/manager.runtime-config.test.ts
  • node scripts/run-oxlint.mjs src/acp/control-plane/manager.core.ts src/acp/control-plane/manager.runtime-handle-cache.ts
  • pnpm check:test-types
  • .agents/skills/autoreview/scripts/autoreview --mode local
    Evidence after fix: focused manager runtime-handle/runtime-config tests passed; narrow oxlint passed; test types passed; autoreview reported no accepted/actionable findings.
    Observed result after fix: cached runtime handle reuse, unhealthy-status eviction, handle matching, close/clear, idle eviction, and observability behavior are preserved through the extracted owner.
    What was not tested: full CI before PR creation.

@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels May 31, 2026
@clawsweeper

clawsweeper Bot commented May 31, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed May 31, 2026, 1:38 PM ET / 17:38 UTC.

Summary
The PR extracts ACP manager cached runtime-handle ownership from manager.core.ts into a new ManagerRuntimeHandleCache helper without changing protocol, config, or user-visible behavior.

PR surface: Source +33. Total +33 across 2 files.

Reproducibility: not applicable. This PR is an internal refactor rather than a bug report. Behavior preservation is covered by source parity review and the existing focused ACP runtime-handle tests listed in the PR body.

Review metrics: none identified.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🌊 off-meta tidepool
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Refresh/rebase against current main and let current CI or equivalent focused ACP manager test proof gate the merge.

Risk before merge

  • [P1] The PR base is behind the checked-out main SHA, so maintainers should refresh/rebase and rely on a current merge result before landing.
  • [P1] This read-only review did not run the listed tests; the PR body reports focused ACP manager tests, oxlint, test types, and autoreview, but merge should still wait for current CI or equivalent maintainer proof.

Maintainer options:

  1. Decide the mitigation before merge
    Land the extraction as a narrow behavior-preserving refactor once the branch is refreshed and the focused ACP manager runtime-handle/runtime-config tests plus current CI stay green.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] No ClawSweeper repair is queued because review found no concrete patch defect; the remaining action is normal maintainer merge validation after refresh/current CI.

Security
Cleared: The diff only moves TypeScript ACP runtime-cache logic between core source files and does not touch dependencies, workflows, scripts, secrets, package metadata, or other supply-chain surfaces.

Review details

Best possible solution:

Land the extraction as a narrow behavior-preserving refactor once the branch is refreshed and the focused ACP manager runtime-handle/runtime-config tests plus current CI stay green.

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

Not applicable; this PR is an internal refactor rather than a bug report. Behavior preservation is covered by source parity review and the existing focused ACP runtime-handle tests listed in the PR body.

Is this the best way to solve the issue?

Yes; extracting the cache owner is the narrow maintainable shape because it moves cohesive runtime-handle cache operations out of AcpSessionManager without adding a second protocol, config, or persistence path.

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against bb5b6f38f424.

Label changes

Label changes:

  • add P3: This is a low-risk internal cleanup/refactor with no intended user-visible behavior, config, protocol, or API change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The PR is maintainer-labeled and claims an internal-only refactor with no user-visible behavior change; the body lists focused local test/lint/typecheck proof for review context, but the external real-behavior gate is not applied here.

Label justifications:

  • P3: This is a low-risk internal cleanup/refactor with no intended user-visible behavior, config, protocol, or API change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The PR is maintainer-labeled and claims an internal-only refactor with no user-visible behavior change; the body lists focused local test/lint/typecheck proof for review context, but the external real-behavior gate is not applied here.
Evidence reviewed

PR surface:

Source +33. Total +33 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 2 238 205 +33
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 238 205 +33

What I checked:

  • Repository policy read: Root AGENTS.md was read fully and applied; no scoped AGENTS.md owns src/acp/control-plane, so the root core runtime/session review guidance applies. (AGENTS.md:1, bb5b6f38f424)
  • PR extraction surface: The PR head adds ManagerRuntimeHandleCache with cache size/has/get/set/clear, close, handle-match clearing, idle eviction, reusable-status probing, and handle/meta matching responsibilities. (src/acp/control-plane/manager.runtime-handle-cache.ts:19, 16d890e95a50)
  • Current-main parity source: Current main keeps the same runtime cache reuse, replacement close, unhealthy status eviction, idle eviction, and handle/meta matching inline inside AcpSessionManager; the PR delegates those operations to the extracted class. (src/acp/control-plane/manager.core.ts:1225, bb5b6f38f424)
  • Regression coverage surface: Existing focused tests cover repeated handle reuse, config-change re-ensure, dead-status re-ensure, persisted identity mismatch, restart rehydration, cwd updates, tolerated close failures, and idle eviction before max-concurrent enforcement. (src/acp/control-plane/manager.runtime-handles.test.ts:19, bb5b6f38f424)
  • Internal dependency contract checked: AcpRuntimeHandle, AcpRuntimeStatus, getStatus, and close are defined by internal acp-core runtime types, and the identity helper maps persisted ACP identity back to runtime handle identifiers used by the cache match checks. (packages/acp-core/src/runtime/types.ts:20, bb5b6f38f424)
  • Whitespace sanity: The PR diff against current main reports no git diff --check whitespace errors for the touched ACP files. (32799e094d01)

Likely related people:

  • SYU8384: Git history and blame show Syu authored the commit that introduced manager.core.ts and runtime-cache.ts, including the inline ACP runtime-handle cache behavior being extracted. (role: introduced behavior; confidence: high; commits: 63621eead219; files: src/acp/control-plane/manager.core.ts, src/acp/control-plane/runtime-cache.ts)
  • steipete: Peter Steinberger recently refactored/split ACP manager runtime-handle and runtime-config test coverage on current main, making him a strong routing candidate for this refactor. (role: recent area contributor; confidence: high; commits: f80a1e9e8517; files: src/acp/control-plane/manager.core.ts, src/acp/control-plane/manager.runtime-handles.test.ts, src/acp/control-plane/manager.runtime-config.test.ts)
  • Hex: The commit that introduced the ACP manager/runtime cache area lists Hex as a co-author, so they may have useful context if the cache semantics need review. (role: adjacent co-author; confidence: medium; commits: 63621eead219; files: src/acp/control-plane/manager.core.ts, src/acp/control-plane/runtime-cache.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels May 31, 2026
@steipete
steipete merged commit 058152c into main May 31, 2026
297 of 305 checks passed
@steipete
steipete deleted the refactor/acp-manager-runtime-handle-cache branch May 31, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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