Skip to content

fix(gateway-doc-toolchain): add lmodern + pandoc PDF build-time self-test#3

Merged
lilyshen0722 merged 1 commit intorebase-2026.3.29from
feat/doc-toolchain-lmodern
May 6, 2026
Merged

fix(gateway-doc-toolchain): add lmodern + pandoc PDF build-time self-test#3
lilyshen0722 merged 1 commit intorebase-2026.3.29from
feat/doc-toolchain-lmodern

Conversation

@lilyshen0722
Copy link
Copy Markdown

Summary

Adds lmodern apt package to the doc-toolchain build layer. Without it, pandoc's xelatex PDF engine fails with:

! LaTeX Error: File `lmodern.sty' not found.

Verified on the live commonly-dev cluster (gateway image 0db858ec) — every pandoc input.md -o out.pdf --pdf-engine=xelatex call agents make hits this error. lmodern lives in its own Debian package, separate from texlive-xetex / texlive-fonts-recommended.

Changes

   pandoc texlive-xetex texlive-fonts-recommended \
+  lmodern \
   poppler-utils python3 python3-pip

Plus extends the build-time self-test (only runs when OPENCLAW_INSTALL_DOC_TOOLCHAIN=1 is set, same as before) to actually produce a 1-page PDF and assert it's non-empty:

printf '# pandoc smoke test\n\nThis builds a real PDF.\n' > /tmp/pandoc-smoke.md
pandoc /tmp/pandoc-smoke.md -o /tmp/pandoc-smoke.pdf --pdf-engine=xelatex
test -s /tmp/pandoc-smoke.pdf

A future regression that removes a required LaTeX package fails the docker build instead of surfacing at agent runtime as a missing-file error.

Why this matters

ADR-013 (Team-Commonly/commonly#287) ships dev agents with pandic-office skill that uses pandoc for Markdown → PDF. With this fix, agents can produce stakeholder-ready PDF briefs/reports/digests end-to-end. DOCX/XLSX/PPTX via officecli already worked (no TeX dependency).

Size impact

Adds ~2 MB to the toolchain layer (the lmodern font set itself).

Test plan

  • Build a fresh gateway image with OPENCLAW_INSTALL_DOC_TOOLCHAIN=1
  • Build-time self-test passes (the new pandoc PDF round-trip)
  • Run on dev cluster, exec into gateway, verify pandoc /tmp/test.md -o /tmp/test.pdf produces a non-empty PDF
  • Theo (or any dev agent) successfully produces a PDF brief end-to-end via the pandic-office skill

🤖 Generated with Claude Code

…test

OPENCLAW_INSTALL_DOC_TOOLCHAIN already pulled pandoc + texlive-xetex +
texlive-fonts-recommended, but pandoc PDF generation via xelatex needs
lmodern.sty (the Latin Modern font set) which lives in a separate Debian
package. Without it, every `pandoc input.md -o out.pdf --pdf-engine=xelatex`
call fails with 'File lmodern.sty not found' — agents trying to produce
PDF deliverables hit a runtime error.

Two changes:

1. Add `lmodern` to the apt install list. ~2 MB extra in the toolchain
   layer; no new build-args.

2. Extend the build-time self-test to actually produce a one-page PDF
   from markdown and assert it's non-empty. A future regression that
   removes a required LaTeX package fails the docker build instead of
   surfacing at agent runtime as a missing-file error.

Verified the failure mode on dev: agent producing a brief via pandoc
errored with 'File lmodern.sty not found' on image
clawdbot-gateway:0db858ec (no lmodern). DOCX/XLSX/PPTX via officecli
are unaffected — they don't go through TeX.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lilyshen0722 lilyshen0722 merged commit 3620a7a into rebase-2026.3.29 May 6, 2026
2 of 9 checks passed
lilyshen0722 added a commit to Team-Commonly/commonly that referenced this pull request May 6, 2026
Picks up Team-Commonly/openclaw#3 which adds lmodern to the doc-toolchain
apt install. Without it, agents producing PDFs via pandoc + xelatex hit
'File lmodern.sty not found' at runtime.

After Deploy Dev, Theo (and other dev agents with the pandic-office skill)
can produce real Markdown→PDF deliverables via:
  pandoc input.md -o output.pdf --pdf-engine=xelatex

Companion: openclaw#3, ADR-013 (#287).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant