Repository navigation
feat(deploy): pin Box runtimes to AgentCore Runtime V2 - #2879
Conversation
Box runs only on AgentCore Runtime V2, and without platformVersion the service picks the platform, which can be V1. - A runtime can set "platformVersion": "V1" or "V2". create with a box template and add runtime in a Box project write "V2". - build and deploy refuse a runtime of a Box project whose platformVersion is not "V2", before the runtime sync rewrites agentcore.json. - deploy refuses a stack in which a V2 runtime's AWS::BedrockAgentCore::Runtime does not set PlatformVersion, which is what a @aws/agentcore-cdk from before platformVersion synthesizes.
leo237
left a comment
There was a problem hiding this comment.
Thanks @mquang-amazon. First pass from us. I read the diff against box-integration at 2379919, the L3 side (aws/agentcore-l3-cdk-constructs#474 and the v1.1.0 tag the CLI pins), and CI. All CI checks pass, and the branch is up to date with box-integration.
Verdict: COMMENT. The code looks correct to me. It is not merge-ready, because of the dependency the description already names.
Blocking for merge
- Unmet hard dependency. aws/agentcore-l3-cdk-constructs#474 is still open (not merged, not released), and
src/assets/cdk/package.jsonin this PR still pins@aws/agentcore-cdkto1.1.0. I checkedv1.1.0:AgentEnvSpecSchemathere is a plainz.object, so it strips the unknownplatformVersionand synth still succeeds. NoConfigValidationErrorlike theenableApplicationLogscase. But noPlatformVersiongets written either, soassertPlatformVersionswill refuse every Box deploy, andcreate/add runtimenow write the field into every new Box project. This PR is not a draft, so nothing stops a merge. Before this can merge, these need to land, in this order: (a) #474 merged into L3box-integration, (b) an@aws/agentcore-cdkrelease that includes it, (c) the pin bump insrc/assets/cdk/package.json, in this PR or one that merges first. Until then, please convert this PR to draft (or add a do-not-merge label) so the gate is enforced and not only described. Once those land I expect to approve. I have no blocking issue with the code itself.
Non-blocking
- Public description. This repo is public. Please remove the reference to the internal plan and tracking document from the "Related Issue" section of the description. "No GitHub issue" is enough. The diff and commit message are clean, I found no internal names or URLs in either.
- Fail-closed behavior, checked. A missing or renamed
RuntimeIdexport, a missing resource, and a non-literalPlatformVersion(Fn::If,Ref) all failPlatformVersionPropertiesSchema/ the equality check and refuse the deploy. Good. The export-name sanitizer matches L3'sexportName()inlogical-ids.ts, andRuntimeEnvironment.createOutputsexportsruntime.runtimeId, so the lookup is sound. Inline notes below cover the error text in the missing-export case and which runtimes get checked. - Tests. Small gaps, inline: no schema test (
V1/V2accepted,"v2"/other strings rejected) insrc/projectSchemas/runtime.test.ts. The build refusal covers onlyV1, not a missing field. No multi-runtime case forassertPlatformVersions(one good and one bad runtime, error names only the bad one). No test for a project that is not a Box project but sets"platformVersion": "V2". That project is checked post-synth, and I think that is right, but a test would lock it in. - #2878 interaction. Both PRs add Box/V2 gates at the same point in
deploy. When you rebase whichever merges second, consider one helper (for example spec check + region check) so the order is explicit. I suggest the region check first, since it does not depend on the user editingagentcore.json. - Migration UX. For existing Box projects, the
build/deploymessage is clear and actionable. An auto-fix (write"V2"during sync for a Box project with no field, with a step message) would be friendlier, but refusing is a reasonable choice. Your call. - Docs. README documents
containmentbut notplatformVersion. Worth a line once the L3 release is out. - Branch sync. This change is not on
box-integration-development, and it is not in the squash plan's PR list, so it needs a back-merge there after it lands.
Must-survive fixes (runsInBox/assertBoxRuntimesHaveBoxVersion, assertPrivateVpcs, containment, Box gateway logs notice) are untouched. The diff only adds code. The new tests use tmpdir()/join, spawn nothing and make no AWS calls.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## box-integration #2879 +/- ##
================================================
Coverage 96.79% 96.80%
================================================
Files 766 766
Lines 66803 66879 +76
================================================
+ Hits 64665 64741 +76
Misses 2138 2138 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- Check every runtime that names a platformVersion after synth, V1 included and not only in a Box project (runtimePlatformVersions), each against its own value. - A runtime the stack exports no RuntimeId for gets its own message, since the cause may be a renamed export, not an old CDK library. - Test the schema's accepted and refused values, and the build refusal for a Box runtime with no platformVersion as well as V1. - The validation comment says the check runs before the runtime sync rewrites agentcore.json.
leo237
left a comment
There was a problem hiding this comment.
Re-review at 42599ee. Thanks for the follow-up commit: the post-synth check now covers every runtime that names a platformVersion (V1 included, Box or not), a missing RuntimeId export gets its own message, the schema tests cover "v2"/"V3"/"", the build refuses a Box runtime with no field, and there's a multi-runtime test. The JSDoc wording is fixed too.
Still blocking: the aws/agentcore-l3-cdk-constructs#474 dependency. #474 is still open. No released @aws/agentcore-cdk writes PlatformVersion: the branch pins 1.1.0, and base's 1.2.0 doesn't write it either (I checked the published 1.2.0 tarball). The new commit doesn't add a capability check, version gate, or warn-instead-of-refuse fallback. So if this merges now, every Box deploy fails after synth, and create/add write a field that every deploy then rejects. This now also affects any non-Box project that sets platformVersion. The body says "Do not merge before that", but the PR isn't a draft and has no label, so nothing stops a merge. Please mark it draft (or add a do-not-merge label) until #474 is released and the pin is bumped, or degrade safely when the installed library can't write the field.
Non-blocking, still open:
- The "Related Issue" section still names an internal plan. Please replace it with a generic note. (The commit messages are clean.)
- The "update it to a release that has platformVersion" message points at a release that doesn't exist yet (inline).
- README/docs don't mention
platformVersion. - The branch is behind
box-integration(pin 1.1.0 vs 1.2.0). It merges cleanly, but please back-merge. - FYI: a trial merge with #2878's head conflicts in
boxValidation.ts,manager.tsx, andmanager.test.ts. The suggestion to combine the two gates (region check first) still stands.
CI: Analyze, Windows, and CodeBuild e2e pass. Linux and macOS were still pending when I posted.
tejaskash
left a comment
There was a problem hiding this comment.
Thanks, the code is correct: every path that adds a runtime to a Box project writes V2, non-box templates are unchanged, and the post-synth check fails closed. Requesting changes for where the Box rule lives and a test gap (inline), plus:
- This needs L3 #474 merged and released first, as leo237 noted, since the pinned
@aws/agentcore-cdkdoesn't acceptplatformVersion. - The branch conflicts with
box-integrationinboxValidation.ts,manager.test.tsandmanager.tsx. - Existing projects need two steps, add
platformVersionand then update the library inagentcore/cdk, but the messages only name one. When the pin is bumped, could the post-synth message give the exact step, and the description state both?
…d.deploy Addresses the review of #2879: deleting the assertPlatformVersions call left every test passing. A deploy test with a V2 runtime whose synthesized template has no PlatformVersion now fails without it.
…e-v2-platform-version # Conflicts: # src/core/project/manager.tsx
…e-v2-platform-version
… 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.
|
On the two-step note for existing projects: Box is not released, so there are no existing Box projects to migrate. A project made before this change can add |
leo237
left a comment
There was a problem hiding this comment.
Re-review at 3d7a347 (since 42599ee). I read only this PR's own commits (7cf5184, f7cb88e, 3d7a347). The other commits in the range come from back-merging box-integration.
Addressed since our last review
- The post-synth message no longer tells users to update to a release that doesn't exist (7cf5184). Thanks.
- The branch is now even with
box-integration, and GitHub reports it as mergeable. Moving the rule into the schema also removed themanager.tsxcall sites that conflicted with #2878. - Two of tejaskash's points are addressed too. The
CdkBackend.deploywiring now has a test (f7cb88e). The Box/V2 rule now sits inProjectSpecSchema.superRefinebeside the Box gateway rule (3d7a347). I traced every path that adds a runtime to a Box project:createwith a box template,addBoxRuntime, and the docs runtime path. Each one writes"V2". Harness export is refused for Box projects (assertNotBoxProject), and so is a Bedrock Agent import (boxRuntimeInput). So no command can produce a Box spec that the new schema rule rejects. The schema tests cover V2 accepted, missing/V1 refused, both issues reported together, and non-Box projects left alone.
Still blocking: the L3 release and pin bump. aws/agentcore-l3-cdk-constructs#474 has now merged into L3 box-integration, but it hasn't been released yet. npm's latest @aws/agentcore-cdk is 1.2.0, and this branch still pins 1.1.0 in src/assets/cdk/package.json. So if this PR merges as it stands, every Box deploy is refused after synth. The PR is also still not a draft (isDraft: false, no label), although the reply on the assembly.ts thread says it is. Please convert it to draft, or bump the pin to the release that includes #474 in this PR. No later commit on box-integration-development bumps the pin either: it pins 1.0.2. This change isn't in the squash plan (https://pippin.amazon.dev/docs/XFRmP1pP9L90nl/box-integration-squash-and-pr-plan-v2), so no planned PR covers it.
Non-blocking
- Test accuracy (inline): the new
CdkBackend.deploytest is named for the "stack does not set PlatformVersion" case, but it asserts the missing-RuntimeId-export message. It still guards the wiring, since deleting the call fails it, but the name or the comment should match. - Silent failures: none found. The schema rule fails closed for both a missing field and V1. The post-synth check is unchanged and still fails closed.
- Issue path (inline nit): the new issue reports
path: ["runtimes"].["runtimes", i, "platformVersion"]would point zod's pretty-printer at the exact field. This matches the neighbouring rules, so it's optional. - Comment accuracy (inline nit): the schema comment says "
agentcore createandadd runtimewrite it, so every command stops on a Box runtime without it". That "so" doesn't follow. Maybe "…write it; a Box runtime without it (a hand edit, or a project from before this change) stops every command." - The PR description still says "build and deploy refuse a runtime of a Box project…, before the runtime sync". With the rule in the schema, every command now refuses at load. Please update the description, including the sample message, which now reads
Runtime "agent" has …, … Set "platformVersion": "V2" on the runtime in agentcore.json. - Stale comment in
manager.test.ts: thetest.eachthat moved toresolvestill sits underdescribe("FsProjectManager.build")with the "an existing Box project has no platformVersion, the common case" lead-in. That's minor, but the test now covers project load, not build. - Still open from before: README/docs don't mention
platformVersion, and the change needs a back-merge tobox-integration-developmentafter it lands.
No new types. assertBoxRuntimesOnRuntimeV2 is removed, and nothing references it anymore.
CI at 3d7a347: macOS verify passes, and e2e is skipped. Analyze, Linux verify and Windows verify were still pending when I posted.
Verdict: COMMENT, because of the unreleased L3 dependency and the PR not being in draft. The code itself looks right. Once the pin is bumped to a release that includes #474, or the PR is a draft until then, I expect to approve.
# Conflicts: # src/core/project/manager.test.ts
…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.
…e-v2-platform-version
leo237
left a comment
There was a problem hiding this comment.
Re-review at 88d212d (last review: 3d7a347). New since then: 3fae8e6 (the Runtime V2 region check now refuses any runtime with "platformVersion": "V2" and names it; assertBoxRegionSupported is renamed assertRuntimeV2RegionSupported) and two back-merges of box-integration, which include #2878 and #2886.
Blocker, still open: the @aws/agentcore-cdk pin. src/assets/cdk/package.json still pins 1.1.0. On npm, latest is 1.2.0, published 2026-11-20, and no later version exists. aws/agentcore-l3-cdk-constructs#474 merged into L3 box-integration on 2026-11-23, and the L3 compare shows v1.2.0...#474's merge commit as diverged (24 ahead, 10 behind). So no published release contains #474. If this merges now, the post-synth assertPlatformVersions check refuses every Box deploy. No commit on box-integration-development bumps the pin (it pins 1.0.2 there), and the squash plan does not cover this (https://pippin.amazon.dev/docs/XFRmP1pP9L90nl/box-integration-squash-and-pr-plan-v2). The PR description says the same thing ("Do not merge before that"). This needs an L3 release with #474 and a pin bump to it, either in this PR or merged into the base first.
Merge state: origin/box-integration (2f9422d) is an ancestor of the head, and GitHub reports MERGEABLE. The overlap with #2878 in manager.tsx is resolved, and I found no conflicts.
CI: verify / Linux, verify / macOS, verify / Windows and Analyze were still pending when this was posted (e2e skipped). I have not seen results for 88d212d.
3fae8e6 (new):
- Correctness looks right. The schema requires
V2on every runtime of a Box project, so filtering onplatformVersion === "V2"covers Box runtimes. It also covers non-Box runtimes that ask for V2, which would otherwise fail partway through CloudFormation. An empty project and explicitV1runtimes still pass. One behavior change is worth knowing: a Box-project runtime without aboxblock was let through before. It is now refused in a region without V2. That is correct, because the schema pins it to V2 and CloudFormation could not create it there. - Test coverage: the new test covers the single non-Box runtime (
it asks). The plural branch (they askplus the comma-joined names) has no test. See the inline nit. - Comment accuracy (nit): the two call-site comments in
manager.tsx(around L1812 and L1846) still say "Box runs only on AgentCore Runtime V2, so stop ...". The check now applies to any runtime asking for V2. Something like "A runtime on Runtime V2 cannot be created in a region without it, so stop ..." would match.
Earlier non-blocking notes still open (not repeating detail):
- The
CdkBackend.deploytest name says "does not set platformVersion", but the test exercises the missing-RuntimeId-export branch (inline thread oncdk.test.ts). - The schema issue uses
path: ["runtimes"]instead of["runtimes", index, "platformVersion"](inline thread onproject.ts). - The "so every command stops" wording in the
project.tsschema comment. - The PR description still says build and deploy refuse. Since 3d7a347, every command that loads
agentcore.jsonrefuses. - The moved test in
manager.test.tsstill sits under the build tests with an outdated lead-in. - README and docs do not mention
platformVersion. - This needs a back-merge to
box-integration-development, which still lacks this work (it pins@aws/agentcore-cdk1.0.2 and has noplatformVersion).
Addressed since last review: none of the items above. 3fae8e6 addresses a #2878 review point instead.
Leaving this as COMMENT because of the unreleased-L3 pin blocker. Everything else is non-blocking.
tejaskash
left a comment
There was a problem hiding this comment.
Approving. Both earlier requests are fixed: the Box V2 rule is in ProjectSpecSchema.superRefine and reports with the project's other problems, and deleting the post-synth check now fails cdk.test.ts. The field, type and template property agree with L3 #474, and the region check from #2878 now keys on platformVersion === "V2", which also covers a non-Box runtime that asks for V2 and still lets an empty Box project tear down.
The 1.1.0 pin in src/assets/cdk/package.json does not block this merge: a Box project cannot synth with 1.1.0 or 1.2.0 even before this PR (boundRuntime, discoveryPrefix, enableApplicationLogs and projectType are unknown keys there), so every Box deploy already needs an L3 box-integration build. With one at or after f011b1a (the merge of #474) the check passes. Bump the pin once L3 box-integration is released, and update the "Depends on" text in the description.
For anyone testing now: use an L3 box-integration build at or after f011b1a in agentcore/cdk, and add "platformVersion": "V2" to each runtime of a Box project made before this PR.
Follow-ups:
src/core/project/backends/cdk/assembly.ts:224-229: the message says no released@aws/agentcore-cdksets the field yet and to deploy again after a release. Someone on an L3 build from beforef011b1aneeds to rebuild L3, not wait. Drop the "no released" clause now, and name the minimum version and the step in the pin bump.src/projectSchemas/project.ts:185-187: the rule requires V2 on every runtime of a Box project, including one with nobox. That matches what we asked for. Skip runtimes withruntime.box === undefinedonly if you want it to followrunsInBox.src/core/project/backends/cdk.test.ts:625: the test name says the stack "does not set"platformVersion, but it reaches the missing-runtime branch. Rename it to say it checks the platformVersion after synth, before deploying.src/core/project/manager.test.ts:1564repeatsproject.test.ts:618, and thetest.eachatmanager.test.ts:2304-2322repeatsproject.test.ts:602. Delete the first and keep one case of the second.src/core/project/boxValidation.ts:135-141: with two runtimes the message reads "Cannot deploy runtime 'a', 'b'". Use "runtimes" when there is more than one, and add a two-runtime test.- The description still says build and deploy refuse the runtime before the runtime sync, and quotes the old message. The rule is in the schema now.
Description
Box runs only on AgentCore Runtime V2. Without
platformVersiononCreateAgentRuntime, the service picks theplatform, and its V2 default reaches only the accounts its rollout selects, so a Box runtime can land on V1. This PR
pins every runtime of a Box project to V2.
Schema: a runtime can set
"platformVersion": "V1"or"V2"(src/projectSchemas/runtime.ts). No default, soprojects that are not Box projects are unchanged.
create / add runtime:
agentcore createwith a box template, andadd runtimein a Box project, write"platformVersion": "V2"on the runtime.build and deploy refuse a runtime of a Box project whose
platformVersionis not"V2", before the runtimesync rewrites
agentcore.json:deploy, after synth: refuses a stack in which a V2 runtime's
AWS::BedrockAgentCore::Runtimedoes not setPlatformVersion: "V2". A@aws/agentcore-cdkfrom beforeplatformVersiondrops the field without an error, asassertPrivateVpcsguards for containment. The runtime's resource is found through the<stack>-<runtime>-RuntimeIdexport the CDK library writes.Existing Box projects need
"platformVersion": "V2"added to each runtime; build and deploy say so.Depends on
PlatformVersionfrom the runtime'splatformVersion. Until it isreleased and the
@aws/agentcore-cdkpin insrc/assets/cdk/package.jsonis bumped, the post-synth check refusesevery Box deploy, because the pinned library writes no
PlatformVersion. Do not merge before that.deployinmanager.tsxas feat(deploy): refuse Box projects in regions without AgentCore Runtime V2 #2878 (refuse Box projects in regions without Runtime V2), sowhichever merges second has a small conflict.
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: the changed test files pass (manager.test.ts,manager.box.test.ts,assembly.test.ts,269 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, and one test needsboxon PATH.bun run test:e2e, or explained why they are not applicable(CI does not run them for you): not run; a Box deploy needs the L3 release first.
bun run typecheck: no errors in the changed files; the 53 it reports also occur without this change(same stale SDK).
bun run lint:checkbun run format:check(on the changed files)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)Tests added: create writes
V2only for box templates; add runtime writesV2; build and deploy refuse a missingfield and
V1and leaveagentcore.jsonunchanged; a project that is not a Box project deploys without the field;assertPlatformVersionsacceptsV2and refuses a missing value,V1, and a runtime with noRuntimeIdexport. Theexport name and
Fn::GetAttshape were checked against a stack synthesized by the L3 branch.Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.