Skip to content

fix(cli): worker-name collisions, negative positionals, fail-closed rendered workers, canonical result output - #210

Merged
ScriptedAlchemy merged 2 commits into
mainfrom
fix/pr186-cli-findings
Sep 1, 2026
Merged

fix(cli): worker-name collisions, negative positionals, fail-closed rendered workers, canonical result output#210
ScriptedAlchemy merged 2 commits into
mainfrom
fix/pr186-cli-findings

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Summary

Fixes six unaddressed Codex findings on #186, #175, and #178:

Consequence fix: the inlined cli-entry runtime now ignores its owning source root (runtimeIgnoredRoot) during builds, since it pulls sibling core/ imports (stableJson).

Tests

Five new regression tests across entry-shell.test.ts, cli-routes.test.ts, cli.test.ts, cli-routes-build.test.ts — all verified to fail without the source fixes. Post-rebase gates: 57 unit tests, built-binary integration tests, collision integration test, tsc --noEmit, rslint all green. (The pre-existing packed consumer failure in cli.test.ts reproduces identically on clean main in this environment — npm pack --json output pollution, unrelated.)

…endered workers, canonical result output

Post-merge review findings from #186, #175, and #178: reserve generated
*-flight.mjs worker destinations during entry planning so a conventional
script colliding with a rendered worker is a build-time AB5000 diagnostic
instead of a silent overwrite; treat a lone -<digit> token as a positional
when the next positional expects a number (keeping -- escape and unknown
single-dash rejection intact); fail all pending rendered requests closed
when the worker exits with any code, including 0; route rejected progress
reports into the request failure path instead of voiding them; serialize
plain CLI results with the canonical stableJson writer (undefined emits
null); and validate the exitCode result mapping before writing stdout so
an invalid mapping cannot emit a success line first. The inlined cli-entry
runtime now ignores its owning source root during builds because it pulls
sibling core imports.
@changeset-bot

changeset-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7fd0e6e

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 1, 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-01T21:14:07.153734Z 7ba070e 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 1, 2026

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

commit: 7fd0e6e

@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: 7ba070eb1c

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

})()];
})),
...(cliRuntimeShell === undefined ? {} : { ignoredSourcePaths: [cliRuntimeShell] }),
...(cliRuntimeShell === undefined ? {} : { ignoredSourcePaths: [runtimeIgnoredRoot(cliRuntimeShell)] }),

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 Avoid treating ancestor dist directories as runtime roots

When the source checkout lives beneath a directory named dist (for example, /tmp/dist/project/packages/agent-bundle/src/cli-entry.ts), runtimeIgnoredRoot selects /dist/ merely because it occurs anywhere in the path and returns /tmp instead of the package root. Passing that ancestor here causes provenance collection to ignore every bundler-discovered transitive source under the consumer project, producing incomplete sourceInputs for rendered CLI artifacts. Determine the root from the innermost applicable /src/ or /dist/ marker rather than preferring any /dist/ occurrence.

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 7fd0e6e (merged to main as 1c36813): runtimeIgnoredRoot now anchors to the parent of the nearest src or dist ancestor of the runtime module itself instead of substring-matching any /dist/ segment, so a checkout living under a dist directory resolves the correct package root; an unmarked path is a loud error. Regression tests in entries.test.ts cover the stray-dist checkout, both normal layouts, and a mixed path.

…cestor

Review follow-up on #210: runtimeIgnoredRoot matched any /dist/ segment
in the path, so a checkout living under a dist directory resolved the
ignored root to the wrong ancestor and silently ignored the whole
checkout. The root is now the parent of the nearest src or dist ancestor
of the runtime module itself, and an unmarked path is a loud error.
@ScriptedAlchemy
ScriptedAlchemy merged commit 1c36813 into main Sep 1, 2026
10 checks passed
@ScriptedAlchemy
ScriptedAlchemy deleted the fix/pr186-cli-findings branch September 3, 2026 05:27
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