Skip to content

fix(agent-bundle): preserve generated build semantics - #319

Merged
ScriptedAlchemy merged 5 commits into
mainfrom
fix/review-batch3-build-packaging
Sep 2, 2026
Merged

fix(agent-bundle): preserve generated build semantics#319
ScriptedAlchemy merged 5 commits into
mainfrom
fix/review-batch3-build-packaging

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Summary

  • mount deterministic request providers in generated rendered workers used by projected MCP commands, rendered CLI routes, and rendered scripts
  • preserve opt-in result exit codes for receipt-driven projected tools
  • make bare prepack non-overlapping while respecting configured output paths, and harden installer naming, README inventory, and percent-path handling

Test plan

  • scoped unit regressions (80 tests)
  • scoped packaging/installer integration regressions (28 tests)
  • audiobook-curator tests (33 tests)
  • pnpm typecheck
  • pnpm lint
  • pnpm test:packed (26 passed, 1 environment-dependent skip)

Issue #313

This partially resolves #313: providers now mount for projected MCP commands, rendered routed CLI commands, and rendered scripts. Plain .ts routed CLI commands still need provider mounting.

Mount providers and honest exit policies across projected entry paths while hardening prepack defaults and packed installer inventory.
@changeset-bot

changeset-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 856af77

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
agent-bundle Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-02T22:32:40.212113Z 5317ce6 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Sep 2, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle@319
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/create-agent-bundle@319
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@319

commit: 856af77

@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: 5317ce6193

ℹ️ 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".

' throw new TypeError(`Context provider "${provider.key}" (${provider.source}) must default-export a factory.`);',
' }',
' try {',
' providerValues[provider.key] = await provider.module.default({ invocation: message.invocation, signal: controller.signal });',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Forward the invocation to rendered workers

When a rendered CLI route, projected MCP command, or rendered script has a provider that reads its documented invocation, this value is always undefined: renderedSessionSource posts only { id, props, request, routeId, type } to the worker, while this new provider call reads message.invocation. Providers branching on invocation.kind therefore throw and fail the request before the route runs; include dispatch.invocation in the posted worker message.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed on main by #366 (a0562e6, "mount request context providers for plain routed CLI commands"). The rendered-session bridge in packages/agent-bundle/src/build/entry-shell.ts now posts { id, invocation, props, request, routeId, type: 'render' } (line ~227), so the worker-side provider loops that read message.invocation (rendered CLI worker and rendered script worker) observe the real surface (cli / script / tool) instead of undefined. #366's routed-CLI executable proof (tests/cli-routes-build.test.ts) covers provider values on plain CLI, rendered CLI, and rendered script surfaces. Verified on current origin/main.

: [resolveOutput(root, options.output)];
const prepared = await new ProjectService({
...options,
...(options.packageOutputs === true ? { artifactDistPathDefault: defaultPackageArtifactDistPath } : {}),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Correct the CLI help for the new artifact default

When build or prepack is run without --output and the config has no output.distPath, this branch now selects artifact/, but both option descriptions still advertise default dist in packages/agent-bundle/src/cli.ts:479 and :489. Users following --help will consequently look for or package the wrong directory, so the CLI descriptions should reflect the operation-specific default.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in #397 (merged as d25a9c6). agent-bundle build --help and prepack --help now state the artifact default for --output that both commands actually use (docs/framework-mode.md clarifies the output.distPath interplay); tests/cli.test.ts asserts the help text.

Exercise the built standalone hook worker and accept the audiobook example's additive tool and resource surfaces.
Keep the overview journey focused on the stable source identity fields while allowing optional package metadata.
Keep the artifact-only CLI contract deterministic when optional host binaries are unavailable.
Reconcile current generated-surface and host-validation contracts while preserving the review fixes.
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.

Mount request context providers for routed CLI and rendered scripts

1 participant