Skip to content

feat(deploy): refuse Box projects in regions without AgentCore Runtime V2 - #2878

Merged
mquang-amazon merged 6 commits into
box-integrationfrom
box/runtime-v2-regions
Nov 23, 2026
Merged

mquang-amazon merged 6 commits into
box-integrationfrom
box/runtime-v2-regions

Conversation

@mquang-amazon

@mquang-amazon mquang-amazon commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Description

Box runs only on AgentCore Runtime V2 (platformVersion: "V2"). agentcore deploy now refuses a
Box project ("projectType": "box") whose target is in a region without V2. The check runs as
soon as the target is known, before the runtime sync rewrites agentcore.json and before any
build or AWS call:

Cannot deploy Box project 'example' to target 'primary' in us-west-1: Box runs on AgentCore
Runtime V2, which is not available in us-west-1. Set a target in another region in
agentcore/aws-targets.json, then retry.

Blocked: ap-south-2 (Hyderabad), us-west-1 (N. California), the aws-us-gov partition, and
the isolated partitions (aws-iso, aws-iso-b, aws-iso-f). The list is a denylist in
src/core/partition.ts (supportsRuntimeV2), so a region the CLI does not know counts as having
V2 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" with PLATFORM_VERSION_V2_NOT_AVAILABLE in a
region 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 the
isolated 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. With
that 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

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Testing

How have you tested the change?

  • I ran bun test: src/core/partition.test.ts and src/core/project/manager.test.ts pass
    (231 tests). The full run has 31 failures that also fail without this change; my local
    node_modules has @aws-sdk/client-bedrock-agentcore 3.1153.0 instead of ^3.1171.0.
  • I ran the relevant end-to-end tests with 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.
  • I ran bun run typecheck: no errors in the changed files; the 53 errors it reports also occur
    without this change (same stale SDK).
  • I ran bun run lint:check
  • I ran bun run format:check: the changed files are formatted (the pre-commit hook ran
    Prettier on them).
  • I ran bun run audit
  • I ran bun run secrets:check
  • I ran bun run build
  • If I modified src/assets/, I updated affected snapshots with bun test <test-file> --update-snapshots and committed them
  • If I re-recorded fixtures or golden files, every change beyond account identifiers is explained
    by this PR
  • This PR does not change command.md (the release workflow regenerates it)

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.

@mquang-amazon
mquang-amazon requested a review from a team November 20, 2026 20:42

@leo237 leo237 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. Internal names in a committed code comment. The first commit's JSDoc in src/core/partition.ts named an internal-only package and a config path. ceb0a75b removed them, so the current head is clean. That first commit still has the text, so please squash-merge, which keeps it out of the box-integration history.

Non-blocking (approving; none of these block)

  1. 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.
  2. Default-target path runs before the check. When no target exists and --target is default, provisionDefaultTarget calls STS (resolveAccount) and writes agentcore/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 run supportsRuntimeV2(input.region) for a Box project before provisioning, or reword the description. A test for this path (no aws-targets.json, Box project, region: "us-west-1") would pin whichever behavior you choose.
  3. aws-iso-e and aws-eusc are not in the partition denylist. The SDK partition data the CLI uses (@aws-sdk/core 3.978.0) defines aws-iso-e (eu-isoe-*) and aws-eusc (eusc-de-*) as well. Neither is denylisted, so they count as having V2. The comment says "the isolated partitions", but aws-iso-e is missing from that set. If leaving them out is intended (fail-open), please say so in the comment. Otherwise add them, and add an eu-isoe-west-1 case to the test.
  4. 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.
  5. Create/add do not warn. agentcore create / add of a Box project with --region us-west-1 still 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.
  6. Branch hygiene. The branch is a few commits behind box-integration (no conflicts). The change is not on box-integration-development, so it will need a back-merge there to keep the two branches in sync. The CDK follow-up that pins PlatformVersion: "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.

Comment thread src/core/partition.ts Resolved
Comment thread src/core/project/manager.tsx Resolved
Comment thread src/core/project/boxValidation.ts Resolved
@codecov-commenter

codecov-commenter commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.79%. Comparing base (76261f6) to head (6f78b4f).
⚠️ Report is 22 commits behind head on box-integration.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

mquang-amazon added a commit that referenced this pull request Nov 21, 2026
- 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 leo237 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 no aws-targets.json. The new test checks both: resolveAccount is never called and the file does not exist afterwards.
  • Partitions: aws-iso-e is now on the denylist. I checked the SDK version this repo locks (@aws-sdk/core 3.978.0 partition data): it maps eu-isoe-west-1 to aws-iso-e and eusc-de-east-1 to aws-eusc, so both new test cases test real behavior. Leaving aws-eusc off 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 --region hint. 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/add for 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.
mquang-amazon added a commit that referenced this pull request Nov 23, 2026
… 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 tejaskash left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving now that it is rebased. Follow-ups, in this PR or the next one:

  1. 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 to us-west-1 or ap-south-2 with an earlier build cannot remove it. Refuse only when a runtime runs in a box, and add a test for the empty Box project in us-west-1.
  2. 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.
  3. When aws-targets.json already 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."
  4. 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, mainly us-west-1 and ap-south-2. A region blocked by mistake cannot be deployed to until a new CLI release, because there is no override.
  5. Optional: the new tests sit under describe("China (aws-cn) deployment targets") in manager.test.ts:1570-1642, and the three-region test.each repeats what partition.test.ts covers. 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.
@mquang-amazon

Copy link
Copy Markdown
Contributor Author

Thanks @tejaskash. In faea6f2:

  1. Reproduced: an empty Box project deployed to us-west-1 was refused, so its stack could not be removed. The check now refuses only when a runtime runs in a box, with a test for the empty Box project in us-west-1.
  2. For the default target, the message now says "Deploy with --region set to a region that has it, or with --target set to a target in another region" when aws-targets.json has targets.
  3. The Box region tests have their own describe and one region; partition.test.ts keeps the list.

2 (the rule as "a runtime that asks for V2") goes in #2879, once this PR merges: #2879 brings platformVersion, and every Box runtime there is V2, so one rule covers Box runtimes, other V2 runtimes, and an empty project, and names the runtime. 4: confirmed with the Runtime team: us-west-1 and ap-south-2 have no Runtime V2.

@leo237 leo237 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 create with a box template in a region without V2 prints a warning and still creates the project. The CLI and the wizard both use boxRegionWarning. The check uses hasBoxProfile, the same rule that decides whether create writes projectType: "box", so the warning fires exactly when deploy would later refuse. The tests cover three regions (including GovCloud), a box template in us-west-2, a template that is not a box template in us-west-1, and the wizard flow. Create writes no aws-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). otherTargets switches the default-target message to --target, and a test asserts that text.
  • Test placement (Tejas's item 5). The tests now have their own describe and use one region.

Non-blocking

  1. Comment accuracy (boxValidation.ts, the JSDoc of assertBoxRegionSupported). "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 no box. Suggested wording: "A Box project with no runtime that runs in a box is let through".
  2. 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.
  3. agentcore add still gives no warning for a box runtime added to a Box project. Create covers the main case, so this can wait.
  4. 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-development yet, 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.

@mquang-amazon
mquang-amazon merged commit 3ed9033 into box-integration Nov 23, 2026
2 of 5 checks passed
@mquang-amazon
mquang-amazon deleted the box/runtime-v2-regions branch November 23, 2026 22:06
mquang-amazon added a commit that referenced this pull request Nov 23, 2026
…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.
@mquang-amazon

Copy link
Copy Markdown
Contributor Author

Point 2 is in #2879 (3fae8e6): the region check now refuses each runtime with "platformVersion": "V2", in a Box project or not, and names it, so a V2 runtime outside a Box project no longer gets as far as CloudFormation. Every Box runtime asks for V2 there, as the project schema requires, and an empty project still deploys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants