Skip to content

refactor: consume acpx runtime library#61495

Merged
osolmaz merged 28 commits into
openclaw:mainfrom
osolmaz:refactor/acpx-runtime-dedup
Apr 6, 2026
Merged

refactor: consume acpx runtime library#61495
osolmaz merged 28 commits into
openclaw:mainfrom
osolmaz:refactor/acpx-runtime-dedup

Conversation

@osolmaz

@osolmaz osolmaz commented Apr 5, 2026

Copy link
Copy Markdown
Member

Summary

  • switch the bundled ACPX plugin to consume acpx/runtime instead of carrying a forked embedded runtime implementation
  • pin extensions/acpx to ACPX commit a5ed49269cd0b97e651a11fa0af0d95a9a4a3193 and allow its build scripts in the workspace install policy
  • delete the duplicated ACP runtime implementation from extensions/acpx/src now that ACPX is the source of truth

Paired PR

Validation

  • pnpm install
  • pnpm test:extension acpx
  • pnpm build
  • pnpm check still fails in unrelated repo-wide tsgo surfaces outside extensions/acpx (for example extensions/anthropic/index.test.ts, src/plugins/*.test.ts, src/gateway/server-methods/chat.ts), so it is not a clean signal for this branch

Notes

  • OpenClaw used the local ACPX build temporarily during development; this PR pins to the pushed ACPX commit for review and CI
  • the OpenClaw ACPX plugin is now a thin consumer seam over the public ACPX runtime surface

osolmaz commented Apr 5, 2026

Copy link
Copy Markdown
Member Author

Validation update on current head c27199ddf0dee293d06a5920063efa23b5ae76aa.

Implemented:

  • switched the bundled ACPX plugin to consume acpx/runtime
  • removed duplicated embedded ACP runtime modules from extensions/acpx/src
  • preserved cross-package ACP runtime error-code handling in core
  • added legacy session migration so existing openclaw.acpx.session.v1 files are rewritten into acpx.session.v1 before runtime startup
  • fixed the follow-up TypeScript issue in extensions/acpx/src/legacy-session-migration.ts by importing Dirent from node:fs

Local validation run:

  • pnpm test extensions/acpx/src/service.test.ts src/acp/runtime/errors.test.ts extensions/acpx/src/legacy-session-migration.test.ts -> passed (4 files, 11 tests)
  • pnpm test:extension acpx -> passed (11 files, 52 tests)
  • pnpm build -> passed
  • pnpm check -> still fails, but only in untouched upstream files outside this PR diff. The ACPX-related error in extensions/acpx/src/legacy-session-migration.ts is fixed.

Review/comment status:

  • checked PR issue comments and review threads after the latest push; none are present right now
  • reran codex review --base main after the latest push; no new actionable PR-thread feedback surfaced before the review process fell back into long full-diff analysis

Current blocker:

  • this PR is still draft because my account cannot execute MarkPullRequestReadyForReview on openclaw/openclaw
  • because the PR remains draft, the current-head GitHub CI jobs are skipped by workflow gating, so I cannot get green CI on this PR from this account alone

Once a maintainer marks this PR ready for review, CI should run on the current head.

osolmaz commented Apr 5, 2026

Copy link
Copy Markdown
Member Author

Final report for current head 77181ca30058b13d57ae69ae91963b9f77b65b13.

Implemented:

  • repinned extensions/acpx to ACPX head 1b56415b1927cde4c1593cb0b9125af4c203e1ad, which contains the completed ACPX dedup plus the follow-up source-layout cleanup
  • kept the bundled ACPX plugin as a thin consumer of acpx/runtime, with legacy session migration and cross-package ACP runtime error handling intact
  • local workspace validation is using the local ACPX checkout temporarily as requested: extensions/acpx/node_modules/acpx resolves to /home/bob/repos/acpx, so local OpenClaw runs are exercising the local ACPX build while the PR still carries the commit pin for mergeability

Validation run on this head:

  • pnpm install --filter ./extensions/acpx -> passed
  • pnpm test extensions/acpx/src/service.test.ts extensions/acpx/src/legacy-session-migration.test.ts src/acp/runtime/errors.test.ts -> passed (4 files, 11 tests)
  • pnpm test:extension acpx -> passed (11 files, 52 tests)
  • pnpm build -> passed
  • pnpm check -> still fails, but only in unrelated upstream surfaces outside this PR diff, including extensions/anthropic/index.test.ts, extensions/google/provider-models.test.ts, extensions/lobster/src/lobster-tool.test.ts, src/gateway/server-methods/chat.ts, and other pre-existing src/plugins / src/agents typing churn

Review/comment status:

  • reran codex review --base main; it again spent its time in broad full-diff exploration and did not surface any concrete P0/P1 findings or post any PR comments
  • checked both PR issue comments and inline review comments after the latest push; there are still no external comments to address

CI status:

  • this PR is still draft because my account cannot execute MarkPullRequestReadyForReview on openclaw/openclaw
  • because the PR remains draft, the current-head GitHub CI jobs are skipped by workflow gating; the always-on lightweight jobs pass, while the gated jobs (check, check-additional, build-smoke, install-smoke, extension-fast, and related matrix jobs) are all skipped on this head

Remaining blocker:

  • a maintainer needs to mark this PR ready for review before current-head CI can run on this branch.

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord channel: telegram Channel integration: telegram labels Apr 6, 2026
@osolmaz
osolmaz marked this pull request as ready for review April 6, 2026 11:22
@greptile-apps

greptile-apps Bot commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR replaces the duplicated ACP runtime implementation inside extensions/acpx/src/ with a thin re-export shim over the published [email protected] npm package, and wires up channel-plugin shouldTreatDeliveredTextAsVisible hooks for Discord and Telegram to replace hardcoded channel logic in the ACP dispatch path. The package is correctly pinned to a published release (not a GitHub commit), the temporary build-script allowlist for acpx was already cleaned up, and the runtime-internals/ directory correctly retains OpenClaw-specific helpers not covered by the upstream package.

Confidence Score: 5/5

Clean refactoring PR that removes duplicated runtime code; no new logic or risk introduced.

All findings are P2 or lower. The package version is correctly set to [email protected] (a published release, not a GitHub commit), the temporary build-script allowlist was properly removed in a prior commit, import boundaries are respected, and the behavioral changes to channel visibility tracking appear intentional and well-contained.

No files require special attention.

Reviews (1): Last reviewed commit: "Merge branch 'main' into refactor/acpx-r..." | Re-trigger Greptile

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fcea7cdd70

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/channels/plugins/types.adapters.ts
Comment thread src/auto-reply/reply/dispatch-acp-delivery.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 82b6d37c36

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread extensions/acpx/src/runtime.ts Outdated
Comment on lines +30 to +31
if (normalized && freshSessionKeys.delete(normalized)) {
return undefined;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve discard marker until a fresh session is saved

The reset wrapper clears the freshSessionKeys marker on the very first load, before a new record is persisted. If /new or /reset triggers discardPersistentState, and the next session initialization fails transiently (for example backend init fails before save), retries will fall back to the old persisted session because the marker is already consumed while the stale record is still on disk. This can silently reopen the pre-reset conversation after a failed reset attempt; keep the discard state active until a successful save (or remove the old record) so reset behavior remains durable across retries.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a0aabc2199

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/acp/control-plane/manager.core.ts Outdated
Comment on lines +1282 to +1283
const runtimeBackend = this.deps.requireRuntimeBackend(configuredBackend || undefined);
await runtimeBackend.runtime.prepareFreshSession?.({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid throwing lookup in reset backend-unavailable recovery

closeSession is supposed to tolerate unavailable backends when allowBackendUnavailable is true (the reset path in resetAcpSessionInPlace sets this), but this recovery branch re-calls requireRuntimeBackend, which itself throws on missing/unhealthy backends. When /new/reset runs while the ACP backend is missing or unhealthy, this secondary throw escapes and turns a best-effort close into a hard failure, so the reset flow aborts instead of continuing with reinitialization.

Useful? React with 👍 / 👎.

Comment on lines +50 to +54
mcpServers: toAcpMcpServers(params.pluginConfig.mcpServers),
permissionMode: params.pluginConfig.permissionMode,
nonInteractivePermissions: params.pluginConfig.nonInteractivePermissions,
timeoutMs:
params.pluginConfig.timeoutSeconds != null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pass retained ACPX config knobs through to runtime

createDefaultRuntime now builds a narrowed options object for AcpxRuntime, but it no longer forwards config knobs that are still part of the plugin contract (queueOwnerTtlSeconds and strictWindowsCmdWrapper are still parsed/resolved in extensions/acpx/src/config.ts). After this refactor those user-provided settings silently become no-ops and behavior falls back to package defaults, which is a regression for installations that tuned those values.

Useful? React with 👍 / 👎.

@osolmaz
osolmaz merged commit 154a7ed into openclaw:main Apr 6, 2026
8 checks passed
@osolmaz
osolmaz deleted the refactor/acpx-runtime-dedup branch April 6, 2026 13:51
@osolmaz

osolmaz commented Apr 6, 2026

Copy link
Copy Markdown
Member Author

Landed without landpr, forgive me

steipete pushed a commit to leoleedev/openclaw that referenced this pull request Apr 6, 2026
* refactor: consume acpx runtime library

* refactor: remove duplicated acpx runtime files

* fix: update acpx runtime dependency

* fix: preserve acp runtime error codes

* fix: migrate legacy acpx session files

* fix: update acpx runtime dependency

* fix: import Dirent from node fs

* ACPX: repin shared runtime engine

* ACPX: repin runtime semantics fixes

* ACPX: repin runtime contract cleanup

* Extensions: repin ACPX after layout refactor

* ACPX: drop legacy session migration

* ACPX: drop direct ACP SDK dependency

* Discord ACP: stop duplicate direct fallback replies

* ACP: rename delivered text visibility hook

* ACPX: pin extension to 0.5.0

* Deps: drop stale ACPX build-script allowlist

* ACPX: add local development guidance

* ACPX: document temporary pnpm exception flow

* SDK: preserve legacy ACP visibility hook

* ACP: keep reset commands on local path

* ACP: make in-place reset start fresh session

* ACP: recover broken bindings on fresh reset

* ACP: defer fresh reset marker until close succeeds

* ACP: reset bound sessions fresh again

* Discord: ensure ACP bindings before /new

* ACP: recover missing persistent sessions
Mlightsnow pushed a commit to Mlightsnow/openclaw that referenced this pull request Apr 6, 2026
* refactor: consume acpx runtime library

* refactor: remove duplicated acpx runtime files

* fix: update acpx runtime dependency

* fix: preserve acp runtime error codes

* fix: migrate legacy acpx session files

* fix: update acpx runtime dependency

* fix: import Dirent from node fs

* ACPX: repin shared runtime engine

* ACPX: repin runtime semantics fixes

* ACPX: repin runtime contract cleanup

* Extensions: repin ACPX after layout refactor

* ACPX: drop legacy session migration

* ACPX: drop direct ACP SDK dependency

* Discord ACP: stop duplicate direct fallback replies

* ACP: rename delivered text visibility hook

* ACPX: pin extension to 0.5.0

* Deps: drop stale ACPX build-script allowlist

* ACPX: add local development guidance

* ACPX: document temporary pnpm exception flow

* SDK: preserve legacy ACP visibility hook

* ACP: keep reset commands on local path

* ACP: make in-place reset start fresh session

* ACP: recover broken bindings on fresh reset

* ACP: defer fresh reset marker until close succeeds

* ACP: reset bound sessions fresh again

* Discord: ensure ACP bindings before /new

* ACP: recover missing persistent sessions
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
* refactor: consume acpx runtime library

* refactor: remove duplicated acpx runtime files

* fix: update acpx runtime dependency

* fix: preserve acp runtime error codes

* fix: migrate legacy acpx session files

* fix: update acpx runtime dependency

* fix: import Dirent from node fs

* ACPX: repin shared runtime engine

* ACPX: repin runtime semantics fixes

* ACPX: repin runtime contract cleanup

* Extensions: repin ACPX after layout refactor

* ACPX: drop legacy session migration

* ACPX: drop direct ACP SDK dependency

* Discord ACP: stop duplicate direct fallback replies

* ACP: rename delivered text visibility hook

* ACPX: pin extension to 0.5.0

* Deps: drop stale ACPX build-script allowlist

* ACPX: add local development guidance

* ACPX: document temporary pnpm exception flow

* SDK: preserve legacy ACP visibility hook

* ACP: keep reset commands on local path

* ACP: make in-place reset start fresh session

* ACP: recover broken bindings on fresh reset

* ACP: defer fresh reset marker until close succeeds

* ACP: reset bound sessions fresh again

* Discord: ensure ACP bindings before /new

* ACP: recover missing persistent sessions
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
* refactor: consume acpx runtime library

* refactor: remove duplicated acpx runtime files

* fix: update acpx runtime dependency

* fix: preserve acp runtime error codes

* fix: migrate legacy acpx session files

* fix: update acpx runtime dependency

* fix: import Dirent from node fs

* ACPX: repin shared runtime engine

* ACPX: repin runtime semantics fixes

* ACPX: repin runtime contract cleanup

* Extensions: repin ACPX after layout refactor

* ACPX: drop legacy session migration

* ACPX: drop direct ACP SDK dependency

* Discord ACP: stop duplicate direct fallback replies

* ACP: rename delivered text visibility hook

* ACPX: pin extension to 0.5.0

* Deps: drop stale ACPX build-script allowlist

* ACPX: add local development guidance

* ACPX: document temporary pnpm exception flow

* SDK: preserve legacy ACP visibility hook

* ACP: keep reset commands on local path

* ACP: make in-place reset start fresh session

* ACP: recover broken bindings on fresh reset

* ACP: defer fresh reset marker until close succeeds

* ACP: reset bound sessions fresh again

* Discord: ensure ACP bindings before /new

* ACP: recover missing persistent sessions
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
* refactor: consume acpx runtime library

* refactor: remove duplicated acpx runtime files

* fix: update acpx runtime dependency

* fix: preserve acp runtime error codes

* fix: migrate legacy acpx session files

* fix: update acpx runtime dependency

* fix: import Dirent from node fs

* ACPX: repin shared runtime engine

* ACPX: repin runtime semantics fixes

* ACPX: repin runtime contract cleanup

* Extensions: repin ACPX after layout refactor

* ACPX: drop legacy session migration

* ACPX: drop direct ACP SDK dependency

* Discord ACP: stop duplicate direct fallback replies

* ACP: rename delivered text visibility hook

* ACPX: pin extension to 0.5.0

* Deps: drop stale ACPX build-script allowlist

* ACPX: add local development guidance

* ACPX: document temporary pnpm exception flow

* SDK: preserve legacy ACP visibility hook

* ACP: keep reset commands on local path

* ACP: make in-place reset start fresh session

* ACP: recover broken bindings on fresh reset

* ACP: defer fresh reset marker until close succeeds

* ACP: reset bound sessions fresh again

* Discord: ensure ACP bindings before /new

* ACP: recover missing persistent sessions
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* refactor: consume acpx runtime library

* refactor: remove duplicated acpx runtime files

* fix: update acpx runtime dependency

* fix: preserve acp runtime error codes

* fix: migrate legacy acpx session files

* fix: update acpx runtime dependency

* fix: import Dirent from node fs

* ACPX: repin shared runtime engine

* ACPX: repin runtime semantics fixes

* ACPX: repin runtime contract cleanup

* Extensions: repin ACPX after layout refactor

* ACPX: drop legacy session migration

* ACPX: drop direct ACP SDK dependency

* Discord ACP: stop duplicate direct fallback replies

* ACP: rename delivered text visibility hook

* ACPX: pin extension to 0.5.0

* Deps: drop stale ACPX build-script allowlist

* ACPX: add local development guidance

* ACPX: document temporary pnpm exception flow

* SDK: preserve legacy ACP visibility hook

* ACP: keep reset commands on local path

* ACP: make in-place reset start fresh session

* ACP: recover broken bindings on fresh reset

* ACP: defer fresh reset marker until close succeeds

* ACP: reset bound sessions fresh again

* Discord: ensure ACP bindings before /new

* ACP: recover missing persistent sessions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord channel: telegram Channel integration: telegram extensions: acpx maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants