Repository navigation
refactor(acpx): reuse operation session snapshot - #120924
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 9, 2026, 2:46 AM ET / 06:46 UTC. ClawSweeper reviewWhat this changesThe PR makes each modern ACPX handle operation reuse one loaded session record and command snapshot so lease checks occur before managed-tools delegate caching. Merge readinessNo concrete defect was found in the wrapper refactor, but the required direct ACPX and sibling Codex contract checks cannot be completed in this checkout; this protected maintainer PR needs a human merge decision after that evidence is available. Priority: P2 Review scores
Verification
How this fits togetherACPX is OpenClaw’s wrapper around the ACP runtime for persisted agent sessions. A handle operation reads its session record, applies gateway lease rules where needed, and then sends the operation to the selected runtime delegate. flowchart LR
A[ACPX handle request] --> B[Load session record]
B --> C[Build operation snapshot]
C --> D{Lease-sensitive operation?}
D -->|Yes| E[Validate gateway lease]
D -->|No| F[Use non-lease path]
E --> G[Resolve runtime delegate]
F --> G
G --> H[ACPX runtime operation]
Decision needed
Why: Repository policy expressly requires those direct sources for a Codex-related merge or proof verdict, and this read-only environment cannot retrieve them. Before merge
Agent review detailsSecurityNone. PR surfaceSource +8, Tests +71. Total +79 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the single wrapper-local snapshot boundary, then complete direct ACPX and Codex source inspection and exact-head validation before merging. Do we have a high-confidence way to reproduce the issue? Yes, at source level: the added focused tests exercise foreign-lease rejection and snapshot reuse, but no independent current-head runtime execution was possible here. Is this the best way to solve the issue? Unclear: the wrapper-local snapshot is the cleanest owner boundary found, but its fit with ACPX mutation reloads and Codex semantics needs the required direct contract review. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against dba99b355b4e. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
Maintainer contract review completed for the unchanged head I directly inspected the pinned The contracts agree with this patch:
Therefore I accept the session-state merge risk and consider the ClawSweeper dependency-inspection blocker resolved. The optional rank-up move is satisfied by the cited maintainer inspection; no code change or new head is required. |
|
Exact-head landing proof for
The latest ClawSweeper review found no concrete code defect. Peter's owner decision completed the requested direct contract inspection, accepted the session-state merge risk, and resolved the only remaining review item on this unchanged head. |
|
Merged via squash.
|
What Problem This Solves
Modern ACPX handle operations could reload the wrapper session record while separately resolving the agent command and managed-tools delegate. That split ownership made one logical operation observe more than one record snapshot and allowed a foreign-gateway lease rejection to occur only after a per-session delegate had already been cached.
Why This Change Was Made
The OpenClaw ACPX wrapper now loads one record-and-command snapshot per modern handle operation. Lease-owning
startTurn, mode, config, and close operations validate and retain the process lease before resolving the managed-tools delegate; status and cancel keep their intentionally non-lease semantics. Upstream[email protected]remains the mutation owner and continues its mutation-timerequireRecordreloads.The production diff is +83/-75 (net +8). That small growth establishes the explicit operation-snapshot ownership boundary and removes the older repeated command/delegate resolution paths. The legacy
runTurncompatibility adapter remains excluded from the one-snapshot contract pending its separate removal path.User Impact
Operators get consistent ACPX wrapper routing for each modern handle operation, and a record leased by another Gateway is rejected without leaking a managed-tools delegate into the session cache. There is no new configuration or user-facing command surface.
Evidence
tbx_01kzjdax5jm34genfs3htvvx68.192885c4e811and heada085994b70c27a6724892faa79eb6da74cea213bcomparison shows this PR changes onlyextensions/acpx/src/runtime.tsandextensions/acpx/src/runtime.test.ts; later path-scoped checks passed.[email protected]runtime and type contract, including mutation-time record reloads.Direct dependency and sibling runtime inspection
The required source contracts were inspected directly rather than inferred from OpenClaw wrappers:
[email protected]resolves the authoritative record again when a turn actually starts (prepareRuntimeTurn), and independently reloads for status, mode, config, and close mutation boundaries. Its cancel path intentionally targets only the active controller. Seemanager.ts:938-951,manager.ts:1303-1345, andmanager.ts:1348-1402. The wrapper snapshot therefore prepares routing and lease facts without replacing dependency-owned mutation validation.turn/startis keyed bythreadIdand loads that thread before submitting input;turn/interruptvalidates the requested activeturnIdagainst per-thread state. Seeturn.rs:71-99,turn_processor.rs:474-503,turn_processor.rs:1409-1450, andthread_state.rs:92-104. This patch does not alter Codex thread/turn identity or cancellation semantics; it only makes OpenClaw's wrapper-local delegate and lease selection consume one consistent snapshot.