Repository navigation
Description
Summary
/export-session (alias /export) always fails with an ENOENT because the HTML template assets are shipped under a different dist/ path than the one the runtime resolves at execution time. The command is effectively broken in the published npm package.
Environment
- OpenClaw
2026.6.1 (2e08f0f) - Node
v24.12.0 - Windows 11
- Installed as a global npm package (
%APPDATA%\npm\node_modules\openclaw)
What happens
Invoking /export-session from Discord produces this gateway error:
[discord] discord interaction handler failed: Error: ENOENT: no such file or directory, open
'C:\Users\kaker\AppData\Roaming\npm\node_modules\openclaw\dist\export-html\template.css'
Root cause
In the bundled runtime (dist/commands-handlers.runtime-*.js, from src/auto-reply/reply/commands-export-session.ts):
const EXPORT_HTML_DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), "export-html");
async function loadTemplate(fileName) {
return await fs.readFile(path.join(EXPORT_HTML_DIR, fileName), "utf-8");
}import.meta.url for that bundle is at the dist/ root, so EXPORT_HTML_DIR resolves to dist/export-html. But the assets are not there.
Evidence
dist/export-html/does not exist in the installed package.- The assets actually ship at
dist/auto-reply/reply/export-html/:template.html,template.css,template.jsvendor/marked.min.js,vendor/highlight.min.js
So loadTemplate("template.css") (and every other template file) throws ENOENT.
Repro
- Install OpenClaw
2026.6.1globally via npm. - Run
/export-sessionon any session. - Observe the
ENOENT ...\dist\export-html\template.csserror; no HTML is produced.
Suggested fix
Make the build place the export-html asset directory next to the runtime bundle that reads it (i.e. emit dist/export-html/), or change the path resolution in commands-export-session to point at the actual shipped location (dist/auto-reply/reply/export-html). Either way the source-relative asset path and the bundle-relative lookup need to agree.
Workaround
Copying the asset directory to the expected location restores the command (no restart needed, assets are read per-export):
dist/auto-reply/reply/export-html/ -> dist/export-html/
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jun 6, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 6, 2026, 12:24 AM ET / 04:24 UTC.
Summary
Keep open. The report matches current source and the published v2026.6.1 package layout:
/export-sessionloads templates relative to the bundled runtime atdist/export-html, while the build copies them todist/auto-reply/reply/export-html, so the latest shipped command can fail before producing HTML.Reproducibility: yes. there is a high-confidence source/package reproduction path: install v2026.6.1 and run
/export-session, where the bundle readsdist/export-html/template.cssbut the package ships the assets underdist/auto-reply/reply/export-html. I did not execute the live channel command during this read-only review.Next step
This is a narrow, current, shipped bug with clear likely files and a focused validation path, so it is a good manually promoted repair candidate.
Review details
Best possible solution:
Align the runtime template lookup and packaged asset copy path, then add a packaging-focused regression check so future builds prove the bundle can read the shipped templates.
Do we have a high-confidence way to reproduce the issue?
Yes, there is a high-confidence source/package reproduction path: install v2026.6.1 and run
/export-session, where the bundle readsdist/export-html/template.cssbut the package ships the assets underdist/auto-reply/reply/export-html. I did not execute the live channel command during this read-only review.Is this the best way to solve the issue?
Yes, the best fix is a narrow packaging/runtime alignment plus regression coverage for the packaged path. A broad export-session refactor or workaround copy by users is not needed for this specific bug.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
/export-sessioncommand in this read-only review; the high-confidence proof is from current source plus the published package layout.Codex review notes: model gpt-5.5, reasoning high; reviewed against 8e9c377971bb.
Label changes
Label changes:
P2: The latest release appears to break a documented owner slash command, but the impact is limited to HTML session export rather than core runtime availability.impact:other: The issue affects a maintainer-visible export command path that does not fit the more specific data-loss, security, session-state, auth-provider, message-loss, or crash-loop labels.issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.clawsweeper:source-repro: Current issue advisory state selects this label.clawsweeper:queueable-fix: Current issue advisory state selects this label.clawsweeper:fix-shape-clear: Current issue advisory state selects this label.Label justifications:
P2: The latest release appears to break a documented owner slash command, but the impact is limited to HTML session export rather than core runtime availability.impact:other: The issue affects a maintainer-visible export command path that does not fit the more specific data-loss, security, session-state, auth-provider, message-loss, or crash-loop labels.Evidence reviewed
Acceptance criteria:
What I checked:
buildExportSessionReplyloadstemplate.html,template.css,template.js, and vendor files frompath.dirname(fileURLToPath(import.meta.url))/export-html, which is bundle-relative after tsdown output. (src/auto-reply/reply/commands-export-session.ts:23, 8e9c377971bb)/export-sessionand/exportare dispatched throughhandleExportSessionCommand, so this template lookup is on the documented slash-command path. (src/auto-reply/reply/commands-info.ts:293, 8e9c377971bb)dist/auto-reply/reply/export-html, and the build step cache records that same output path rather thandist/export-html. (scripts/copy-export-html-templates.ts:19, 8e9c377971bb)package/dist/auto-reply/reply/export-html/template.cssand the other template assets, has nopackage/dist/export-html/entries, and itscommands-handlers.runtime-CtnEUSKY.jsstill computesEXPORT_HTML_DIRasdirname(import.meta.url)/export-html. (2e08f0f4221f)src/auto-reply/reply/commands-export-session.test.ts:85, 8e9c377971bb)export-session ENOENT export-htmlreport; adjacent export-html issues exist but do not supersede this packaging-path bug.Likely related people:
/export-sessionPR and the bundled-template commit that addedsrc/auto-reply/reply/commands-export-session.tsandscripts/copy-export-html-templates.ts. (role: introduced behavior; confidence: high; commits: 4cc75b057178, 33fd271a8b35, f82a3d3e2bb4; files:src/auto-reply/reply/commands-export-session.ts,scripts/copy-export-html-templates.ts,src/auto-reply/reply/export-html/template.css)src/auto-reply/reply/export-html/template.js,src/auto-reply/reply/export-html/template.security.test.ts)src/auto-reply/reply/commands-export-session.ts,scripts/copy-export-html-templates.ts,scripts/build-all.mjs)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.LiuwqGit commentedon Jun 6, 2026
Fix submitted
PR: #90873
Summary
Fixed the export-html template copy path mismatch that caused
/export-sessionto fail with ENOENT.Root cause: Templates were copied to
dist/auto-reply/reply/export-html/but the runtime bundle (atdist/root) resolves the path asdist/export-html/.Changes:
scripts/copy-export-html-templates.tsto copy todist/export-html/scripts/build-all.mjscache configuration to matchVerification
dist/export-html/This fix restores the
/export-sessioncommand functionality for npm package users.Co-Authored-By: nebulacoder-v8.0 noreply@zte.com.cn
fix(build): ship export session html assets
fix(build): ship export session html assets