Repository navigation
Conversation
|
Claude Security Review: no high-confidence findings. (run) |
48920b5 to
3177257
Compare
|
Claude Security Review: no high-confidence findings. (run) |
3177257 to
e4dd37d
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## refactor #2584 +/- ##
============================================
+ Coverage 96.33% 96.55% +0.21%
============================================
Files 671 697 +26
Lines 51321 56670 +5349
============================================
+ Hits 49439 54716 +5277
- Misses 1882 1954 +72 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Claude Security Review: no high-confidence findings. (run) |
|
Claude Security Review: no high-confidence findings. (run) |
3c9b321 to
b6c43b5
Compare
|
Claude Security Review: no high-confidence findings. (run) |
b6c43b5 to
7f7d0b9
Compare
|
Claude Security Review: no high-confidence findings. (run) |
7f7d0b9 to
742f041
Compare
|
Claude Security Review: no high-confidence findings. (run) |
agentcore migrate upgrades a v0 project to the v1 format without replacing any deployed resource. - One flow: every run computes the full read-only preview from scratch, shows a short summary on stdout (the full plan goes to agentcore/.cli/migrate/plan-<UTC>.md, which the git check ignores), then asks "Apply these changes?" on a terminal. --yes skips only the prompt; non-interactive and --json runs without --yes stop after the preview. There is no --dry-run. - Names: the converted agentcore.json sets migratedFrom: "v1", so the CDK library keeps every v0 physical name. - Stacks: logical IDs move to v1's with CloudFormation stack refactoring, one deployment target at a time (--target when several are deployed; others are recorded as pending and finished later with --target). Every step is recorded first in an atomic journal (agentcore/.cli/migration-state.json), so an interrupted run is finished or undone by running migrate again. - Deploying a target the journal still lists is refused, in the project manager's deploy (CLI, TUI, harness dev) and the v0 deploy delegation. - Any file added or changed in agentcore/cdk blocks, since migrating replaces it; files are compared with what each v0 release vended. - Only a 4xx from ExecuteStackRefactor counts as not started; other failures are unknown, keep the journal with the refactor ID, never put files back, and print the commands to check it. - Credential providers of a migrated project keep v0's bare names and are never deleted. - Migration is blocked until the CLI vends an @aws/agentcore-cdk release that honors migratedFrom (AGENTCORE_MIGRATE_CDK_LIBRARY overrides it for testing only). - Progress uses the shared runWithProgress task list on stderr, including the stack's resource events while a refactor executes. With the testing override, the summary and the next steps show the npm install command for the library the plan was made with.
742f041 to
341c5a5
Compare
|
Claude Security Review: no high-confidence findings. (run) |
AlexanderRichey
left a comment
There was a problem hiding this comment.
I pulled this down and tried to run it but ran into a few errors.
If I create a new project with the latest v0 CLI, deploy, and try to migrate, I get these errors:
Not ready to migrate: 3 issues need fixing first.
✖ cdk library: This CLI's v1 CDK app uses @aws/agentcore-cdk 1.0.0-rc.3, which doesn't keep v0 resource names (migratedFrom needs 1.0.0-rc.4 or later), so the first deploy…
✖ v1 synth: The CDK library the v1 app synthesized with doesn't support migratedFrom yet, so it can't keep this project's v0 resource names.
✖ stack plan skipped: the converted project's v1 CDK app didn't synthesize (see the v1 synth check)
I'd expect this to work as a main case.
This CLI's v1 CDK app uses @aws/agentcore-cdk 1.0.0-rc.3, which doesn't keep v0 resource names (migratedFrom needs 1.0.0-rc.4 or later), so the first deploy after migrating would replace this project's resources. Update the AgentCore CLI to a release with that library, then run agentcore migrate again.
Can we include the command the user has to run in this message so that it's clear how to fix?
agentcore/cdk isn't the CDK app a release that creates v0 projects (v0.4.0 to v0.31.1, 1.0.0-preview.1 to 1.0.0-preview.33) created; compared with v0 0.20.0 to…
Unclear what this means.
Description
Adds
agentcore migrate, which upgrades a v0 project to the v1 format without replacing any deployed resource. Runtimes, memories (and their data), gateways, evaluators and the rest keep their ARNs.One flow, every run
Every
agentcore migraterun computes the full read-only preview from scratch: checks, file changes, and the selected target's refactor and first v1 deploy. Nothing from an earlier run is saved or reused.Apply these changes? (y/N).--yesskips only the prompt. The checks still apply, and a not-ready preview never applies.--jsonruns without--yesprint the summary (or, with--json, the full plan as JSON) and stop, exiting 0 when ready and 1 when not.--dry-run.Output
migrateprints a short summary on stdout. The full plan (every check, the names table, every file, each stack's moves, and the first v1 deploy's changes per resource) goes toagentcore/.cli/migrate/plan-<UTC>.mdon every run, and the result of applying goes toresult-<UTC>.md. Migrate never reads these back, and the git check ignores the directory even when a project's.gitignoredoesn't. Progress (each step, and the stack's resource events while a refactor executes) uses the sharedrunWithProgresstask list on stderr.A plan that isn't ready lists one line per blocker, then the report path:
After applying, it prints one line per stack and the next step. A partial or unknown outcome keeps the refactor ID and the commands to check it on stdout. With
AGENTCORE_MIGRATE_CDK_LIBRARY(testing only), both the summary and the next steps include thecd agentcore/cdk && npm install <library> --no-savecommand, to run beforeagentcore deploy.Target selection
--target <name>is required; only that target is planned and refactored.There is no
--all-targetsflag.agentcore migrate --target <other>then migrates each one with its own fresh preview, built from the current v1 files and its still-v0 stack. That's what "finish pending migration" means; it isn't a separate mode.How migration keeps resources
v1 renames almost every CloudFormation logical ID, and most AgentCore resource names can't change after creation, so deploying v1 over a v0 stack would replace them. Migration avoids that in two parts:
migratedFrom. The convertedagentcore.jsongets"version": 2, "migratedFrom": "v1", where"v1"is the schema version the v0 CLI wrote. The CDK library then builds every physical name the v0 way.PolicyNamestay untouched.The journal
agentcore/.cli/migration-state.jsonis written atomically, before migrate changes anything. If it can't be written, nothing changes. It's updated as each step completes:writing→written→installed, plus where the v0 backup is.pending, orrefactoringwith the refactor ID once a refactor is created.A run stopped at any point is either finished or undone by running migrate again:
Unknown execute outcomes
Only a synchronous 4xx client error from
ExecuteStackRefactorcounts as "not started". Timeouts, 5xx errors, network errors and lost responses are unknown, and repeatedAVAILABLEreads aren't treated as proof. An unknown outcome:aws cloudformation describe-stack-refactor --stack-refactor-id <id> --region <r>andaws cloudformation list-stack-resources --stack-name <s> --region <r>A rerun reconciles using that ID.
Deploy precheck
Deploying a target the journal still lists as pending (or refactoring) is refused. The error names the target's account and region and points to
agentcore migrate --target <name>. Other targets deploy as usual.deploy, which covers the deploy command, the TUI and harness dev's auto-deploy, and in the v0 deploy delegation.agentcore/cdk file check
Migrating replaces
agentcore/cdkwholesale, so any added or modified file there blocks, and the preview lists each one with guidance to move the custom code out or revert it.node_modules,cdk.outanddist, compared (formatting aside) with what each release from v0.4.0 to v0.31.1 and 1.0.0-preview.1 to .33 vended. That data is generated from the release tags byscripts/generate-v0-cdk-apps.tsintov0CdkApps.ts.package.jsonmay differ only in dependency versions, since v0 deploys re-pin them.Other checks and the plan
@aws/agentcore-cdkhonorsmigratedFromharness.yaml, the v1 CDK app) and synthesized. The first v1 deploy is predicted with@aws-cdk/cloudformation-diff.CreateStackRefactor, with aTemplateURLthrough the CDK bootstrap bucket for templates over 51,200 bytes.ExecuteStackRefactor.Dependencies
@aws/agentcore-cdkrelease that honorsmigratedFrom, vended insrc/assets/cdk/package.json. Until then, the plan fails itscdk librarycheck.AGENTCORE_MIGRATE_CDK_LIBRARY(dev/test only) plans against a local library build; it warns loudly and never writes the override into the project.MIN_MIGRATED_FROM_CDK_VERSIONis bumped together with the vended pin.Related Issue
No public issue yet. This follows the reviewed v0→v1 compatibility and migration proposal, like #2575.
Documentation PR
The migration guide is in progress separately.
MIGRATION_DOCS_URLandPRESERVE_RESOURCES_DOCS_URLhold the expected page URLs, to be confirmed when it's published.command.mdis generated, so it isn't edited here.Type of Change
Testing
bun test: 4436 pass, 0 fail. The tests cover:--yes,--json, non-interactive runs, and the removed--dry-runagentcore/cdkfile check: added and modified files,package.jsonand lockfile rules, generated directories, old releases and previewsbun run test:e2e, or explained why they are not applicable. There's no migrate e2e suite yet. Earlier revisions were migrated live end to end on real deployed v0 projects (CodeZip and container, v0 0.31.1). Every ARN,createdAtand IAM RoleId and the memory data stayed identical throughmigrate --yesand the first v1 deploy, andcdk diffwas clean afterwards. Theagentcore/cdkfile check was also run over every v0 project on hand, and every unmodified one passes.bun run typecheckbun run lint:checkbun run format:checkbun run buildsrc/assets/, I updated affected snapshots withbun test <test-file> --update-snapshotsand committed them (not modified)Checklist
command.mdis generated; the migration guide is separate)@aws/agentcore-cdkrelease withmigratedFromis pending)By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.