Skip to content

refactor: remove retired runtime code and duplicate helpers - #151973

Merged
steipete merged 5 commits into
mainfrom
codex/deslop-prod-2k
Sep 18, 2026
Merged

steipete merged 5 commits into
mainfrom
codex/deslop-prod-2k

Conversation

@steipete

@steipete steipete commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Retired runtime paths, duplicate implementations, and repeated type declarations increased the maintenance cost of agent execution, session checkpoints, provider setup, and native apps.

User Impact

Removes 2,032 net production lines, excluding tests/support, docs, and generated output. Existing behavior, stored-data formats, public SDK exports, and execution authority checks remain intact.

Why This Change Was Made

Removes the private agent event-stream facade, retired checkpoint mutation/factory paths, native code whose callers moved to the Dashboard or host worker, and unused internal wrappers. Provider credential capture/persistence and rich-message measurement share their existing owners. ACP, MCP, and tool factories reuse canonical types with unchanged expanded properties and emitted JavaScript. Redundant import/re-export bindings preserve exports and initialization order.

The compatibility audit retained three helpers still exposed through the deprecated public SDK and dropped two proposed public helper extractions. No SDK surface budget, storage schema, retention, or permission changes are required. Configuration names/defaults, original SecretRef values, checkpoint serialization, and legacy checkpoint reads stay unchanged. The memory-wiki edit consolidates Gateway registration; its data access and update owners are unchanged. Schema guards, provider/auth tests, checkpoint tests, and the five fault/recovery cases provide compatibility proof; no migration or operator action is needed.

Tests use the active owners. The library lazy-import guard now parses runtime module references after TypeScript erasure. UI record fixtures import their pure helper directly, keeping Gateway storage modules out of jsdom. The compaction crash fixture now intercepts the retained checkpoint function, waits for recovery of the exact interrupted cron occurrence, and disables unrelated Activity recap inference through its existing fixture configuration.

Evidence

  • 1,726 focused tests across 45 files passed, with additional proof for the final MCP/native boundary, provider drift, Telegram delivery, interruption handling, and fixture repairs. All 469 Telegram tests passed; the final rich-block rerun passed 85 tests.
  • All five built-Gateway compaction scenarios passed, covering native failure, crash/restart, substituted writers, revoked writers, and successful successors. Synthetic provider/app-server; real isolated Gateway and SQLite state. Every child process joined with no cleanup errors.
  • An isolated current-main reproduction failed with the original UI fixture imports; the exact import-only cutover then passed all 17 affected unit files / 1,391 tests under CI’s UI configuration. Every assertion and test body is unchanged.
  • SDK surface tests passed (10 tests). The API diff has no public entrypoint or exported-name additions/removals; expanded tool option contracts and runtime JavaScript are preserved.
  • Production build, macOS app/native-test compilation, Swift lint, localization verification, core/UI/test typechecks, dead-export scan, import-cycle checks, and selected guards passed. The final type-only consolidations preserve emitted JavaScript; independent P0–P2 review is clean.
  • Four alternating benchmark pairs on the refreshed base preserved exact rendered inputs and delivery payloads. Prepared-block planning medians: nested lists 0.288 → 0.275 ms (−4.4%), mixed content 0.500 → 0.473 ms (−5.3%), tables 0.0789 → 0.0781 ms. Mixed-content round ranges do not overlap; nested/table ranges do. Full Markdown rendering/planning medians were 0.3–2.5% higher with overlapping ranges.

Exact-head CI passed for 9b2ee030fc5485618d592a2feb85c505af4e210c. CI exposed the regex guard error and an upstream fixture-barrel regression; both repairs passed focused reproduction, typechecking, lint, and independent review. Production code and the measured implementation are unchanged by these test fixes.

There is no end-to-end Telegram latency or memory-saving claim. Native runtime coverage runs in disposable CI, rather than on an operator desktop.

@steipete steipete self-assigned this Sep 18, 2026
@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: tlon Channel integration: tlon channel: whatsapp-web Channel integration: whatsapp-web app: ios App: ios app: macos App: macos app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes commands Command implementations agents Agent runtime and tooling channel: twitch Channel integration: twitch extensions: cloudflare-ai-gateway extensions: xiaomi extensions: stepfun extensions: memory-wiki extensions: xai extensions: zai plugin: pixverse plugin: workboard labels Sep 18, 2026
@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 18, 2026, 4:19 PM ET / 20:19 UTC (Revision 6).

ClawSweeper review

What this changes

Removes unused runtime and native code, consolidates provider credential handling and Telegram message measurement, and moves internal callers and tests onto existing owners.

Merge readiness

⛔ Blocked before merge - 2 items remain

Useful maintainer-owned cleanup remains absent from current main. No blocking correctness defect was found, and the prior generic upgrade concern is not supported by the introduced changes.

Priority: P3
Reviewed head: 9b2ee030fc5485618d592a2feb85c505af4e210c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful cleanup with preserved contracts, focused validation, successful CI for the reviewed head, and no blocking findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository context identifies maintainer-owned work, and the diff introduces no material authority change requiring the exceptional proof gate. Reported built-Gateway recovery scenarios exercise the retained checkpoint owner; synthetic provider/app-server coverage is not live-provider or native-app proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository context identifies maintainer-owned work, and the diff introduces no material authority change requiring the exceptional proof gate. Reported built-Gateway recovery scenarios exercise the retained checkpoint owner; synthetic provider/app-server coverage is not live-provider or native-app proof.
Evidence reviewed 11 items Introduced-change identity: Inspected the local merge-base-to-head diff rather than endpoint drift. The recorded test merge has the pinned base followed by the exact reviewed head as its parents.
Checkpoint ownership and compatibility: The removed factory returned the same functions now called directly. Checkpoint serialization, legacy snapshot handling, and the captured authority assertion passed into the persistence commit remain intact; no storage migration is introduced.
Provider credential preservation: The shared capture helper retains the original SecretRef input, storage mode, and workspace context. Persistence skips profile-sourced credentials and uses the existing locked writer; the former SDK throwing wrapper delegates to that same writer.
Findings None None.
Security None None.

How this fits together

OpenClaw’s Gateway and agent runtime coordinate provider credentials, session checkpoints, and channel delivery. This cleanup simplifies those internal paths while retaining their existing configuration, storage, and authorization behavior.

flowchart TD
  A[Client requests] --> B[Gateway and agent runtime]
  B --> C[Session checkpoint owner]
  C --> D[SQLite state]
  E[Provider setup] --> F[Credential owner]
  F --> D
  B --> G[Telegram block measurement]
  G --> H[Channel delivery]
Loading

Before merge

  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

Metric Value Why it matters
Provider-auth SDK additions 2 additive helper exports The documented additions are a public API commitment even though existing exports and credential behavior are preserved.

Stored data model

Persistent data-model change detected: migration/backfill/repair: ui/src/components/sidebar-attention-panel.runtime.ts, unknown-data-model-change: extensions/memory-wiki/src/gateway.ts, unknown-truncated-pull-files, vector/embedding metadata: extensions/memory-wiki/src/gateway.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Retain the consolidated owners, documented additive SDK helpers, and existing compatibility and authority contracts.

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

Not applicable: this PR proposes internal cleanup rather than a specific broken user flow; no runtime tests were executed during the read-only review.

Is this the best way to solve the issue?

Yes: removing unused paths and sharing existing owners is maintainable, and the inspected changes preserve configuration, stored formats, and execution checks.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 47c4fbcb20d2.

Labels

Label justifications:

  • P3: This is internal maintenance cleanup with no established urgent 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: The supplied repository context identifies maintainer-owned work, and the diff introduces no material authority change requiring the exceptional proof gate. Reported built-Gateway recovery scenarios exercise the retained checkpoint owner; synthetic provider/app-server coverage is not live-provider or native-app proof.

Evidence

What I checked:

  • Introduced-change identity: Inspected the local merge-base-to-head diff rather than endpoint drift. The recorded test merge has the pinned base followed by the exact reviewed head as its parents. (9b2ee030fc54)
  • Checkpoint ownership and compatibility: The removed factory returned the same functions now called directly. Checkpoint serialization, legacy snapshot handling, and the captured authority assertion passed into the persistence commit remain intact; no storage migration is introduced. (src/gateway/session-compaction-checkpoints.ts:658, 9b2ee030fc54)
  • Provider credential preservation: The shared capture helper retains the original SecretRef input, storage mode, and workspace context. Persistence skips profile-sourced credentials and uses the existing locked writer; the former SDK throwing wrapper delegates to that same writer. (src/plugins/provider-api-key-auth.ts:54, 9b2ee030fc54)
  • Additive SDK surface: The diff adds captureProviderApiKey and persistProviderApiKey to the existing SDK subpath and documents their contracts. Existing exports remain available. These two additions qualify the PR body's claim of zero exported-name additions. Public docs: docs/plugins/sdk-provider-plugins.md. (docs/plugins/sdk-provider-plugins.md:314, 9b2ee030fc54)
  • Native execution safeguards retained: Removed snapshot/save and usage wrappers have no remaining production callers. Native execution still validates current policy inside the SQLite transaction before applying grants or recording uses, and the revised tests exercise that retained owner. (apps/macos/Sources/OpenClaw/ExecApprovalsStore.swift, 9b2ee030fc54)
  • Current-main necessity: Fetched main still contains the event-stream facade and checkpoint factory removed by this branch. The related-item search did not establish a canonical replacement for this cleanup. (packages/agent-core/src/agent-loop.ts, 47c4fbcb20d2)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • obviyus: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (5 earlier review cycles)
  • reviewed 2026-09-18T17:11:15.573Z sha 5586c6c36370e89e49e1dba9a9b729065319f81d :: blocked before merge. :: none
  • reviewed 2026-09-18T18:47:12.721Z sha 63a766cd75b911a89dd14b35df24e1e9c1e53452 :: blocked before merge. :: none
  • reviewed 2026-09-18T19:06:29.416Z sha efca55594fdfab3f5006662e0b8d7e916ea161f0 :: blocked before merge. :: none
  • reviewed 2026-09-18T19:34:38.708Z sha 51ef7b25daae34cf7b3a8b0bab4581dc0146880f :: blocked before merge. :: none
  • reviewed 2026-09-18T19:55:57.796Z sha 9b2ee03 :: blocked before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot removed the channel: slack Channel integration: slack label Sep 18, 2026
@steipete
steipete force-pushed the codex/deslop-prod-2k branch from 28660f4 to 63a766c Compare September 18, 2026 18:33
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Sep 18, 2026
@steipete
steipete force-pushed the codex/deslop-prod-2k branch from 51ef7b2 to 9b2ee03 Compare September 18, 2026 19:41
@clawsweeper clawsweeper Bot added 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. and removed 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 Sep 18, 2026
@steipete
steipete merged commit d2c4358 into main Sep 18, 2026
259 checks passed
@steipete
steipete deleted the codex/deslop-prod-2k branch September 18, 2026 20:41
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 18, 2026
…49075-c1-control-repair

* commit 'dc5b321b5f89f9cf0e704ee202ea3059fb1ce63d': (79 commits)
  fix: start background context maintenance after durable turns (#151936)
  fix(models): avoid ambient state reads during prepared selection (#152119)
  feat: recover abandoned Crabbox source staging (#152006)
  chore(ui): refresh control ui locales (#152098)
  fix(ui): keep cloud startup prompts and progress in chat (#152024)
  fix: report completed subprocess cleanup after cancellation (#152107)
  perf(reply): reuse normalized inbound text (#152110)
  fix(cron): paused future one-shots disappear after Run now (#152126)
  perf(sessions): reuse rows and skip discarded terminal labels (#152109)
  fix(ui): keep keyboard-focused automation controls clear of sticky actions (#152135)
  fix(ui): load remote images in compact activity previews (#152045)
  refactor(health): skip unused verbose account projection (#152108)
  fix: restore dashboard test limits and SQLite test compilation (#152089)
  test(qa-lab): stabilize timeout recovery delivery proof (#152100)
  fix: probe SQLite when Node denies worker threads (#152075)
  perf(gateway): keep GitHub co-author trailer scans linear (#152115)
  fix(media): report CLI models with missing command or args (#151969)
  refactor: remove retired runtime code and duplicate helpers (#151973)
  perf(plugins): combine runtime and tool call scopes (#152101)
  test(memory): seed restart fixtures with the Gateway stopped (#152038)
  ...
vincentkoc added a commit that referenced this pull request Sep 18, 2026
…pr-149282-proof-20260918

* commit 'dfa48c256f0853268c6b42cbe09fc1338d7d24ea':
  test(qa-lab): stabilize timeout recovery delivery proof (#152100)
  fix: probe SQLite when Node denies worker threads (#152075)
  perf(gateway): keep GitHub co-author trailer scans linear (#152115)
  fix(media): report CLI models with missing command or args (#151969)
  refactor: remove retired runtime code and duplicate helpers (#151973)
  perf(plugins): combine runtime and tool call scopes (#152101)
  test(memory): seed restart fixtures with the Gateway stopped (#152038)
  perf(gateway): avoid session list stalls on broad updates (#152074)
  fix: preserve model failure causes and worker fallback runtime (#152028)
  perf(logging): reduce Gateway hot-path info log volume (#152080)
  improve(gateway): reduce duplicate worker data fetched from SQLite (#151878)
  improve: format messages with many links faster (#152112)
  perf(cron): avoid unused SQL binding in config projections (#152029)
  fix: explain cloud worker startup failures (#152043)
  refactor(discord): share Markdown edit projection (#149214)
  refactor(media): remove unreachable geometry metadata backfills (#149272)
  chore(autoreview): sync mirror to agent-skills a7e91e1 (#152039)
  fix(ui): restore sidebar and chat test collection (#152099)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 19, 2026
…#151973)

* refactor: remove retired runtime paths and duplicate helpers

* perf(telegram): avoid repeated rich-block traversal setup

* refactor: preserve SDK compatibility and finish runtime cleanup

* test: parse library runtime import boundaries

* test(ui): keep record fixtures independent of gateway state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: ios App: ios app: macos App: macos app: web-ui App: web-ui channel: discord Channel integration: discord channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: telegram Channel integration: telegram channel: tlon Channel integration: tlon channel: twitch Channel integration: twitch channel: whatsapp-web Channel integration: whatsapp-web cli CLI command changes commands Command implementations docs Improvements or additions to documentation extensions: cloudflare-ai-gateway extensions: memory-wiki extensions: microsoft-foundry extensions: stepfun extensions: xai extensions: xiaomi extensions: zai gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. plugin: pixverse plugin: workboard rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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