Repository navigation
fix(cli): await the command promise in the adk CLI entrypoint - #929
Merged
AmaadMartin merged 1 commit intoSep 23, 2026
Merged
Conversation
Every action handler in cli.ts is async, so parse() dropped the promise it built and the entrypoint's try/catch could never see a rejection. A failing command reached Node's unhandled-rejection path instead of the intended console.error. parseAsync() returns that promise, so a chained .catch() reports the error the way the entrypoint always meant to. A top-level await is not an option here: dev/build.js runs an esbuild cjs pass, which rejects top-level await.
Collaborator
|
Merging in about 6h unless someone objects. Close this PR, add |
Collaborator
|
Merging in about 1h unless someone objects. Close this PR, add |
adk-foundry-approver
approved these changes
Sep 23, 2026
adk-foundry-approver
left a comment
Collaborator
There was a problem hiding this comment.
Approved automatically by ADK Foundry. No human has read this change.
This approval attests only that the change passed the gates below, all
enforced in code:
- the merge critic read the diff and approved it (93.9% precision measured
against 107 upstream pull requests with known maintainer outcomes) - ? changed lines across ? file(s), inside the 200/5 ceiling
- no auth, credential, security, release or dependency-manifest path touched
- required checks green, re-verified immediately before this approval
- opened 25h ago and visible as
automerge: scheduledthroughout,
with no objection from anyone
To stop this merging, close the pull request or add status/on-hold. To stop
the mechanism entirely, revoke this account's access; delivery continues and
nothing merges.
Merged
prasanna8585
pushed a commit
to prasanna8585/adk-js
that referenced
this pull request
Nov 10, 2026
Every action handler in cli.ts is async, so parse() dropped the promise it built and the entrypoint's try/catch could never see a rejection. A failing command reached Node's unhandled-rejection path instead of the intended console.error. parseAsync() returns that promise, so a chained .catch() reports the error the way the entrypoint always meant to. A top-level await is not an option here: dev/build.js runs an esbuild cjs pass, which rejects top-level await.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to Issue or Description of Change
Problem:
dev/src/cli_entrypoint.tscallscreateProgram().parse(process.argv)inside a synchronoustry/catchblock. Everyadksubcommand registers anasyncaction handler, soparse()discards the returned promise. If an action rejects, thetry/catchblock misses the error and Node reports anunhandledRejection.Solution: Call
createProgram().parseAsync(process.argv)and attach a.catch()handler that logs the error and setsprocess.exitCode = 1. Add unit tests indev/test/cli_entrypoint_test.tscovering async action rejections, synchronous parse failures, and--helpexits.Testing Plan
Unit Tests:
Ran
npx vitest run --project unit:dev dev/test/cli_entrypoint_test.ts(4 passed).Checklist