Skip to content

Stable runtime aliases drop default exports β€” "reconcile is not a function" after every auto-compaction; compaction bookkeeping never persistsΒ #99677

Description

@headbouyJB

πŸ€– AI-assisted (Claude Code). This bug was caught and diagnosed by my AI agent while operating my local OpenClaw deployment, and the linked fix is its proposal. All evidence below is from real logs and the published npm artifacts. (Previous report from this setup: #98261 / PR #98267.)

Related: #78367 (compaction storms β€” this bug is a plausible contributing cause), #66263 (stale post-compaction context bookkeeping), #95553 (adjacent compaction-timeout area).

Problem

scripts/runtime-postbuild.mjs writes stable aliases for hashed runtime chunks as a bare star re-export:

// dist/embedded-agent-subscribe.handlers.compaction.runtime.js (published 2026.6.10 AND 2026.6.11)
export * from "./embedded-agent-subscribe.handlers.compaction.runtime-<HASH>.js";

But export * from never re-exports default (ES module semantics). Several alias targets export only default, so lazy consumers that destructure it get undefined.

Concrete failure β€” after every successful auto-compaction:

late compaction count reconcile failed: TypeError: reconcile is not a function

because the selection chunk does:

const { default: reconcile } = await import("./embedded-agent-subscribe.handlers.compaction.runtime.js");
return reconcile(params);   // reconcile === undefined

while the target's only export is export { reconcileSessionStoreCompactionCountAfterSuccess as default }.

Impact

  • reconcileSessionStoreCompactionCountAfterSuccess never persists the compaction count β€” post-compaction bookkeeping silently fails on every compaction, for every user of the published builds.
  • Observed downstream effect on a local-model deployment (llama.cpp, 122B): 3 auto-compactions within 25 minutes on one session, each followed by a full context re-prefill (multi-minute on local hardware) β€” i.e. a compaction storm presenting as an unresponsive agent. Cloud deployments likely mask this (re-prefills cost seconds).

Affected aliases (verified in the published [email protected] tarball)

CORRECTION (2026-07-04): module-level verification (import() each hashed target, check typeof m.default) shows exactly one alias target actually exports default today: embedded-agent-subscribe.handlers.compaction.runtime.js β€” the proven-broken reconcile path. The other six stable aliases (agent-runner, cli, devices-cli, models-cli, monitor-webhook, plugins-cli) point at chunks with no default export, so their star-only aliases are currently harmless (the original "7 affected" count came from a naive text scan for as default, which matched string content inside minified bundles β€” my mistake). The generator defect still applies to all aliases: any target that gains a default export silently loses it. Note for implementers: naive text matching also breaks the OTHER way β€” appending export {{ default }} to an alias whose target lacks one is a hard SyntaxError at import (we hit this live); detection must be against real export statements.

Note: scripts/stage-bundled-plugin-runtime.mjs emits the same bare export * from pattern for plugin runtimes β€” not verified, but the same class.

Fix

When the alias target has a default export, also emit export { default } from ... β€” in both the stable-alias and legacy-compat writers. PR incoming with a regression test that mirrors the real reconcile chunk shape.

Workaround (local, verified)

Append export { default } from "./<HASH-target>.js"; to each affected alias in dist/ β€” the reconcile error stops immediately. (Lost on every update, hence this report.)

Environment

  • openclaw 2026.6.10 and 2026.6.11 (both published tarballs verified affected); generator unchanged on current main (scripts/runtime-postbuild.mjs lines ~323 and ~513)
  • Local models via llama.cpp (where the re-prefill cost makes the loop user-visible)

Metadata

Metadata

Assignees

Labels

P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.

Type

No type

Fields

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions