You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: resolve the gateway target for A/B test invocation URLs (#1854) (#1874)
* fix: stop putting the runtime name in A/B test invocation URLs (#1854)
`getInvocationUrl` built config-bundle URLs from `record.agent` — the RUNTIME
name — but a gateway invocation path segment must be a gateway TARGET name.
Whenever the two differed, every request to the printed URL failed:
{"success":false,"error":"No Target found for Target name: CustomerSupportAB"}
A config-bundle test has no target of its own to substitute. Its variants are
configuration bundles, it attaches to the whole gateway, and the service splits
traffic with a gateway rule — so the path segment is whichever gateway target
the caller invokes, which the CLI cannot know. (Confirmed against the service:
config-bundle tests store only `configurationBundle` per variant, and the
config-bundle e2e creates one on a gateway with no targets at all.)
So report the gateway base URL and name what to append, rather than guessing a
path that 404s. Target-based tests are unchanged — their variants *are* targets,
so `variants[0].targetName` is a real path.
Gateway URL: https://<gatewayId>.gateway.bedrock-agentcore.<region>.amazonaws.com
→ append /<gateway-target>/invocations (see `agentcore status --json`)
`view ab-test --json` reports `gatewayUrl` + `invocationUrlHint` for
config-bundle tests instead of `invocationUrl`, so scripts reading
`.invocationUrl` get nothing rather than a URL that fails. Target-based keeps
`invocationUrl` unchanged.
Also corrects two comments that documented the bug as intended behaviour:
`docs/ab-tests.md` ("config-bundle uses the agent name") and a claim in
RunABTestFlow that targets deploy as `${project}-${target}` — the L3 CDK
deploys each target under its spec name verbatim.
* fix: resolve the gateway target for A/B test invocation URLs (#1854)
Config-bundle tests printed an invocation URL built from the runtime name, but a
gateway path segment must be a gateway TARGET name, so requests 404'd with
"No Target found for Target name: <runtime>".
Resolve the gateway target(s) fronting the runtime at create time — the link
lives in `agentCoreGateways[].targets[].httpRuntime.runtime`, which create()
already loads — and persist the result on the record:
- exactly one match -> `targetName` -> a complete `invocationUrl`
- several matches -> `targetCandidates` -> `invocationUrlCandidates` (pick one)
- none -> neither -> `gatewayUrl` + `invocationUrlHint`
This fixes both same-name and different-name configurations (the previous
gateway-base-only output regressed the same-name case and left the workflow
manual), and keeps `.invocationUrl` populated whenever a single target is known.
The runtime name is never used as the path. Target-based tests are unchanged.
`getInvocationUrl` stays synchronous — resolution happens once at create and is
read from the record — so `view --json`, `printABTestDetail`, and the TUI detail
view need no plumbing changes.
Also corrects two comments that documented the bug as intended behaviour.
---------
Co-authored-by: jariy17 <tjariy+jariy17@users.noreply.github.com>
0 commit comments