fix(recommendation): resolve --bundle-version LATEST to deployed versionId#1566
Open
jariy17 wants to merge 1 commit into
Open
fix(recommendation): resolve --bundle-version LATEST to deployed versionId#1566jariy17 wants to merge 1 commit into
jariy17 wants to merge 1 commit into
Conversation
…ionId `agentcore run recommendation --bundle-version LATEST` passed the literal string "LATEST" through to the config-bundle API path (.../configuration-bundles/<id>/versions/LATEST), which only accepts a concrete version UUID, so the command failed with a 400 validation error. The ab-test config-bundle path already resolves LATEST; the recommendation path did not. Resolve LATEST to the bundle's deployed versionId (looked up by ARN from deployed state) before building the request, mirroring the ab-test resolveConfigBundleVersion helper. When LATEST cannot be resolved (bundle not deployed) we surface a friendly ResourceNotFoundError instead of sending "LATEST" to the API. Adds unit tests for the new resolveBundleVersionId helper.
Contributor
|
Claude Security Review: no high-confidence findings. (run) |
Contributor
Package TarballHow to installgh release download pr-1566-tarball --repo aws/agentcore-cli --pattern "*.tgz" --dir /tmp/pr-tarball
npm install -g /tmp/pr-tarball/aws-agentcore-0.20.0.tgz |
agentcore-cli-automation
approved these changes
Jun 17, 2026
agentcore-cli-automation
left a comment
There was a problem hiding this comment.
LGTM — small, focused fix that mirrors the existing ab-test resolveConfigBundleVersion helper and addresses the 400 documented in #1565.
A few things I checked and was happy with:
- The handler's
resolvedBundleVersion === 'LATEST'guard correctly handlesopts.bundleVersion === undefined(no false positives), andbundleArnis guaranteed to be set by the earlierResourceNotFoundErrorbranch wheninputSource === 'config-bundle'. resolveBundleVersionIdlooks up by ARN across all targets, which is strictly more capable than the ab-test helper (which only matches by name) — this means it also works when the user passes--bundle-name <ARN>directly, as long as that ARN exists in deployed state.- Test uses real types and only stubs the
DeployedStateshape viaas unknown as; no excessive mocking. - This is a bug fix, not a new feature, and the existing
recommendationHandler.createflow has no telemetry instrumentation, so no new telemetry expected here.
No blocking issues from me.
Contributor
Coverage Report
|
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.
What
agentcore run recommendation --bundle-version LATESTnow resolvesLATESTto the config bundle's deployed version UUID before calling the recommendation API.Fixes #1565.
Why
The recommendation path passed the literal string
LATESTstraight through to the config-bundle API (.../configuration-bundles/<bundle-id>/versions/LATEST), which only accepts a concrete version UUID. The call failed with:The
run ab-testconfig-bundle path already resolvesLATEST(viaresolveConfigBundleVersion), so the two code paths were inconsistent. Users had to manually pass an explicit version UUID as a workaround.What changed
resolveBundleVersionId(bundleArn, versionRef, deployedState)inrecommendation/build-config.ts. It returns an explicit version verbatim, expandsLATESTto the bundle's deployedversionId(looked up by ARN from deployed state), and returnsundefinedwhenLATESTcan't be resolved (bundle not deployed). This mirrors the ab-test helper.recommendation/handler.tsnow resolves the version before building the request. IfLATESTcan't be resolved it surfaces a friendlyResourceNotFoundError("Runagentcore deployfirst, or pass an explicit version UUID.") instead of sendingLATESTto the API.resolveBundleVersionId(explicit passthrough, LATEST resolution, unresolved bundle, empty targets).Testing
npm run typecheck— passeslinton changed files — cleanvitest run src/cli/operations/jobs/recommendation/— 42 passed (incl. 4 new)@aws/agentcore0.20.0):--bundle-version LATESTpreviously returned a 400; the equivalent flow with an explicit UUID succeeds, and this change makesLATESTresolve to that same UUID.