Skip to content

refactor: add acpx runtime embedding API#220

Merged
dutifulbob merged 11 commits into
mainfrom
refactor/runtime-api-dedup
Apr 5, 2026
Merged

refactor: add acpx runtime embedding API#220
dutifulbob merged 11 commits into
mainfrom
refactor/runtime-api-dedup

Conversation

@osolmaz

@osolmaz osolmaz commented Apr 5, 2026

Copy link
Copy Markdown
Member

Summary

  • add a supported acpx/runtime embedding API for ACPX-backed session runtime usage
  • move the reusable ACP runtime manager, reconnect, probe, handle, and file-backed session store logic into ACPX
  • add ACPX-native runtime tests covering the new public runtime surface

Validation

  • pnpm run format:check
  • pnpm run typecheck
  • pnpm run lint
  • pnpm run build
  • pnpm run test
  • pnpm run test:coverage still fails on main too with the existing repo-wide baseline summary (# all files | 41.14 | 71.45 | 42.68), so it is not introduced by this branch

Notes

  • paired OpenClaw consumer PR will pin to commit a5ed49269cd0b97e651a11fa0af0d95a9a4a3193
  • this PR is the source-of-truth runtime library side of the cross-repo dedup refactor

@dutifulbob
dutifulbob marked this pull request as ready for review April 5, 2026 20:03

osolmaz commented Apr 5, 2026

Copy link
Copy Markdown
Member Author

Validation update on current head 6024ac80fb216ff358dec38030f6892b9721b30e.

Implemented:

  • added the supported acpx/runtime embedding API
  • exposed the runtime contract, runtime manager, reconnect logic, probe surface, file session store, handle-state helpers, and typed runtime errors through that public entrypoint
  • fixed startup-window control/cancel behavior in the runtime manager so same-turn controls wait for load fallback resolution and pre-prompt aborts do not leak into a prompt run

Local validation run:

  • pnpm run typecheck -> passed
  • pnpm run build:test -> passed
  • node --test dist-test/test/runtime-manager.test.js -> passed
  • pnpm run build -> passed
  • pnpm run lint -> passed
  • pnpm run format:check -> passed
  • pnpm run test -> passed (511 tests)
  • codex review --base main was rerun after the latest push; no actionable PR-thread feedback is present

GitHub status:

  • PR is now ready for review
  • current-head CI is green
  • checked PR issue comments and review threads after the latest push; none are present right now

osolmaz commented Apr 5, 2026

Copy link
Copy Markdown
Member Author

Final report for current head 1b56415b1927cde4c1593cb0b9125af4c203e1ad.

Implemented:

  • finished the ACPX source-layout cleanup on top of the dedup so the shared ACP runtime code now lives under src/runtime/engine, the public embedding surface lives under src/runtime/public, the CLI wrapper lives under src/cli/session, persisted session code lives under src/session, and ACP client code lives under src/acp
  • removed the old duplicate/shim layout files such as src/runtime/lifecycle.ts, src/runtime/reconnect.ts, src/session-runtime/connect-load.ts, and src/session-runtime/lifecycle.ts
  • kept the CLI and acpx/runtime on the same shared engine after the move by carrying forward the shared reconnect, lifecycle, connected-session, and session-options logic
  • fixed the moved-file follow-ups so the shared controller surface still supports setSessionModel, setSessionConfigOption returns its typed response again, and the stale persistence/test import paths now point at the new layout

Validation run on this head:

  • pnpm run typecheck -> passed
  • pnpm run format:check -> passed
  • pnpm run lint -> passed
  • pnpm run test -> passed (508 tests)
  • pnpm run build -> passed
  • pnpm run viewer:typecheck -> passed
  • pnpm run viewer:build -> passed
  • pnpm run build:test && node --test dist-test/test/session-persistence.test.js dist-test/test/queue-ipc.test.js -> passed (11 tests)

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:

  • current-head ACPX CI is green (scope, Format, Typecheck, Lint, Build, Conformance Smoke, and Test passed; Docs skipped)

Paired OpenClaw consumer head is 77181ca30058b13d57ae69ae91963b9f77b65b13 on openclaw/openclaw#61495 .

osolmaz commented Apr 5, 2026

Copy link
Copy Markdown
Member Author

Final report for current head 9ebc52ffa44ca4d1c342b0a680877783059ac503.

Implemented:

  • finished the ACPX source-layout cleanup so ownership now matches the actual subsystem boundaries: ACP client code under src/acp, CLI/session wrapper code under src/cli, shared runtime engine under src/runtime/engine, public embedding surface under src/runtime/public, and persisted session state under src/session
  • split the remaining large mixed-responsibility areas into focused modules, including new ACP helpers (src/acp/agent-command.ts, src/acp/client-process.ts, src/acp/auth-env.ts, src/acp/session-control-errors.ts), CLI command wiring (src/cli/command-handlers.ts, src/cli/command-registration.ts), CLI session helpers (src/cli/session/contracts.ts, src/cli/session/session-management.ts, src/cli/session/session-control.ts, src/cli/session/queue-owner-runtime.ts), and flow runtime support (src/flows/runtime-support.ts)
  • removed the old top-level leftovers and renamed shared helpers into neutral homes, including src/config.ts -> src/cli/config.ts, src/terminal.ts -> src/acp/terminal-manager.ts, and src/session-runtime-helpers.ts -> src/async-control.ts
  • fixed the coverage harness leak by clearing NODE_V8_COVERAGE from the pnpm exec tsx scripts/perf-report.ts subprocess used in test/integration.test.ts, so pnpm run test:coverage now measures this repo instead of Corepack/pnpm internals

Validation on this head:

  • pnpm run check -> passed
  • pnpm run check:docs -> passed
  • node dist/cli.js --approve-all --timeout 120 claude exec "Reply with exactly CLAUDE_OK and nothing else." -> passed (CLAUDE_OK)
  • node dist/cli.js --approve-all --timeout 120 codex exec "Reply with exactly CODEX_OK and nothing else." -> passed (CODEX_OK)

Review/comment status:

  • reran codex review --base main on this pushed head; it spent the run in broad full-diff exploration and local validation and did not surface any concrete P0/P1 findings or create 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:

  • current-head GitHub checks are green: scope, Docs, Format, Typecheck, Lint, Build, Conformance Smoke, and Test

What I did not test locally:

  • persistent named-session smoke after this layout-only cleanup
  • OpenClaw consumer-path verification in the paired repo as part of this ACPX-only follow-up

@dutifulbob dutifulbob self-assigned this Apr 5, 2026
@dutifulbob
dutifulbob merged commit be510ba into main Apr 5, 2026
8 checks passed
@dutifulbob
dutifulbob deleted the refactor/runtime-api-dedup branch April 5, 2026 22:52

osolmaz commented Apr 5, 2026

Copy link
Copy Markdown
Member Author

Landed via temp rebase onto main.

Validation:

  • pnpm run check
  • pnpm run check:docs
  • node dist/cli.js --approve-all --timeout 120 claude exec "Reply with exactly CLAUDE_OK and nothing else."
  • node dist/cli.js --approve-all --timeout 120 codex exec "Reply with exactly CODEX_OK and nothing else."
  • current-head GitHub checks green

SHAs:

  • land head: b129a22ec71f283d4dfe56abd55eda2b30a31043
  • merge commit: be510ba918d4f64b1799e6bed683032f5a9d6766

Thanks @osolmaz.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants