Skip to content

feat(runtime): allow public BYO access-point mounts - #2936

Open
ksayee-aws wants to merge 1 commit into
aws:v1.xfrom
ksayee-aws:fix/public-byo-mounts
Open

ksayee-aws wants to merge 1 commit into
aws:v1.xfrom
ksayee-aws:fix/public-byo-mounts

Conversation

@ksayee-aws

@ksayee-aws ksayee-aws commented Nov 26, 2026 •

Copy link
Copy Markdown

Description

Allow agentcore add runtime to save Amazon EFS and Amazon S3 Files access-point mounts with networkMode: PUBLIC and platformVersion: V2.

The CLI keeps VPC validation unchanged, rejects PUBLIC mounts without V2, and rejects the preview for China deployment targets at both add and deploy time. The command help and China-region guide state the preview boundary.

Related Issue

Closes #2930

Documentation PR

Documentation is included in this PR through the CLI help and docs/china-regions.md.

Type of Change

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

Testing

  • I ran bun test
  • I ran the relevant end-to-end tests with bun run test:e2e, or explained why they are not applicable
    • Not run: this change validates project configuration and does not deploy AWS resources.
  • I ran bun run typecheck
  • I ran bun run lint:check
  • I ran bun run format:check
  • 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.

@ksayee-aws
ksayee-aws requested a review from a team November 26, 2026 13:51
@github-actions github-actions Bot added the size/m PR size: M label Nov 26, 2026
@ksayee-aws ksayee-aws changed the title feat(runtime): allow PUBLIC EFS and S3 Files mountsfeat(runtime): allow public BYO access-point mounts feat(runtime): allow PUBLIC EFS and S3 Files mounts Nov 26, 2026
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Nov 26, 2026
@ksayee-aws ksayee-aws changed the title feat(runtime): allow PUBLIC EFS and S3 Files mounts feat(runtime): allow public BYO access-point mounts Nov 26, 2026
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Nov 26, 2026
Comment thread src/projectSchemas/runtime.ts Outdated
}
const hasByo = efsCount > 0 || s3Count > 0;
if (hasByo && data.networkMode !== "VPC") {
const hasPublicByo = hasByo && data.networkMode === "PUBLIC" && data.platformVersion === "V2";

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.

This rejects two configs the service accepts, and demands a flag that changes nothing.

Probed against the real schema:

ACCEPT  PUBLIC + V2
REJECT  PUBLIC + no platformVersion   <-- false rejection
REJECT  no networkMode + V2           <-- false rejection
ACCEPT  VPC + no platformVersion

networkMode unset means PUBLIC. It's the service default, gateway.ts:193 defaults it, and line 444 of this same superRefine already uses !== "VPC". It's also a no-op in the template: the L3 keys off networkConfig, so networkMode: "PUBLIC" and unset synthesize byte-identical CloudFormation. Reproduced on this branch:

$ agentcore add runtime --name probe --language python --platform-version V2 \
    --filesystem-configurations '[{"efsAccessPoint":{...}}]'
Error: x efsAccessPoint and s3FilesAccessPoint filesystem mounts require
  networkMode: VPC, or networkMode: PUBLIC with platformVersion: V2

The user is on PUBLIC and did pass V2. The error tells them to do what they just did.

platformVersion unset is not the same as "not V2." Line 412: "Removing this keeps a deployed runtime on its current version." So an already-V2 runtime with the field removed is effectively V2, and the service — which checks the effective version — accepts the mount. This rejects it.

(The published L3 schema doc says unset means V1, contradicting line 412. Which is right decides whether this clause is correct — worth settling.)

Fix is one line and strictly closer to the service:

if (hasByo && data.networkMode !== "VPC" && data.platformVersion === "V1") {

The service already fails closed with a clear 400 on a version mismatch, so catching only an explicit V1 is the better trade. As written, hasPublicByo's inner hasByo && is also dead — line 560 already requires it.

Worth noting the inconsistency this creates: s3BucketMount deliberately leaves the V2 rule to the service (runtime.test.ts:382), while this adds a client rule stricter than it — same superRefine, same service rule, opposite policies.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed in d61d330. I verified VolumeConfigurationValidator.validateByoStorageNetworkMode: omitted network mode is neither VPC nor PUBLIC at create, and an unresolved platform version runs as V1, so both reject. I retained the explicit PUBLIC+V2 rule, removed the redundant inner hasByo, and split the schema matrix into focused message/path assertions.

flag(
"filesystem-configurations",
"filesystem mount configurations (JSON); an s3BucketMount needs --platform-version V2",
"filesystem mount configurations (JSON); public EFS and S3 Files access-point mounts require --network-mode PUBLIC and --platform-version V2 (Preview, commercial Regions only)",

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.

This drops the only user-facing warning for a live rule. The old string carried an s3BucketMount needs --platform-version V2; nothing else in the toolchain does. The CLI deliberately doesn't enforce it — runtime.test.ts:382 is it("leaves the platformVersion V2 rule to the service") — and neither does the L3. Probed: s3BucketMount + V1 parses clean. The only surviving copy is generated command.md, which the release workflow overwrites.

It also misleads about VPC. "access-point mounts require --network-mode PUBLIC and --platform-version V2" reads as the rule for access-point mounts generally. VPC needs neither flag and is the GA route, so a reader with only --help would think they must opt into a Preview to mount EFS at all. The schema message on runtime.ts:564 names both routes; this should match.

filesystem mount configurations (JSON); an s3BucketMount needs --platform-version V2;
EFS and S3 Files access-point mounts need --network-mode VPC, or --network-mode PUBLIC
with --platform-version V2 (Preview, commercial Regions only)

Minor: at 174 chars this is now the longest flag help in the file (next is --language at 149), and it skips the file's terse convention for version constraints — compare --hooks-configuration's "(JSON, V2 only)".

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed the VPC wording in d61d330: help now says EFS/S3 Files access-point mounts use VPC, or PUBLIC+V2 Preview. Per the requested feature scope, I left the unrelated s3BucketMount/Mountpoint warning unchanged.

Comment thread src/core/project/manager.tsx Outdated
"toolRuntimes",
]);

export const PUBLIC_BYO_MOUNTS_CN_MESSAGE =

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.

Nit — missing the doc comment every neighbour in this block has. BMA_CN_MESSAGE (:212), HARNESS_CN_MESSAGE (:221), MEMORY_STRIPPED_CN_MESSAGE (:323) and cnConnectorTargetMessage (:290) each carry a /** Shown when ... */ explaining when it fires and why the restriction exists. These two have none — and hasPublicByoAccessPointMount is the item here most in need of one, since it deliberately restates part of a rule that lives in projectSchemas/runtime.ts (see below).

Three smaller things while you're here:

  1. The helper splits the China-constants block, landing between CN_SUPPORTED_SPEC_COLLECTIONS (:274) and cnConnectorTargetMessage (:298), which is otherwise an unbroken run of message constants.
  2. Two names for one concept — the constant says PUBLIC_BYO_MOUNTS, the function says PublicByoAccessPointMount.
  3. The message omits GovCloud ("deploy to a supported commercial region") where BMA_CN_MESSAGE:213 says "commercial or GovCloud". Consistent with the new help text, so probably deliberate — just confirming the Preview really excludes GovCloud. Also BMA_CN_MESSAGE uses lowercase "region"; this PR introduces "commercial region" here, "commercial Regions" in the help, and lowercase "preview" in docs/china-regions.md.

On the helper's design: it checks networkMode === "PUBLIC" and not platformVersion === "V2", relying on the schema invariant that PUBLIC + BYO implies V2. That restraint is correct, and I'd rather have it than a redundant re-check. But the reliance is undocumented and untested — see my comment on manager.test.ts.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in d61d330: moved the helper beside the China add predicate, added the design JSDoc, renamed the constant to match the helper concept, and aligned commercial-region/Preview wording. The helper documents its reliance on the PUBLIC+V2 schema invariant.

if (input.resourceType === "harness") {
throw new RegionUnsupportedFeatureError(HARNESS_CN_MESSAGE);
}
if (input.resourceType === "runtime" && hasPublicByoAccessPointMount(input.resourceConfig)) {

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.

The overall placement is right, and I checked it properly rather than assuming.

Two guards rather than one is the correct call — a user can add the runtime before adding a China target, so an add-time check alone would leak.

I also traced every path a runtime spec can enter a project: add runtime (both flags and the TUI wizard, which funnel through the same addResource), add runtime --agent-id (Bedrock Agent import), export harness --arn, create/init templates, a hand-edited agentcore.json, a spec written by an older CLI, and migrate. The deploy guard covers all of them. I found no route by which a PUBLIC access-point mount reaches a China deploy.

One low-severity gap worth knowing about: export harness --arn bypasses addResource entirely and has no region guard of any kind, while templates/export.ts:274 copies networkMode and never sets platformVersion. Exporting a deployed PUBLIC harness that carries mounts therefore yields a spec rejected later with the generic mount message, giving no hint that the exporter dropped platformVersion. It's the one path where the config is machine-generated rather than user-typed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in d61d330. Exported PUBLIC access-point harness configurations now receive platformVersion V2, and a contract test proves the emitted runtime validates. VPC exports remain unchanged.

Comment thread src/core/project/manager.test.ts Outdated
}
}

test("deploy to a China target rejects public EFS or S3 Files mounts", async () => {

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.

Two mutations survive these tests. I ran both against the full suite:

Mutation Result
Drop runtime.networkMode === "PUBLIC" from the guard (manager.tsx:284) 5,264/5,264 pass
Drop || "s3FilesAccessPoint" in mount from the guard (manager.tsx:286) 5,264/5,264 pass
Replace the interpolated message here with the bare constant (manager.tsx:1658-1662) 187/187 pass

The first one matters most. Without the PUBLIC guard, the China check blocks all EFS and S3 Files mounts in China — including the VPC-mode mounts that are supposed to keep working — and nothing notices. There's no test pinning "a VPC-mode EFS mount still adds to, and deploys to, a China target." That's also the test that documents why the helper can safely skip the platformVersion check.

Compare the BMA sibling, which has three tests including an explicit negative at :1342 ("ignores BMA template markers without the explicit field").

The second means the hand-written half of the deploy message is untested. Line 1296 asserts only toContain(PUBLIC_BYO_MOUNTS_CN_MESSAGE); the BMA sibling at :1324 also asserts toContain("runtime 'environment_python_bma'"), pinning the interpolation. One line, right there, not copied.

The S3 Files one is the starkest. Both new tests (:991 and :1273) use only efsAccessPoint. The message, the helper name, the test names and docs/china-regions.md all say "EFS or S3 Files" — and the S3 Files half of the gate is asserted nowhere. Half the feature's China block has no regression guard.

Suggested additions:

  1. Parameterise both tests over efsAccessPoint and s3FilesAccessPoint.
  2. A negative test: VPC-mode EFS mount against a China target succeeds at both add and deploy.
  3. expect(String(error)).toContain("runtime 'environment_python'") alongside the existing assertion.

What these two tests already get right, and better than the schema test in the same PR: they assert the error type, the message, and the absence of side effects (checkedTools empty here, deployCalls empty at :1297). That's the right shape.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in d61d330. Add and deploy coverage now parameterizes EFS and S3 Files, asserts the interpolated runtime name, and includes explicit VPC-mode EFS regressions proving both China gates allow the VPC path.

Comment thread src/projectSchemas/runtime.test.ts Outdated
).toBe(false);
});
it("enforces filesystem counts, VPC dependency, and unique mount paths", () => {
it("enforces filesystem counts, network mode, platform version, and unique mount paths", () => {

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.

This test now carries four rules and seven bare .success assertions, and the first failure hides the rest.

Under a mutation that breaks one case, the suite reported 129 expect() calls against a baseline of 133 — four later assertions in this test never ran. The title is itself the signal: a comma list of four concerns means a failure gives you a line number and nothing else.

Two concrete consequences:

  1. The PUBLIC + V1 case (:272-279) asserts only false. It would still pass if the rejection came from an unrelated rule — a tightened ARN regex, a mount-path change — so it does not actually pin the platform-version rule it's named for.
  2. The first case (:266-271) — codeZipAgent + mounts with networkMode absent — silently changes meaning under the !== "VPC" fix I suggested on runtime.ts:559. It would quietly start testing something else rather than failing loudly. A path/message assertion would force that to surface.

This isn't a pre-existing-style argument, because the same file does better immediately around it: :207-222 uses it.each + toContainEqual(expect.objectContaining({ path, message })), and the s3BucketMount block (:383, :389, :399) is one named rule per it with expect(messages(result)).toContain(...). The messages() helper already exists.

Also missing, and they're exactly the gap cases from my runtime.ts:559 comment: no test for PUBLIC + absent platformVersion, and none for absent networkMode + V2. Both currently reject; neither is pinned either way, so there's no record of whether that's intended.

Suggested: split the network-mode and platform-version cases into their own named its using messages().

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in d61d330. Replaced the combined test with focused cases that assert the filesystemConfigurations issue path and exact message for PUBLIC+V1, omitted platform version, and omitted network mode, plus independent EFS/S3 Files, VPC, count, session-storage, and duplicate-path coverage.

Comment thread docs/china-regions.md Outdated
China target fails with an explicit message. Those `add` subcommands say "not available in
China regions" in their help, and the `agentcore add` menu warns when the project has a China
deployment target.
- **PUBLIC filesystem mounts:** The EFS and S3 Files access-point PUBLIC-mode preview is available only in commercial Regions. `agentcore add runtime` rejects PUBLIC EFS or S3 Files mounts when the project targets China, and `agentcore deploy` rechecks the saved runtime configuration.

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.

Nit — ~285 chars where this file's prose wraps at ~95. CI won't catch it: printWidth is 100, but prettier's default proseWrap: "preserve" doesn't reflow prose, so format:check passes.

The content itself is accurate and this is the right place for it.

Minor consistency: "commercial Regions" here vs "commercial region" in PUBLIC_BYO_MOUNTS_CN_MESSAGE; lowercase "preview" here vs "(Preview, ...)" in the help.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in d61d330. Reflowed the China documentation and aligned commercial-region and Preview casing with the runtime guard message.

@ksayee-aws
ksayee-aws force-pushed the fix/public-byo-mounts branch from 28ffb92 to d61d330 Compare November 30, 2026 20:13
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Nov 30, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Nov 30, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Nov 30, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.75%. Comparing base (eb75202) to head (d61d330).
⚠️ Report is 2 commits behind head on v1.x.

Additional details and impacted files
@@            Coverage Diff             @@
##             v1.x    #2936      +/-   ##
==========================================
+ Coverage   96.73%   96.75%   +0.01%     
==========================================
  Files         747      747              
  Lines       62845    62871      +26     
==========================================
+ Hits        60793    60829      +36     
+ Misses       2052     2042      -10     

☔ 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.

This branch has not been deployed

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

Labels

size/m PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support PUBLIC EFS and S3 Files access-point mounts in AgentCore CLI

3 participants