Repository navigation
Closed
Labels
Description
What happened
On current main (84384c2), the docker:dev platform container can no longer finish its boot-time convex deploy: the self-hosted Convex backend rejects the push with
Error fetching POST http://convex:3210/api/deploy2/evaluate_push 400 Bad Request: ModulesTooLarge:
Total module size exceeded the zipped maximum (42.97 MiB > maximum size 42.92 MiB)
The entrypoint exits, Docker restarts it, and the container crash-loops indefinitely (observed RestartCount=189 over ~2h; each cycle re-waits 10s, re-syncs env, re-fails). The whole app is down — the proxy has no healthy platform upstream.
The margin story (why it worked this morning and not now)
- The previous checkout (75d47b3) deployed fine at first boot (11:30Z, same stack, same convex backend, same convex CLI 1.35.1 everywhere — host, image and lockfile all pin 1.35.1).
- Since then
services/platform/{convex,lib}grew by 77 files / +5,049 lines (external agents OpenClaw feat: implement OpenClaw as sandbox external agent (#2420) #2555 / Pi feat: implement Pi as a sandbox external agent (#2426) #2550 / Codex feat: implement Codex as sandbox external agent (#2422) #2536, thread-level sandbox workdir feat(platform): thread-level sandbox workdir for external-agent chats #2541, issue-desk NEEDS_HUMAN pause feat(platform): pause issue desk on NEEDS_HUMAN with a shared workflow sandbox #2542, …). - The push is now over the cap by ~0.05 MiB (~50 KB) — the bundle had silently crept to the very edge of the backend limit and the latest features tipped it.
Steps to reproduce
- Check out current
main;bun run docker:dev(compose.dev.yml bind-mounts./services/platform/convexinto the container, so the host checkout is what deploys). - Watch
docker logs tale-platform— boot reaches "Running convex deploy" and fails with the error above;docker inspect tale-platformshows the restart count climbing. curl -skf https://localhost/api/healthnever succeeds (no healthy platform behind the proxy).
Expected behavior
main boots on the documented docker:dev path. A bundle-size regression this close to a hard backend cap should be caught before merge, not at operator boot time.
Evidence / diagnostics gathered
- Bundle dump via
bunx convex deploy --debug-bundle-pathinside the shipping image: 108 MB raw dump (node/ modules ≈ 45 MB raw + maps;fullConfig.json46 MB); no single giant module — the overflow is cumulative acrossnode/_deps/*chunks (largest ~2 MB). - All 11
convex.json→node.externalPackagesresolve in the container exceptcanvas, which is a dangling symlink in/app/node_modules(payload missing). Worth checking as a contributor/separate packaging nit —scripts/link-convex-externals.tsdocuments exactly this class of failure ("without this the heavy node-only libs get bundled inline and the push fails … module-size"). - Minor: the entrypoint's error diagnosis says "compiled modules exceed the 45 MB gzip limit" while the backend enforces 42.92 MiB — the hint understates how close the budget is.
Proposed change
- Short term: prune/split the node bundle back under the cap (dedupe deps across
convex/actions, verifycanvasexternalization actually works in the Docker image, move/lazy-load the new external-agent runner code). - Guard: add a CI check that measures the zipped convex module size (e.g. via
--debug-bundle-path+ gzip) and fails above a threshold (~40 MiB) so main can't silently exhaust the margin again. - Resilience: consider a bounded restart/backoff or a clearer "deploy too large" surface instead of an infinite crash-loop.
Acceptance criteria
-
bun run docker:devonmainboots to a healthy platform again. - CI fails when the zipped convex module bundle exceeds a defined budget below the backend cap.
-
node_modules/canvasis a real, resolvable package in the platform image (no dangling symlink).
Activity
larryro commentedon Jul 8, 2026
Root-caused and fixed on PR #2548 (rides that branch since it was blocking its CI; the PR body carries a
Fixes #2579).The mechanism is worse than bundle creep: the 42.92 MiB cap sums the app modules plus the external-deps package the backend builds server-side from npm (
build_external_node_deps— the CLI only uploads a name@version list). A fresh backend (docker:dev boot, CI, any new deployment) re-resolves the externals' transitive closure from npm at push time, so the total drifts with upstream releases even on an unchanged checkout — while a backend that already cached its external-deps package keeps accepting the same push. That asymmetry is why 75d47b3 deployed at 11:30Z and the same stack crash-looped later, and why local dev never reproduced it.Fix (
1efc1ff97): drop the pure-JS packages —zod,ai,yaml,@modelcontextprotocol/sdk— fromconvex.jsonexternalPackagesso they bundle tree-shaken instead of shipping whole npm trees. Fresh-backend push measured before/after: 42.97 → 35.38 MiB (7.5 MiB headroom); external-deps package 30 → 20.2 MiB. The remaining external elephants aremssql→tedious→@azure/*(~12 MiB zipped, feature weight) andjsdom(~5 MiB, only three crawler helpers — linkedom candidate, tracked separately).canvassymlink you found is vestigial config: nothing bundled imports canvas and the CLI never listed it innodeDependencies— removed fromexternalPackagesinea42f6c51, which retires that entire failure mode.Source/External deps package sizelog lines after a fresh push (the E2E preflight already does the fresh push — it just fails at the cap instead of a budget). Same for the crash-loop backoff.After the PR:
bun run docker:devboots again (criterion 1), canvas resolves by removal (criterion 3).