Repository navigation
fix(cli): report failed tag installations to scripts and agents - #6086
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
miguel-heygen
left a comment
There was a problem hiding this comment.
Thanks for this, and for the reproduction in the issue. The exit code and the JSON errors list are right, the tests go through the real command path, and no other caller has the same swallow then succeed loop.
One thing to fix before this lands: the human summary at packages/cli/src/commands/add.ts:618 lost its status glyph. Colors are identity when stdout is not a TTY, so hyperframes add sometag > add.log now writes a bare Installed 0/2 blocks with no marker, where it used to write a checkmark on success. Keeping a glyph restores it: console.log(${errors.length > 0 ? c.error("✗") : c.success("✓")} ${summary}). The non JSON test only asserts the per item "HTTP 404" line, so tightening it to the summary would pin this too.
|
@miguel-heygen Fixed in eb6fd15. Tag summaries retain the success/failure marker when stdout has no color. The tests now assert the final summary for both outcomes; both new assertions failed before the fix, and all 72 add/installer/resolver tests pass. Lint, formatting, comment checks and pre-commit checks pass. The full local build and CLI typecheck remain limited by missing preinstalled inspector/AWS dependencies, as noted in the description. Ready for re-review while CI runs. |
miguel-heygen
left a comment
There was a problem hiding this comment.
Thanks for turning this around so quickly. The summary keeps its marker now in both outcomes, and tightening the non JSON assertion to the whole summary line is what pins it, so a future refactor that drops the glyph will fail the test rather than quietly ship.
I checked the rest again at this head: the single item path already failed correctly, nothing else parses the tag JSON, and errors is additive so the success shape stays compatible. CI is green across the producer, docs and CLI shim jobs.
Approving.
jrusso1020
left a comment
There was a problem hiding this comment.
Approving. On main, the add <tag> loop in packages/cli/src/commands/add.ts catches each install error, prints it, and then reports ok: true with exit 0, so a script or agent cannot tell that nothing was installed. With --json the failure reason is dropped entirely.
The fix collects per-item errors, sets ok from them, adds an errors array, and ends with the existing failCommand(). That matches how the single-item and empty-tag paths a few lines above already fail, so the exit contract is now consistent across the command. Successful installs are still written. Files kept because the project edited them are skipped inside the installer without throwing, so re-running a tag install does not start failing.
I ran the new tests against main without the fix: all five scenarios fail. With the fix, the file passes 35/35. Miguel's earlier request (keep the success/failure marker when stdout has no color) is addressed at this head.
Need: yes, partial and total tag-install failures exit 0 today · Size: ok · Reuse: uses the existing failCommand boundary · Simpler: already minimal
— Rames
What
hyperframes add <tag>now reports an incomplete installation as a failure. Scripts and agents receive exit code 1 andok: falsewhen any block fails; JSON includes each failed block's name and error. Successful installations remain available.Why
The tag loop catches each install error and then reports unconditional success. In JSON mode, it also drops every failure reason.
The same real source CLI process with fixture HTTP responses:
ok: true; no files; no errorsok: false; named HTTP 404 errorok: trueok: false; successful HTML preservedok: trueok: true;errors: []The issue includes a self-contained reproduction. Only HTTP responses are fixtures; dispatch, resolution, installation, filesystem writes and process exit handling use the real implementation.
Related work
Fixes #6084.
#4432 preserves warnings from successful installs. Open #5256 refreshes item manifests during discovery; neither handles failed file installation.
How
Collect per-item errors, derive JSON status from the collection and use the existing command-failure boundary after the batch finishes. The human summary marks incomplete installs as an error. Document the exit status and JSON fields.
Test plan
Validated on main
10c724bf5, Linux x86_64, Node 26.11.1, Bun 1.4.1 (repository pins 1.4.4), and Citty 0.2.2. CLI TypeScript checking reports a missing installed@aws-sdk/s3-request-presignerdependency through AWS Lambda source and no changed-file type errors. Full workspace checks have the same dependency limitation;mintis absent, so full docs validation was not run.