Skip to content

fix(gateway): inline runtime into bundle (0.46.x backport)#711

Merged
marcusrbrown merged 1 commit into
0.46.xfrom
fix/gateway-packaging-0.46.2
May 31, 2026
Merged

fix(gateway): inline runtime into bundle (0.46.x backport)#711
marcusrbrown merged 1 commit into
0.46.xfrom
fix/gateway-packaging-0.46.2

Conversation

@fro-bot
Copy link
Copy Markdown
Owner

@fro-bot fro-bot commented May 31, 2026

Summary

Backports the gateway image crash-loop fix onto the 0.46.x maintenance line so deployers pinned below v0.47.0 get a working gateway image — without pulling in the newer v0.47.0+ features (announce webhook, mention loop).

Problem

The gateway Docker image crash-looped on boot with ERR_MODULE_NOT_FOUND for @fro-bot/runtime. The gateway bundle imported @fro-bot/runtime as an external specifier that resolved to its src/index.ts entry, which is absent from the runtime image.

Fix

This cherry-picks the essential packaging changes onto 0.46.x:

  • packages/gateway/tsdown.config.ts — adds a noExternal predicate that inlines @fro-bot/runtime (and its subpaths) into the gateway bundle, making dist/main.mjs self-contained.
  • deploy/gateway.Dockerfile — removes the now-dead COPY --from=build /workspace/packages/runtime/... lines, since the runtime is bundled into the gateway output.

The backport is intentionally minimal: it contains only the two packaging changes above and does not introduce any v0.47.0+ feature work.

Verification

  • pnpm --filter @fro-bot/runtime build and pnpm --filter @fro-bot/gateway build both succeed.
  • grep -c 'from "@fro-bot/runtime"' packages/gateway/dist/main.mjs returns 0 — the bundle has zero bare runtime imports and is fully self-contained.
  • Building deploy/gateway.Dockerfile and running the image with no secrets boots cleanly to the config-load stage and exits with Missing required secret: DISCORD_TOKEN. There is no ERR_MODULE_NOT_FOUND — the module-resolution crash is gone.

Base branch

This PR targets 0.46.x (the maintenance line), not main.

The gateway bundle imported @fro-bot/runtime as an external specifier that
resolved to its src/index.ts entry, which is absent from the runtime image —
crash-looping on boot with ERR_MODULE_NOT_FOUND. Inline the runtime into the
gateway bundle (matching the action tier), drop the now-dead runtime copy from
the image, and add a CI smoke that builds and boots the image to catch
packaging regressions.

Fixes #707
@fro-bot fro-bot requested a review from marcusrbrown as a code owner May 31, 2026 07:55
@fro-bot
Copy link
Copy Markdown
Owner Author

fro-bot commented May 31, 2026

Backport complete: gateway packaging fix on 0.46.x

Opened the maintenance backport PR. No tags or releases were created, and nothing was merged.

Pull request: #711 — fix(gateway): inline runtime into bundle (0.46.x backport)

  • Base: 0.46.x (maintenance line, not main)
  • Head: fix/gateway-packaging-0.46.2
  • State: OPEN

What it does

Backports the gateway image crash-loop fix (ERR_MODULE_NOT_FOUND for @fro-bot/runtime) onto the 0.46.x line so deployers pinned below v0.47.0 get a working gateway image — without the newer v0.47.0+ features (announce webhook, mention loop).

The backport is minimal — only the two essential packaging changes:

  • packages/gateway/tsdown.config.ts: noExternal predicate inlines @fro-bot/runtime into the bundle.
  • deploy/gateway.Dockerfile: removed the dead COPY --from=build /workspace/packages/runtime/... lines.

The 0.46.x base branch did not exist, so it was created from the v0.46.1 tag and pushed. The CI smoke job from the original fix was intentionally left off the maintenance branch (it does not run there).

Verification

  • pnpm --filter @fro-bot/runtime build and pnpm --filter @fro-bot/gateway build both succeed.
  • grep -c 'from "@fro-bot/runtime"' packages/gateway/dist/main.mjs0 (bundle is self-contained, zero bare runtime imports).
  • Docker image built and run with no secrets: boots to config-load and exits with Missing required secret: DISCORD_TOKEN. No ERR_MODULE_NOT_FOUND — the module-resolution crash is gone.

Run Summary

Field Value
Task Maintenance backport of gateway packaging fix to 0.46.x
Outcome PR #711 opened against 0.46.x
PR URL #711
Branches pushed 0.46.x (base, from v0.46.1), fix/gateway-packaging-0.46.2
Cherry-picked 721f213 (squash of #708)
Verification 0 bare runtime imports; image boots to config-load, no ERR_MODULE_NOT_FOUND
Tags/releases none created
Merges none

@marcusrbrown marcusrbrown merged commit f95c446 into 0.46.x May 31, 2026
1 check passed
@marcusrbrown marcusrbrown deleted the fix/gateway-packaging-0.46.2 branch May 31, 2026 08:04
@fro-bot fro-bot mentioned this pull request May 31, 2026
47 tasks
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.

2 participants