fix(#907): default new agents to PYTHON_3_13 to avoid CloudFormation rejection#1172
Open
aidandaly24 wants to merge 3 commits intomainfrom
Open
fix(#907): default new agents to PYTHON_3_13 to avoid CloudFormation rejection#1172aidandaly24 wants to merge 3 commits intomainfrom
aidandaly24 wants to merge 3 commits intomainfrom
Conversation
added 3 commits
May 7, 2026 19:44
- Restore deleted unrelated tests in src/schema/__tests__/constants.test.ts (matchEnumValue, SDKFrameworkSchema, ModelProviderSchema, etc.) that were accidentally overwritten when the new DEFAULT_PYTHON_VERSION test was introduced. New tests are now appended, not replacing. - Add comments to PythonRuntimeSchema and DEFAULT_PYTHON_VERSION explaining why PYTHON_3_14 is kept in the enum (supported in us-west-2/us-east-1) but not the default (issue #907 / CFN rejection in other regions). - Note: secretlint version in package.json was not modified by this PR (^12.2.0 is already on origin/main); no change needed.
- Update schema-mapper.test.ts to assert against DEFAULT_PYTHON_VERSION
(resolves stale 'PYTHON_3_14' assertion that would have broken CI).
- Add regression invariants to constants.test.ts:
* DEFAULT_PYTHON_VERSION must not equal the newest entry in
PythonRuntimeSchema (prevents future lockstep bumps from re-opening #907).
* PYTHON_3_14 still accepted as explicit opt-in (documents intent).
agentcore-cli-automation
approved these changes
May 7, 2026
agentcore-cli-automation
left a comment
There was a problem hiding this comment.
Approving — the fix is minimal, targeted, and well-justified.
Verified locally:
DEFAULT_PYTHON_VERSIONis the single source of truth for the default Python runtime across the CLI: it's re-exported fromsrc/cli/tui/screens/{agent,generate,mcp}/*, used inAddAgentScreen.tsx(3 call sites),GatewayTargetPrimitive.ts(MCP creation),schema-mapper.ts, and both packaging paths (lib/packaging/python.ts,lib/packaging/index.ts). Flipping the constant fixes all of these in one shot.PYTHON_3_14remains a valid enum member ofPythonRuntimeSchema, so users inus-west-2/us-east-1who set it explicitly still work. The new JSDoc explains this well.- The existing tests that exercise
PYTHON_3_14(e.g.lib/packaging/__tests__/python.test.ts,schema/schemas/__tests__/agent-env.test.ts) only verify enum membership or version-string extraction, so they're unaffected by the default change. - The
AGENTS.md/ snapshot documentation enumerates all valid runtimes (not the default), so no snapshot update is needed.
No issues worth blocking on.
Out of scope for this PR (just flagging for tracking, not requesting changes):
DEFAULT_MCP_PYTHON_VERSIONinaws/agentcore-l3-cdk-constructsis stillPYTHON_3_14. That only matters for consumers who use the CDK constructs directly (without the CLI); the CLI's MCP path inGatewayTargetPrimitive.tspassesDEFAULT_PYTHON_VERSIONexplicitly, so CLI users are fine. The companion PR mentioned in the description should still land to close the gap for direct-CDK users.PYTHON_VERSION_OPTIONSinsrc/cli/tui/screens/mcp/types.tsstill labelsPYTHON_3_14as'Latest'and lists it first — but it's currently unused, so harmless.
Contributor
Coverage Report
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes the bug reported in #907: the CLI defaulted new agents to
PYTHON_3_14,which CloudFormation rejects with
AWS::EarlyValidation::PropertyValidationin regions other than
us-west-2/us-east-1. The resulting Change Setfails immediately and leaves the stack stuck in
REVIEW_IN_PROGRESS,requiring manual stack deletion to recover.
Root cause
DEFAULT_PYTHON_VERSIONinsrc/schema/constants.tswas set toPYTHON_3_14,so any new project created via
agentcore add agent(and any consumer thatfalls back to the default — e.g.
schema-mapper.ts,lib/packaging/python.ts,lib/packaging/index.ts) baked an unsupported runtime intoagentcore.json.Fix (minimal)
DEFAULT_PYTHON_VERSIONfromPYTHON_3_14→PYTHON_3_13.PYTHON_3_14inPythonRuntimeSchemaso users in supported regions(us-west-2 / us-east-1) can still opt in explicitly.
PythonRuntimeSchemaandDEFAULT_PYTHON_VERSIONthatreferences issue
PYTHON_3_14runtime accepted by CLI but rejected by CloudFormation #907 and documents why the default deliberately lags thenewest enum entry.
Tests
DEFAULT_PYTHON_VERSION (issue #907)describe block insrc/schema/__tests__/constants.test.ts:PYTHON_3_13(and notPYTHON_3_14)PythonRuntimeSchemaPYTHON_3_14is still accepted as an explicit opt-inPythonRuntimeSchema— prevents future lockstep bumps from re-openingPYTHON_3_14runtime accepted by CLI but rejected by CloudFormation #907src/cli/operations/agent/generate/__tests__/schema-mapper.test.tsto assert against
DEFAULT_PYTHON_VERSION(also pinning the literal'PYTHON_3_13'for clarity), exercising the consumer path that producesthe
agentcore.jsonruntime field.A companion PR in aws/agentcore-l3-cdk-constructs
on branch
fix/907-a15ec7feapplies the same default change toDEFAULT_MCP_PYTHON_VERSION.Related Issue
Closes #907
Documentation PR
N/A — no user-facing documentation change required. The behavior change is a
default-value adjustment with explanatory JSDoc added in source.
Type of Change
Testing
How have you tested the change?
npm run test:unitandnpm run test:integnpm run typechecknpm run lintsrc/assets/, I rannpm run test:update-snapshotsand committed the updated snapshotsTargeted runs:
npm run typecheckruns clean.Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.