Skip to content

refactor: remove vestigial runtime indirection - #124554

Merged
steipete merged 2 commits into
mainfrom
steipete/vestigial-indirection-sweep
Aug 16, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/vestigial-indirection-sweep

Conversation

@steipete

@steipete steipete commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Several internal barrels, type-renaming bridges, and statically imported *.runtime.ts files no longer owned a real lazy or architectural boundary. They added extra files and mock targets while their only production consumers immediately re-exported or statically imported them. The command registry also repeated channel-adapter resolution and native-name normalization within one operation.

Why This Change Was Made

This removes only indirection that can be absorbed by the actual owner while preserving public Plugin SDK names exactly:

  • re-export channel message, ingress, and Slack runtime owners directly and delete their one-consumer internal barrels;
  • inline the voice-call plugin's exact config/runtime source types and delete its rename-only bridge;
  • delete five statically imported runtime pass-throughs: the unmocked models config seam, gateway token persistence via narrow production dependency injection, doctor memory helpers via the production handler factory, and both server-chat lifecycle seams via per-handler injection;
  • keep the three intentional mock seams whose clean injection would be broad or would weaken policy coverage: openclaw-tools.runtime.ts, server-node-events.runtime.ts, and tools-effective.runtime.ts;
  • return Promise<void> from prepareGatewayAgentCliShim() because production never reads its former path object;
  • resolve the native-command adapter once per listing/lookup operation and reuse one normalized name mapping;
  • keep prepared-model workspace plugin-root admission probing: it is the only authoritative negative proof for a requested workspace, and the source metadata snapshot cannot carry that fact for an arbitrary rebound workspace.

User Impact

No user-visible behavior or public export name changes. This is a net-negative internal cleanup that removes obsolete paths while keeping the lazy, plugin, command, session-lifecycle, and persistence ownership boundaries intact.

Evidence

  • Audit provenance: verified every named candidate against source, callers, tests, scoped repository rules, and relevant history from frozen base 96cacfdf74503baf1b9175b25f5a5aedb7b312b2; exact PR head 55a624e3df9d5b873fa1e86bb00f72cc459bd375.
  • Production LOC: +192/-348 (net -156). Tests: +75/-78 (net -3).
  • Focused Vitest:
    • channel SDK/access, command registry, CLI shim, models config, gateway token, and daemon install selections passed after correcting one explicit partial mock exposed by the removed seam;
    • src/commands/gateway-install-token.test.ts + src/commands/models/load-config.test.ts: 14 tests passed;
    • server chat/doctor/session/server-method selections: 442 tests passed;
    • full voice-call plugin plus touched Slack entrypoint/shared selections: 650 tests passed.
    • Slack runtime API contract guard: 7 tests passed after exact-head CI exposed and we updated its owner-direct export statement inventory.
  • pnpm build: passed on Blacksmith Testbox tbx_01m056ej7bb5ajfex8wk0x1b3b (wrapper exit 0, 3m58s; Actions run https://github.com/openclaw/openclaw/actions/runs/31945352719). No [INEFFECTIVE_DYNAMIC_IMPORT] diagnostics.
  • pnpm check:changed: passed on the same Testbox (wrapper exit 0, 17m05s), including format, Plugin SDK exports/surface, plugin boundaries, dead exports, core/extension/script/test typechecks, lint, import cycles, and database/runtime guards.
  • Testbox was stopped after proof.
  • Diff-scoped deslop: clean after import/comment normalization; no compatibility shims or speculative fallbacks added.
  • Codex autoreview: clean, no accepted/actionable findings.
  • Proof gap: no live-provider/channel run; the patch is behavior-neutral internal wiring and is covered at the owner and package/export boundaries above.

@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added channel: slack Channel integration: slack channel: voice-call Channel integration: voice-call gateway Gateway runtime cli CLI command changes commands Command implementations labels Aug 16, 2026
@steipete
steipete marked this pull request as ready for review August 16, 2026 12:14
@openclaw-barnacle openclaw-barnacle Bot added size: L maintainer Maintainer-authored PR labels Aug 16, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. labels Aug 16, 2026
@clawsweeper

clawsweeper Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 16, 2026, 8:28 AM ET / 12:28 UTC.

ClawSweeper review

What this changes

This PR deletes private runtime pass-through modules, imports their owners directly, and replaces test-only module mocks with narrow handler-level injection while preserving public plugin SDK exports.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

No blocking correctness or security finding was found. This maintainer-authored, maintainer-labeled cleanup should remain open for the in-progress exact-head lifecycle check and final maintainer review.

Priority: P3
Reviewed head: 55a624e3df9d5b873fa1e86bb00f72cc459bd375
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The net-negative refactor has coherent owner-boundary coverage and no concrete review finding; final lifecycle CI remains a workflow gate.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored behavior-neutral refactor is exempt from the external contributor proof gate; the PR body records focused owner-boundary and build validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored behavior-neutral refactor is exempt from the external contributor proof gate; the PR body records focused owner-boundary and build validation.
Evidence reviewed 6 items Command mapping remains operation-scoped: The mapper resolves the channel adapter once, then applies the same primary-name and alias normalization to both listing and lookup paths.
Gateway lifecycle dependencies retain production defaults: The handler defaults to the same lifecycle snapshot and persistence owners while allowing tests to inject narrow substitutes.
Public Slack runtime API is preserved: The public runtime API re-exports the same named capabilities from their individual owner files, and the contract guard records that inventory.
Findings None None.
Security None None.

How this fits together

Plugin SDK facades expose stable channel capabilities to plugins, while gateway and CLI modules connect commands and runtime state to OpenClaw services. The change removes private forwarding layers between those inputs and their existing runtime owners.

flowchart LR
  Plugins[Plugins and channels] --> SDK[Plugin SDK facades]
  Commands[Native command lookup] --> Registry[Command registry]
  Gateway[Gateway requests] --> Handlers[Gateway handlers]
  CLI[Gateway installation] --> Token[Token persistence]
  SDK --> Owners[Runtime owner modules]
  Registry --> Owners
  Handlers --> Owners
  Token --> Owners
Loading

Decision needed

Question Recommendation
After the exact-head lifecycle check succeeds, should this maintainer-owned cross-boundary cleanup be approved as the canonical replacement for the deleted private seams? Approve after lifecycle CI: Approve the refactor once check-sqlite-session-lifecycle passes on the reviewed head.

Why: The source evidence supports the refactor, but the PR is maintainer-labeled and its final exact-head lifecycle validation is not yet complete.

Before merge

  • Resolve merge risk (P1) - The supplied exact-head check rollup still reports check-sqlite-session-lifecycle in progress; it should pass before approval.
  • Complete next step (P2) - No mechanical repair is indicated; wait for the exact-head lifecycle check and maintainer approval of this maintainer-labeled cleanup.
Agent review details

Security

None.

PR surface

Source -156, Tests -3. Total -159 across 39 files.

View PR surface stats
Area Files Added Removed Net
Source 27 192 348 -156
Tests 12 75 78 -3
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 39 267 426 -159

Review metrics

Metric Value Why it matters
Production versus test LOC production +192/-348 (net -156); tests +75/-78 (net -3) The production change is net-negative while tests retain behavioral coverage at the owner boundaries.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/gateway/server-methods.ts, migration/backfill/repair: src/gateway/server-methods/doctor.test.ts, migration/backfill/repair: src/gateway/server-methods/doctor.ts, serialized state: src/infra/openclaw-cli-shim.test.ts, unknown-data-model-change: src/gateway/server-methods/doctor.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the net-negative owner-direct refactor once the exact-head lifecycle check succeeds and the maintainer confirms the remaining intentional runtime seams.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the net-negative owner-direct refactor once the exact-head lifecycle check succeeds and the maintainer confirms the remaining intentional runtime seams.

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

Not applicable: this PR refactors internal ownership and does not report a user-visible defect to reproduce.

Is this the best way to solve the issue?

Yes: deleting name-only private barrels while preserving public SDK facades and injecting only the test substitution points is the cleaner canonical boundary than retaining mock-only runtime files.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 66db70133b2c.

Labels

Label justifications:

  • P3: This is behavior-neutral internal cleanup with no reported user-facing regression.
  • 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: This maintainer-authored behavior-neutral refactor is exempt from the external contributor proof gate; the PR body records focused owner-boundary and build validation.

Evidence

What I checked:

  • Command mapping remains operation-scoped: The mapper resolves the channel adapter once, then applies the same primary-name and alias normalization to both listing and lookup paths. (src/auto-reply/commands-registry.ts:58, 55a624e3df9d)
  • Gateway lifecycle dependencies retain production defaults: The handler defaults to the same lifecycle snapshot and persistence owners while allowing tests to inject narrow substitutes. (src/gateway/server-chat.ts:437, 55a624e3df9d)
  • Public Slack runtime API is preserved: The public runtime API re-exports the same named capabilities from their individual owner files, and the contract guard records that inventory. (extensions/slack/runtime-api.ts:8, 55a624e3df9d)
  • Doctor loading remains deferred at the gateway router: The router still dynamically imports the doctor module and now constructs its handlers after that deferred import; the injected memory facade replaces only the deleted test seam. (src/gateway/server-methods.ts:97, 55a624e3df9d)
  • Current-main provenance: The directly replaced runtime barrels and command implementation are attributed to the current-main commit that established these paths, supporting steipete as the current-area routing owner. (src/gateway/server-methods.ts:97, 0c7b560b2346)
  • Validation supplied by the PR: The PR body reports focused owner-boundary tests, pnpm build, and pnpm check:changed on its exact head; the supplied check rollup still has check-sqlite-session-lifecycle in progress. (55a624e3df9d)

Likely related people:

  • steipete: Current-main blame attributes the central pre-refactor gateway, command, Slack, and voice-call paths to this contributor; they also own the coherent cleanup proposal. (role: recent area contributor; confidence: high; commits: 0c7b560b2346; files: src/gateway/server-methods.ts, src/auto-reply/commands-registry.ts, extensions/slack/runtime-api.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-16T12:20:17.082Z sha 5e7e3d2 :: needs maintainer review before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready review complete for 55a624e3df9d5b873fa1e86bb00f72cc459bd375.

  • ClawSweeper reviewed this exact head with no technical, correctness, or security findings. Its remaining P1 text was the then-in-progress check-sqlite-session-lifecycle workflow gate, not a technical finding; that exact-head check is now green. This completes the review's requested mitigation/rank-up move.
  • Owner decision: approve this maintainer-requested cleanup as the canonical replacement for the deleted private seams. The three broad intentional runtime mock seams and the workspace plugin-root admission proof remain, with reasons recorded in the PR body.
  • Exact-head CI: https://github.com/openclaw/openclaw/actions/runs/31946854962 — GREEN from node scripts/watch-pr-ci.mjs 124554 55a624e3df9d5b873fa1e86bb00f72cc459bd375.
  • Focused proof: channel SDK/access, command registry, CLI/config, gateway chat/doctor/session, full voice-call plugin, Slack entrypoints, and the Slack runtime API contract guard all passed. The contract guard was 7/7 after the first CI run correctly exposed its stale owner statement.
  • Heavy proof: pnpm build and pnpm check:changed passed on Blacksmith Testbox tbx_01m056ej7bb5ajfex8wk0x1b3b (Actions run https://github.com/openclaw/openclaw/actions/runs/31945352719; wrapper exits 0). Build emitted no [INEFFECTIVE_DYNAMIC_IMPORT] diagnostics. The Testbox was stopped.
  • Review gates: diff-scoped deslop clean; Codex autoreview clean after the source patch and again after the contract-guard update; native review artifacts validated READY FOR /prepare-pr with zero findings.
  • LOC: production +192/-348 (net -156); tests +75/-78 (net -3).
  • Known gap: no live-provider/channel run. This is behavior-neutral owner wiring, with owner/package/export boundaries covered by focused tests, build, check:changed, and exact-head CI.

@steipete
steipete merged commit f43544f into main Aug 16, 2026
192 checks passed
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete
steipete deleted the steipete/vestigial-indirection-sweep branch August 16, 2026 12:31
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 17, 2026
* refactor: remove vestigial indirection

* test: update Slack runtime API guard
karmafeast pushed a commit to karmaterminal/openclaw that referenced this pull request Aug 22, 2026
…ventory proof

Replays the Gate 3g stability half of openclaw#121204: isolate CLI boundary output
and expected CLI error routing, stabilize unit ordering, extend the
full-unit silence watchdog, and add the repository-scale tracked-path
inventory regression for check-temp-path-guardrails.

Two openclaw#121204 repairs are deliberately not replayed because current upstream
already fixed the same root causes more strongly:

- scripts/check-temp-path-guardrails.ts: openclaw#121204 bounded the ENOBUFS crash by
  adding maxBuffer to its local execFileSync git ls-files. Upstream openclaw#124554
  replaced that call site entirely with listRepoFilesSync, which already
  carries a bounded maxBuffer, a timeout, SIGKILL, and a filesystem fallback.
  Upstream's fix is kept and the now-dead GIT_LS_FILES_MAX_BUFFER_BYTES
  constant is not introduced. The added test asserts the behavior, not the
  literal, so it still proves the >1 MiB inventory path exits 0.
- extensions/google-meet/src/oauth.test.ts: openclaw#121204 made the timeout proof
  it.skipIf(!callbackPortAvailable), which skips the assertion whenever host
  port 8085 is busy. The composite base already fixes the same flake
  deterministically by binding a free port through the callbackPort seam, so
  the assertion always runs. The base fix is kept and the skip machinery
  (node:dns lookup, isCallbackPortAvailable, callbackPortAvailable) is
  dropped as dead. openclaw#121204's independent closeServer listening guard and
  closeAllConnections leak fix and its GOOGLE_MEET_CALLBACK_PORT constant are
  kept.

Provenance (openclaw#121204 authored commits): e175bf5 bf652e3 94287e2
ee3346d 3bf1ca1 c704dfa

Co-authored-by: Copilot <[email protected]>
karmafeast pushed a commit to karmaterminal/openclaw that referenced this pull request Aug 22, 2026
… tsx runner

Composite interaction between openclaw#121204 and current upstream. openclaw#121204's new
repository-scale inventory test spawned scripts/check-temp-path-guardrails.ts
with a bare process.execPath. That worked only incidentally: at openclaw#121204's base
the guard's import closure was node-resolvable. Upstream openclaw#124554 replaced its
local execFileSync git ls-files with listRepoFilesSync from
./check-file-utils.js, a relative TypeScript source specifier that plain Node
cannot resolve, so the child died with ERR_MODULE_NOT_FOUND and the test read
that crash as a guard failure.

The guard has always been a tsx entrypoint — package.json runs
`node --import tsx scripts/check-temp-path-guardrails.ts` — so the test now
launches it the same way instead of asserting against an import closure the
repo never promised. tsx is pre-resolved from this file because the child runs
with cwd set to the temporary repo, where a bare `--import tsx` would not
resolve.

The protected behavior is unchanged: a tracked inventory larger than Node's
1 MiB default child-process buffer must still exit 0.

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: slack Channel integration: slack channel: voice-call Channel integration: voice-call cli CLI command changes commands Command implementations gateway Gateway runtime 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: L 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