Skip to content

fix(nitro): Compile Junior content for serverless#513

Draft
dcramer wants to merge 1 commit into
mainfrom
codex/issue-510-compiled-content
Draft

fix(nitro): Compile Junior content for serverless#513
dcramer wants to merge 1 commit into
mainfrom
codex/issue-510-compiled-content

Conversation

@dcramer
Copy link
Copy Markdown
Member

@dcramer dcramer commented Jun 4, 2026

Compile Junior app and plugin content into a private Nitro virtual module so Vercel route and queue functions no longer depend on copied app/plugin files at runtime. Local and non-Nitro runtimes keep using filesystem-backed discovery.

Compiled Content Provider

createApp() hydrates #junior/content before plugin validation, and app markdown, skills, manifests, sandbox sync, app-home, image prompt, and reporting reads go through the provider. The provider falls back to the filesystem when no virtual module is present.

Package Boundary

Compiled package content is projected through the active plugin catalog so bundled-but-unselected packages do not become providers. Registry cache keys include the runtime content version, and app plugin symlinks are followed during graph compilation.

Vercel Output Guard

The example postbuild check validates the compiled graph in both primary and queue functions and fails if copied Junior app/plugin files reappear.

Fixes #510

Load Junior app and plugin content from a private Nitro virtual module so Vercel functions no longer depend on copied app or package manifests at runtime.

Keep filesystem-backed discovery for local and non-Nitro runtimes, and preserve includeFiles only for explicit dependency assets that the bundler cannot trace.

Fixes #510
Co-Authored-By: GPT-5 Codex <codex@openai.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
junior-docs Ready Ready Preview, Comment Jun 4, 2026 6:43am

Request Review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 44bd010. Configure here.

export function readRuntimeFileSync(targetPath: string): string | null {
const compiled = compiledFileBuffer(targetPath);
if (compiled) {
return compiled.toString("utf8");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Empty compiled files ignored

Medium Severity

Compiled entries present in the graph with an empty base64 payload decode to a zero-length Buffer, but read and existence helpers treat that buffer as falsy and fall back to the filesystem. On Nitro/serverless, those paths are not on disk, so empty bundled files behave as missing instead of empty.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 44bd010. Configure here.


/** Create a Hono app with all Junior routes. */
export async function createApp(options?: JuniorAppOptions): Promise<Hono> {
setRuntimeContent(await resolveVirtualContent());
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Failed createApp leaves stale content

Medium Severity

createApp hydrates compiled content before validation, but its error path only rolls back plugin catalog, agents, and config defaults—not runtime content. If the catalog rolls back to no packages, filterCompiledPluginPackageContent clears package plugins while the compiled graph still contains them, so bundled plugins vanish until process restart.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 44bd010. Configure here.

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.

Refactor Junior content loading away from runtime filesystem discovery

1 participant