Skip to content

Fixed Koenig demo build in CI - #29179

Merged
kevinansfield merged 1 commit into
mainfrom
fix-koenig-demo-build
Jul 8, 2026
Merged

Fixed Koenig demo build in CI#29179
kevinansfield merged 1 commit into
mainfrom
fix-koenig-demo-build

Conversation

@kevinansfield

@kevinansfield kevinansfield commented Jul 8, 2026

Copy link
Copy Markdown
Member

ref https://linear.app/ghost/issue/BER-3774/

The Koenig Demo deploy workflow has been failing on main since the Koenig monorepo merge, so https://koenig.ghost.org is not receiving updates. The build step failed with Rolldown unable to resolve @tryghost/kg-default-nodes because that package's entry points are compiled output (build/esm/) that never gets built in the workflow's fresh checkout.

Only the build target inherits dependsOn: ["^build"] from the nx.json target defaults — the differently-named build:demo target inherits nothing, so nx run @tryghost/koenig-lexical:build:demo ran vite directly without first compiling the workspace kg-* packages it imports. This worked in the standalone Koenig repo's pages workflow but was missed in the merge.

Fixed by giving build:demo its own Nx target config with ^build, matching the existing dev:integrated and test:acceptance targets. The target is deliberately left uncached: the demo build inlines VITE_TENOR_API_KEY/VITE_KLIPY_API_KEY via import.meta.env and writes to the same dist dir as the build target, so caching could ship stale GIF provider config after the secrets change and lets the two cached targets clobber each other's restored outputs. It's a ~4s build that only runs in the deploy workflow, so caching buys nothing anyway.

Verified against the exact CI steps (filtered frozen-lockfile install + nx run @tryghost/koenig-lexical:build:demo) both with and without the Nx cache.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This change adds a new build:demo target to the Nx configuration in koenig/koenig-lexical/package.json. The target is configured with dependsOn set to ^build.

Suggested reviewers: EvanHahn, acburdine

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: fixing the Koenig demo build in CI.
Description check ✅ Passed The description is directly about the Koenig demo build failure and the Nx target fix.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-koenig-demo-build

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Jul 8, 2026

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit 59707d0

Command Status Duration Result
nx run @tryghost/admin-x-settings:test:acceptance ✅ Succeeded 9m 44s View ↗
nx run @tryghost/koenig-lexical:test:acceptance ✅ Succeeded 2m 27s View ↗
nx run-many --target=build --projects=tag:publi... ✅ Succeeded <1s View ↗
nx run @tryghost/activitypub:test:acceptance ✅ Succeeded 47s View ↗
nx run @tryghost/admin:build ✅ Succeeded 10s View ↗
nx run ghost-admin:test ✅ Succeeded 3s View ↗
nx run ghost:build:assets ✅ Succeeded 2s View ↗
nx run ghost:build:tsc ✅ Succeeded 9s View ↗
Additional runs (2) ✅ Succeeded ... View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-07-08 16:34:01 UTC

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@koenig/koenig-lexical/package.json`:
- Around line 149-157: The build:demo target is sharing the same output
directory as the regular build target, which can cause artifacts and cached
output to overwrite each other. Update the build:demo configuration in
package.json to use a separate outputs path, and make sure the build:demo
target’s output directory is distinct from the one used by the main build script
while keeping the existing dependsOn and cache settings intact.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3157b85d-cd63-43e7-905f-7ed3dfe2174f

📥 Commits

Reviewing files that changed from the base of the PR and between bc45ce2 and 7c93bb0.

📒 Files selected for processing (1)
  • koenig/koenig-lexical/package.json

Comment thread koenig/koenig-lexical/package.json

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7c93bb0525

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread koenig/koenig-lexical/package.json Outdated
kevinansfield added a commit that referenced this pull request Jul 8, 2026
ref #29179 (comment)

- the demo build inlines VITE_TENOR_API_KEY/VITE_KLIPY_API_KEY via
  import.meta.env, so a cached build would be reused even after the
  workflow's secret values change, silently deploying stale GIF provider
  config unless the env vars were added to the target's cache inputs
- it also shared its declared `dist` output with the `build` target,
  letting the two cached targets clobber each other's restored artifacts
- the demo build takes ~4s and only runs in the deploy workflow, so
  caching buys nothing; keeping just the `^build` dependency avoids both
  hazards
ref https://linear.app/ghost/issue/BER-3774/

- the Koenig Demo deploy workflow failed on main after the monorepo merge:
  `nx run @tryghost/koenig-lexical:build:demo` ran vite directly without
  compiling the workspace kg-* packages it imports, so
  `@tryghost/kg-default-nodes` (whose entry points are built output)
  could not be resolved
- only the `build` target inherits `dependsOn: ["^build"]` from nx.json
  targetDefaults; the differently-named `build:demo` target inherited
  nothing, so its upstream packages were never built in the fresh CI
  checkout
- the target is deliberately left uncached: the demo build inlines
  VITE_TENOR_API_KEY/VITE_KLIPY_API_KEY via import.meta.env and writes to
  the same dist dir as the `build` target, so caching could ship stale
  GIF provider config and lets the two targets clobber each other's
  restored outputs
@kevinansfield
kevinansfield force-pushed the fix-koenig-demo-build branch from 973138c to 59707d0 Compare July 8, 2026 16:21
@kevinansfield kevinansfield changed the title Fixed Koenig demo build not building workspace dependencies first Fixed Koenig demo build in CI Jul 8, 2026
@kevinansfield
kevinansfield enabled auto-merge (rebase) July 8, 2026 16:25
@kevinansfield
kevinansfield merged commit eaf11df into main Jul 8, 2026
44 checks passed
@kevinansfield
kevinansfield deleted the fix-koenig-demo-build branch July 8, 2026 16:34
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