Repository navigation
feat(deploy): refuse Box projects in regions without AgentCore Runtime V2 - #2878
Conversation
leo237
left a comment
There was a problem hiding this comment.
Thanks for this. The check is small and in the right place: deploy() resolves exactly one target (--target, or the synthesized default), and assertBoxRegionSupported runs on that target's region before syncRuntimeBuilds, applyBoxNetwork and the backend. Every later step reads target.region, so no other region source (such as AWS_REGION) gets past the check. A multi-target project is refused only for the bad target. The manager test confirms that agentcore.json stays unchanged and that the backend is never called. The unit tests cover every denylisted region and partition and pass a region the CLI does not know. Failing open for unknown regions is documented, and I think it is the right choice. The must-survive Box fixes (assertBoxRuntimesHaveBoxVersion / runtimeRunsInBox, per-runtime profiles, --containment, the logs notice) are untouched.
Resolved during review
- Internal names in a committed code comment. The first commit's JSDoc in
src/core/partition.tsnamed an internal-only package and a config path.ceb0a75bremoved them, so the current head is clean. That first commit still has the text, so please squash-merge, which keeps it out of thebox-integrationhistory.
Non-blocking (approving; none of these block)
- PR description: please remove the internal-only links. The "Where the region list comes from" section links to internal source and config files and names internal flags and validators. Please drop those links and names from the public description. The public AgentCore Regions link plus a short sentence is enough.
- Default-target path runs before the check. When no target exists and
--targetisdefault,provisionDefaultTargetcalls STS (resolveAccount) and writesagentcore/aws-targets.json, and only then does the new check refuse. So "before any build or AWS call" in the description holds only for configured targets. This does no harm, and the message tells the user to edit that file. Still, you could runsupportsRuntimeV2(input.region)for a Box project before provisioning, or reword the description. A test for this path (noaws-targets.json, Box project,region: "us-west-1") would pin whichever behavior you choose. aws-iso-eandaws-euscare not in the partition denylist. The SDK partition data the CLI uses (@aws-sdk/core3.978.0) definesaws-iso-e(eu-isoe-*) andaws-eusc(eusc-de-*) as well. Neither is denylisted, so they count as having V2. The comment says "the isolated partitions", butaws-iso-eis missing from that set. If leaving them out is intended (fail-open), please say so in the comment. Otherwise add them, and add aneu-isoe-west-1case to the test.- Error message wording. "Set a target in another region in agentcore/aws-targets.json" has the right path, but it is a bit vague. Something like "Change the region of target 'primary' in agentcore/aws-targets.json, or deploy with --target to a target in another region" names both ways out.
- Create/add do not warn.
agentcore create/addof a Box project with--region us-west-1still succeed, and the user learns about the problem only at deploy. A follow-up notice at create time would be friendly. This is out of scope here. - Branch hygiene. The branch is a few commits behind
box-integration(no conflicts). The change is not onbox-integration-development, so it will need a back-merge there to keep the two branches in sync. The CDK follow-up that pinsPlatformVersion: "V2"is fine as a separate PR.
CI at review time: CodeQL: pass; verify / Linux: pending; verify / Windows: pending; verify / macOS: pending; Analyze: pass; AWS CodeBuild us-east-1 (agentcore-e2e): pass. Please merge only after verify is green on all three OSes.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## box-integration #2878 +/- ##
===================================================
+ Coverage 96.78% 96.79% +0.01%
===================================================
Files 766 766
Lines 66590 66800 +210
===================================================
+ Hits 64452 64662 +210
Misses 2138 2138 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- Refuse a Box project before deploy provisions the default target, so an unsupported --region makes no STS call and writes no aws-targets.json. - Add aws-iso-e to the partitions with no Runtime V2, and say that the European Sovereign Cloud counts as having it, as an unknown region does. - The error names both ways out: change the target's region, or deploy with --target to another target; for the default target, --region.
leo237
left a comment
There was a problem hiding this comment.
Re-review of 6f78b4f. Still approved. Please merge only after verify / Linux|Windows|macOS pass; they were pending when I posted. CodeQL, Analyze and the CodeBuild e2e job pass.
Addressed
- Ordering: for a new project, the check now runs before
provisionDefaultTarget, so a refused region makes no STS call and writes noaws-targets.json. The new test checks both:resolveAccountis never called and the file does not exist afterwards. - Partitions:
aws-iso-eis now on the denylist. I checked the SDK version this repo locks (@aws-sdk/core3.978.0 partition data): it mapseu-isoe-west-1toaws-iso-eandeusc-de-east-1toaws-eusc, so both new test cases test real behavior. Leavingaws-euscoff on purpose, with a comment saying why, is a reasonable choice. - Error message: it now names both fixes (change the target's region, or use
--target), and the default-target case gets a--regionhint. The tests assert the full text. - Commit messages: no internal references.
Still open (non-blocking)
- PR description: it still names an internal planning doc under "Related Issue". Please replace that with a generic line. The description is also out of date: it shows the old error text, leaves out
aws-iso-e, and still says "before any build or AWS call" without mentioning the default-target case. - A friendly warning in
create/addfor a Box project in a blocked region is still a follow-up. - Please squash-merge and back-merge to
box-integration-development, as discussed.
FYI
The branch merges cleanly into box-integration (it is 21 commits behind). A trial merge with #2879 conflicts in boxValidation.ts and manager.test.ts; manager.tsx auto-merges. Whichever PR lands second will need a rebase.
…e V2 Box runs only on AgentCore Runtime V2 (platformVersion V2). Deploy now refuses a Box project whose target is in a region without V2 (ap-south-2, us-west-1, GovCloud, and the isolated partitions), before the runtime sync rewrites agentcore.json. Other regions, including new ones the CLI does not know, are allowed.
- Refuse a Box project before deploy provisions the default target, so an unsupported --region makes no STS call and writes no aws-targets.json. - Add aws-iso-e to the partitions with no Runtime V2, and say that the European Sovereign Cloud counts as having it, as an unknown region does. - The error names both ways out: change the target's region, or deploy with --target to another target; for the default target, --region.
create with a box template in a region where AgentCore Runtime has no V2 now warns that the project cannot be deployed there, from the CLI and the wizard alike. It still creates the project: the region at create is often only the one the CLI resolved, and the project can deploy to a target in another region. Deploy stays the hard stop.
f857b05 to
9553bdd
Compare
… project schema Addresses the review of #2879: the rule reads projectType and a runtime field, like the other cross-resource Box rules in ProjectSpecSchema, so it moves there from build and deploy. Every command that reads agentcore.json now stops on a Box runtime without "platformVersion": "V2", and zod reports it with the project's other problems at once. The build and deploy call sites, which conflicted with #2878, go. Box is unreleased, so an existing Box project without the field is not migrated: add the field, or create the project again.
tejaskash
left a comment
There was a problem hiding this comment.
Approving now that it is rebased. Follow-ups, in this PR or the next one:
- A Box project with no runtime is refused in a region without Runtime V2 (
src/core/project/boxValidation.ts:115). Deploying an empty project is how the CLI removes a stack, so anyone who deployed a Box project tous-west-1orap-south-2with an earlier build cannot remove it. Refuse only when a runtime runs in a box, and add a test for the empty Box project inus-west-1. - Once #2879 and L3 #474 are both in, a runtime with
"platformVersion": "V2"outside a Box project passes this check and then fails in CloudFormation. The rule should become "a runtime that asks for V2", which also covers item 1. Whichever PR lands second should make that change and name the runtime in the message. - When
aws-targets.jsonalready has a target in another region, the message still says to add one. Suggested text: "Deploy with --region set to a region that has it, or with --target set to a target in another region." - The public AgentCore Regions page has no Runtime V2 row. It lists "Runtime microVMs" and "Runtime Instances", and neither matches the list in
src/core/partition.ts:21. Please confirm the list with the Runtime team, mainlyus-west-1andap-south-2. A region blocked by mistake cannot be deployed to until a new CLI release, because there is no override. - Optional: the new tests sit under
describe("China (aws-cn) deployment targets")inmanager.test.ts:1570-1642, and the three-regiontest.eachrepeats whatpartition.test.tscovers. One region is enough there.
…nd name --target when there are targets Addresses Tejas's review of #2878: - A Box project with no runtime was refused in a region without Runtime V2, and deploying an empty project is how its stack is removed, so a stack deployed there by an earlier build could not be torn down. The check now refuses only when a runtime runs in a box. - For the default target, the message names --target when aws-targets.json already has targets, instead of saying to add one. - The Box region tests get their own describe, with one region: the region list itself is partition.test.ts's.
|
Thanks @tejaskash. In faea6f2:
2 (the rule as "a runtime that asks for V2") goes in #2879, once this PR merges: #2879 brings |
leo237
left a comment
There was a problem hiding this comment.
Re-review from 6f78b4f to faea6f2. The branch was rebased, so 6f78b4f is not in the new history. I checked that its patch is in 0961edff with no changes, so this review covers what came after: 9553bdd1 (a warning at create time), the merge of box-integration, and faea6f25 (Tejas's follow-ups). Still approved.
Addressed since my last review
- Create now warns.
agentcore createwith a box template in a region without V2 prints a warning and still creates the project. The CLI and the wizard both useboxRegionWarning. The check useshasBoxProfile, the same rule that decides whether create writesprojectType: "box", so the warning fires exactly when deploy would later refuse. The tests cover three regions (including GovCloud), a box template inus-west-2, a template that is not a box template inus-west-1, and the wizard flow. Create writes noaws-targets.json, so the advice in the warning (deploy with--region) works as written. - The empty Box project (Tejas's item 1). The check now refuses only when a runtime
runsInBox, so an empty Box project can still be deployed, which is how its stack gets removed. There is a test for it. - The message when targets already exist (Tejas's item 3).
otherTargetsswitches the default-target message to--target, and a test asserts that text. - Test placement (Tejas's item 5). The tests now have their own
describeand use one region.
Non-blocking
- Comment accuracy (
boxValidation.ts, the JSDoc ofassertBoxRegionSupported). "A Box project with no runtime is let through" is narrower than the code. The code also lets through a Box project whose runtimes have nobox. Suggested wording: "A Box project with no runtime that runs in a box is let through". - A weak assertion in "deploy of a Box project with no runtime to us-west-1 is not refused". It checks only
not.toBeInstanceOf(RegionUnsupportedFeatureError), so the test still passes if deploy fails for any other reason. Asserting that the backend deploy was called, as the test for a project that is not a Box project does, would show the removal path really runs. agentcore addstill gives no warning for a box runtime added to a Box project. Create covers the main case, so this can wait.- Still open from before: the PR description is out of date (error text, the default-target ordering, the planning-doc reference), and Tejas's items 2 and 4 (the V2-per-runtime rule after #2879/L3 #474, and confirming the region list with the Runtime team). None of this is on
box-integration-developmentyet, and the squash plan (https://pippin.amazon.dev/docs/XFRmP1pP9L90nl/box-integration-squash-and-pr-plan-v2) has no later PR for it, so please back-merge after the squash-merge, as discussed.
CI and merge state
GitHub reports the PR as mergeable, with no conflicts. On faea6f2, verify / Linux|Windows|macOS and Analyze were still queued when I posted, and e2e was skipped. Please merge only after verify passes on all three OSes.
…without it, by name Addresses Tejas's review of #2878 (point 2): with platformVersion in the schema, a runtime outside a Box project could ask for V2, pass the region check, and fail in CloudFormation partway through the deploy. The check now refuses each runtime with "platformVersion": "V2" and names it. Every Box runtime asks for V2, as the project schema requires, so Box projects are covered, and an empty project still deploys, which is how its stack is removed.
|
Point 2 is in #2879 (3fae8e6): the region check now refuses each runtime with |
Description
Box runs only on AgentCore Runtime V2 (
platformVersion: "V2").agentcore deploynow refuses aBox project (
"projectType": "box") whose target is in a region without V2. The check runs assoon as the target is known, before the runtime sync rewrites
agentcore.jsonand before anybuild or AWS call:
Blocked:
ap-south-2(Hyderabad),us-west-1(N. California), theaws-us-govpartition, andthe isolated partitions (
aws-iso,aws-iso-b,aws-iso-f). The list is a denylist insrc/core/partition.ts(supportsRuntimeV2), so a region the CLI does not know counts as havingV2 and needs no CLI release; remove a region from the list once V2 launches there. Projects that
are not Box projects are unaffected.
Where the region list comes from
AgentCore Runtime rejects
platformVersion: "V2"withPLATFORM_VERSION_V2_NOT_AVAILABLEin aregion where V2 has not launched. The AgentCore Runtime team confirmed that V2 is available in
every region where AgentCore Runtime is
(https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/agentcore-regions.html) except
Hyderabad (
ap-south-2), N. California (us-west-1) and AWS GovCloud. It is not available in theisolated partitions either. China (
cn-north-1,cn-northwest-1) has V2, so it is not blocked.A follow-up in the CDK library pins
PlatformVersion: "V2"on the runtimes of a Box project. Withthat pin, CloudFormation would also fail in these regions, but only after build and upload, and
with a stack rollback instead of this message.
Related Issue
No GitHub issue. Tracked in the Beatbox plan ("Bugs, Findings, AIs", "support Box on Runtime V2 in
V2 supported regions alone").
Documentation PR
Not applicable.
Type of Change
Testing
How have you tested the change?
bun test:src/core/partition.test.tsandsrc/core/project/manager.test.tspass(231 tests). The full run has 31 failures that also fail without this change; my local
node_moduleshas@aws-sdk/client-bedrock-agentcore3.1153.0 instead of^3.1171.0.bun run test:e2e, or explained why they are not applicable(CI does not run them for you): not run; the check fires before any AWS call.
bun run typecheck: no errors in the changed files; the 53 errors it reports also occurwithout this change (same stale SDK).
bun run lint:checkbun run format:check: the changed files are formatted (the pre-commit hook ranPrettier on them).
bun run auditbun run secrets:checkbun run buildsrc/assets/, I updated affected snapshots withbun test <test-file> --update-snapshotsand committed themby this PR
command.md(the release workflow regenerates it)Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.