fix(agent-bundle): preserve generated build semantics - #319
Conversation
Mount providers and honest exit policies across projected entry paths while hardening prepack defaults and packed installer inventory.
🦋 Changeset detectedLatest commit: 856af77 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
There was a problem hiding this comment.
💡 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 });', |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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 } : {}), |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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.
Summary
Test plan
pnpm typecheckpnpm lintpnpm 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
.tsrouted CLI commands still need provider mounting.