Repository navigation
refactor: dedupe session-catalog cursor paging and sleep helper clones - #124569
Conversation
…on-catalog-runtime The acpx Pi and opencode session catalogs carried byte-identical boundedLimit/encodeCursor/decodeCursor/optionalRawCursor/transcriptPage scaffolding (~114 duplicated lines each). Move one canonical copy into the private-local session-catalog-runtime SDK subpath both plugins already may import, and keep the plugin-named cursor guards as direct aliases. Net -87 production LOC; no behavior change (error strings, cursor canonical form, and byte budgets are unchanged).
…elpers managed-linux readiness polling now uses @openclaw/retry sleepWithAbort with ref:false (preserving the clone's timer.unref behavior), and the embedded agent runner's async-task wait uses src/utils/sleep.ts. Both clones matched canonical semantics on real inputs (positive integer poll intervals). The update-managed-service-handoff copy stays: it lives inside a serialized standalone handoff script (String.raw template) that cannot import repo modules.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 16, 2026, 8:41 AM ET / 12:41 UTC. ClawSweeper reviewWhat this changesThe PR centralizes duplicated session-catalog cursor paging in a private plugin SDK runtime module and replaces two local delay helpers with canonical sleep utilities. Merge readinessKeep open for normal maintainer handling. Direct source review found no blocking correctness or security issue; current main has not absorbed this refactor, and the maintainer label prevents automated cleanup. Priority: P3 Review scores
Verification
How this fits togetherACPX and OpenCode session catalogs turn local session data into paged Gateway results. Managed desktop startup and embedded-agent task completion both use bounded waits while their runtime work progresses. flowchart LR
A[ACPX session catalog] --> C[Shared cursor paging]
B[OpenCode session catalog] --> C
C --> D[Gateway session results]
E[Desktop readiness poll] --> F[Abortable shared delay]
G[Embedded task polling] --> H[Canonical delay]
F --> I[Runtime lifecycle]
H --> I
Before merge
Agent review detailsSecurityNone. PR surfaceSource -96. Total -96 across 5 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep one private local runtime owner for shared paging and land once the exact-head maintainer review and checks are complete. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR is a behavior-neutral refactor; existing focused provider tests cover the moved paging behavior. Is this the best way to solve the issue? Yes: the pre-existing private SDK subpath is the narrow shared owner for two bundled callers, avoiding renewed provider-local copies. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 91a3b9ba5636. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
openclaw#124569) * refactor(plugin-sdk): dedupe session-catalog cursor paging into session-catalog-runtime The acpx Pi and opencode session catalogs carried byte-identical boundedLimit/encodeCursor/decodeCursor/optionalRawCursor/transcriptPage scaffolding (~114 duplicated lines each). Move one canonical copy into the private-local session-catalog-runtime SDK subpath both plugins already may import, and keep the plugin-named cursor guards as direct aliases. Net -87 production LOC; no behavior change (error strings, cursor canonical form, and byte budgets are unchanged). * refactor(core): replace private sleep() clones with canonical sleep helpers managed-linux readiness polling now uses @openclaw/retry sleepWithAbort with ref:false (preserving the clone's timer.unref behavior), and the embedded agent runner's async-task wait uses src/utils/sleep.ts. Both clones matched canonical semantics on real inputs (positive integer poll intervals). The update-managed-service-handoff copy stays: it lives inside a serialized standalone handoff script (String.raw template) that cannot import repo modules.
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.
What Problem This Solves
Two clusters of copy-pasted code were drifting hazards:
extensions/acpx/src/pi-session-catalog.tsandextensions/opencode/session-catalog.tseach carried ~114 byte-identical lines of session-catalog cursor paging scaffolding (boundedLimit/encodeCursor/decodeCursor/optionalRawCursor/transcriptPage). Any future paging fix would have to be applied twice, and the copies could silently diverge.src/gateway/desktop/managed-linux.tsandsrc/agents/embedded-agent-runner/run/attempt-async-tasks.tseach had a privatesleep()clone duplicating canonical helpers that already exist in the repo.Why This Change Was Made
The cursor-paging scaffolding moves into the existing private-local SDK subpath
src/plugin-sdk/session-catalog-runtime.ts(already listed inplugin-sdk-private-local-only-subpaths.jsonand already consumed by beam — no new public surface). Both plugins keep their plugin-named cursor guards as direct aliases, so error strings, cursor canonical form, and byte budgets are unchanged.The managed-linux readiness poll now uses
@openclaw/retrysleepWithAbortwithref: false(preserving the clone'stimer.unref()behavior), and the embedded agent runner's async-task wait usessrc/utils/sleep.ts. A thirdsleepcopy in the update-managed-service handoff script is intentionally kept: it lives inside a serialized standalone script (String.rawtemplate) that cannot import repo modules; noted in the commit body.User Impact
No user-visible behavior change. Behavior-neutral refactor: one canonical owner for session-catalog cursor paging and sleep semantics, net -96 production LOC, zero test lines touched.
Evidence
node scripts/run-vitest.mjs extensions/acpx/src/pi-session-catalog extensions/opencode/session-catalog src/gateway/desktop/managed-linux.test.ts src/agents/embedded-agent-runner/run/attempt.async-tasks.test.ts— 4 shards passed post-rebase (7 + 20 + 18 tests plus managed-linux suite, all green).plugin-sdk:surface:check(vianode --import tsx scripts/plugin-sdk-surface-report.mts --check) — clean,package-exported forbidden subpaths: 0.git diff --numstatvsorigin/main: production delta net -96 LOC (extensions -208/+34, core sleep sites -14/+5, +121 relocated canonical copy insrc/plugin-sdk/session-catalog-runtime.ts); no test files changed.