Repository navigation
Conversation
Grant only the exact execution role to CloudFormation. Correct recursive policy hashing and include the generated inline policy; bump bundle to 1.7.0.
…ands" This reverts commit 62cce37d8f942560be2bbee08e2a046acfb0fd8d.
Reverts 4ea7e88. Suffixing the CloudWatch dashboard and CloudFront OAC names with the Region fixes a real multi-Region collision, but it is unrelated to the MicroVM P3 lifecycle and renames (replaces) live resources for every existing deployment, including AgentCore-only ones. Keeping it out of this PR narrows the change to aws-samples#645; it should ship on its own with its own upgrade note. Refs aws-samples#645 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
cdk/src/migration/{template,permissions}.ts were imported only by their own
tests and had no script, mise task or documented entry point; the explicit
microvm_nested_stack requirement means a migration command is a follow-up,
not part of this PR. The three agent/scripts probes are one-off diagnostics
that nothing in the repo, CI or docs references. verify_microvm_credentials.py
stays because agent/tests/test_continuation_sdk_probe.py imports it.
Refs aws-samples#645
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
approve-task.ts and deny-task.ts carried identical ~60-line blocks for the approval_decision_recorded audit write and the best-effort MicroVM wake that this PR added. Move them to recordDecisionPostCommit in a separate module so the handler tests' module mock of wakeMicrovmAfterApproval still applies. Behaviour, event shapes and error handling are unchanged. Refs aws-samples#645 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The migration helpers were dropped from this PR, so the verification docs should no longer list reusable migration commands as an open PR check or refer to the removed template/permission helpers. The API approve/deny check on PARKED tasks was completed at bf7c271. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@ayushtr-aws, thanks for the review at Blocking
Non-blocking, addressed: approve/deny duplication (now Non-blocking, deferred: the Validation:
Ready for re-review when you have time. |
Connections idle through a long MicroVM suspend can be dropped by the VPC endpoint/NAT idle timeout (350 s) without a reset. After wake, a model call sent on such a socket waited for Claude Code's 300 s default before retrying; live approvals asleep ~7 min stalled 246-276 s per hit. Default API_TIMEOUT_MS=120000 for MicroVM tasks, alongside the existing UV_LINK_MODE default. It bounds only the wait for response headers; streamed bodies keep their own idle watchdog. Explicit values win. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Under a linked-worktree git hook, inherited GIT_DIR/GIT_INDEX_FILE override -C and sent this helper's init/add/commit into the real repository; a fixture commit then re-ran the pre-commit suite. Strip GIT_* and disable hooks, as test_continuation_workspace already does (aws-samples#855). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # cdk/src/constructs/registry.ts # cdk/test/constructs/registry.test.ts
0f97216 to
6c52cc6
Compare
Bring in aws-samples#912 (optional network stack, 490-resource budgets, compute_types) and aws-samples#943. Beyond the conflict resolutions: - gate MicroVM resources on compute_types; keep the nested-stack and suspend gates - reapply runtime env and grant changes inside the optional AgentCore block; the SessionRole keeps the approval tables - extend SessionRole and orchestrator overflow nag exceptions to the continuation prefix and the MicroVM image version suffix - census profiles select the nested MicroVM layout and an artifact digest; every inline profile now fits, so the expected rejections are removed - disable console test-invoke on the approval-request API - deduplicate the vault keys both branches added to the platform-config contract and its fixtures - map the developer-guide budgets subsection to its split page so the stricter link check passes - tests count MicroVM resources across nested stacks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…m the PR Narrow the PR without changing behaviour: - remove cdk/test/live/* (manual probes, never collected by Jest) - remove the rendered-site link checker and its docs:build hook; it is independent of MicroVM and can land on its own - revert incidental .dockerignore and package.json encoding changes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The service terminates a MicroVM whose /suspend hook answers any non-200 status, without retry (live: "Suspend lifecycle hook returned HTTP status 409"). The guest refused unsafe suspends with 409/503 expecting the worker to keep running, so a decision racing the orchestrator's suspend, or a slow drain, killed the VM and failed the task. Answer an unsafe suspend with 200 "declined" and leave the coding barrier open: the VM freezes with memory intact and the supervisor wakes a worker suspended outside a valid gate. A resume after a declined suspend answers 200 "not-suspended" without forcing a credential refresh behind an open barrier. Non-200 remains only where nothing is left to protect: no registered task, or a permanently closed barrier; a failed wake after an acknowledged suspend still fails so continuation recovery owns the task. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bring in aws-samples#917 (bind stack-wide-verified Linear deliveries to the sole active workspace). The only conflict was the comment-routing preamble in linear-webhook-processor.ts: keep aws-samples#917's workspace binding first so approval replies, which this branch routes from the comment path, also see the attested workspace. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`handlers/shared/` holds modules several Lambdas import; it does not mean backend-agnostic. The 17 modules this PR added there are all MicroVM-only, which their location hid. Move them to `handlers/shared/microvm/` (and their tests to `test/handlers/shared/microvm/`), dropping the redundant `microvm-` prefix, and update every relative import plus the constants drift check, contracts doc and cdk/AGENTS.md. `microvm-regions.ts` predates this PR and stays put. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
P3 lets an agent wait for human approval while its MicroVM sleeps or retires with a verified checkpoint. A later decision wakes the original worker or admits one replacement with the saved conversation and workspace. Unanswered approvals remain available by default; explicit deadlines remain supported.
Linear users can reply
approveordenyunder the approval comment. The service verifies the actual comment through Linear’s API, rejects bots and the saved OAuth token’s own identity, and applies the task owner’s decision to that request. CLI decisions work on all backends; sleep and replacement are MicroVM-specific.Area
cdk— infrastructure, handlers and permissionsagent— runtime and imagecli— task and approval settingsdocs— guides and design sourcestooling— contracts, packaging and CIRelated
ADR-021 P3 for #645, including remaining P2 prerequisites. Related follow-ups: #817, #841 and #857. AgentCore remains the default compute backend.
Changes
truefor new/already-nested installations,falsefor existing flat installations. Omission fails synthesis. Flat-to-nested migration tooling is out of scope for this PR (follow-up). Group stateless scheduled maintenance in a separate nested stack while retaining existing tables and MicroVM identities. Both layouts are covered across all image, gateway and vault configurations by the 490-resource budget.Current head (
6c52cc6a)main(fix(registry): name the Provider waiter state machine under the stack prefix (#865) #911). The conflict was in the registry waiter state machine name: this PR tookmain's<root-stack>-AgentRegistryWaiternaming and dropped its ownNames.uniqueResourceNameversion (only one registry exists per deployment). Full build passed: 5,669 CDK tests (256 suites), 2,241 agent tests (86.80%), 1,005 CLI tests, lint.t <t@t>/Test <test@example.test>(test(agent): git fixtures leak into the shared .git/config under an inherited GIT_DIR — make the isolation structural (4th recurrence of #622/#720) #855). Trees are unchanged.Hook-safe test fixtures (
bf72bdf5)agent/tests/test_continuation_runtime.pygit fixtures now strip inheritedGIT_*and disable hooks. Under a linked-worktree pre-commit hook they had written into the real repository and re-triggered the hook (test(agent): git fixtures leak into the shared .git/config under an inherited GIT_DIR — make the isolation structural (4th recurrence of #622/#720) #855). Agent quality: 2,241 passed, 86.80%.Post-wake stall fix (
3b16c1ed)Post-wake stall fix, found by the approve/deny test on the redeployed fixture:
API_TIMEOUT_MS=120000(agent/src/server.py; test andagent/README.mdupdated). Streamed responses keep their own idle watchdog, so long generations are not cut off.ACTIVE). A re-test with ~7 minutes asleep had no stall: the approved task finished 58 s after its decision (PR opened), the denied task 18 s after; noapi_retryevents and no gaps over 60 s after wake.Scope reduction (
03136489)Scope reduction after the fourth review, with no behaviour change:
cdk/src/migration/*and their tests) and three unreferenced diagnostic probes underagent/scripts/.cdk/src/handlers/shared/approval-decision.ts.main(fix(observability): allow CloudWatch SNS alarm publishing (#925) #926, fix(deps): clear urllib3, brace-expansion, fast-uri osv advisories #932).Net vs
bf7c271dbefore the merges: 17 files, +166/−1,385. Full local build passed: 5,669 CDK tests (256 suites), 2,241 agent tests (86.8% coverage), lint and synth; the docs check and link check passed. GitHub checks passed at10777d5e.Redeployed
10777d5eto the retained nested fixture inus-east-1from a repackaged artifact: CloudFormationUPDATE_COMPLETE, MicroVM image 3.0ACTIVE, approve/deny functions have the concurrency table. A post-deploy no-approval smoke task completed on MicroVM in 210 s and opened a PR. Its worker terminated.Review fixes (
bf7c271d)uvinstalls to copies after reproducing Linux cache hardlinks. Confirm termination conflicts withGetMicrovmbefore treating cleanup as successful.Local full build passed with DynamoDB Local and real SDK continuation probes enabled: 5,758 CDK tests (261 suites), 2,254 agent tests (86.84% coverage), and 1,005 CLI tests, plus lint, type checks, synthesis and documentation. The final agent diagnostic change passed another complete 2,254-test quality run. Final layout compatibility and heartbeat checks passed 25 tests, with CDK lint/compile passing. The documentation build and internal links passed across 82 pages; all three live-harness inspection commands ran without AWS calls.
Deployed
bf7c271dto the retained nested fixture inus-east-1: CloudFormationUPDATE_COMPLETE, MicroVM image 3.0, AgentCore runtime 4, and coordinator version 5. Four deployed Lambda code hashes match the reviewed assets; approve/deny functions have the concurrency table and shared limit. Verified 26 baseline stateful resource identities were preserved. Latest-head GitHub checks passed.Both live Cognito-authenticated API decision cases passed after a saved checkpoint, sleep, source-worker loss and
PARKED: approval and denial started replacement workers in 11.7s and 12.3s. Approval performed exactly one Read; denial performed none and acknowledged the decision. Both tasks completed, their workers terminated, and scheduled cleanup closed leases and returned capacity to zero. These are the API routes used by CLI decisions; no interactive CLI command was used. Tests used an explicit 30-second sleep delay with a test-only policy, leaving the ten-minute default unchanged. The fixture configuration was restored exactly; final checks found no active tasks, open leases or held slots. Cleanup follows the five-minute reconciliation schedule. This already-nested update does not verify flat-to-nested migration. Earlier results below retain their recorded revisions.Scope and remaining tradeoffs
This PR includes the trusted approval writer, Linear replies, retained-request default, shared maintenance stack and MicroVM layout selection. Test-only migration helpers, unreferenced probes and the unrelated dashboard/OAC renames were removed to reduce scope. Maintainer agreement on this expanded scope and the proposed ADRs remains open. The
@aws-sdk/client-ssmdependency supports the runtime suspend setting; build-workflow changes make DynamoDB Local and the pinned SDK recovery probes required in CI. These are intentional dependency/CI changes, not incidental cleanup.Nonblocking optimization remains: eager transcript append repeatedly copies/encodes history (a local synthetic 1,000-frame run took about 5.5 seconds cumulatively). Replacing checkpoint readback with
HeadObjectmust preserve checksum/version validation and recovery after a lost upload reply. Broad type/handler refactors and restored-scope revalidation are deferred rather than mixed into lifecycle corrections. Known launch rejections still share the conservative unknown-outcome capacity hold; earlier release needs a durable, operation-specific rejection classification.Validation
Review validation at
159576e6(eight focused commits after the third review):worker_attempt_idvalidator; 22 broker unit tests passed. Source tracing shows this field carries the platform launch/lease token, not AWS’s physical MicroVM identifier.denycomment. The human body and author stayed unchanged. This verifies the current app-token installation; no historical approval threads were modified.159576e6. The silent-failure scan and its rule tests pass. Lint, type checks, contracts, documentation and infrastructure synth pass. The full build and all PR checks passed at that revision.159576e6successfully to the retained isolated fixture after pausing submissions and draining tasks, leases and capacity. Verified the new approval API, AgentCore runtime version 3, and MicroVM image 2.0 against the built image/artifact references. Seven live IAM simulation checks passed: own-task invocation/read allowed; other-task or untagged invocation and direct approval writes denied. The borrowed Linear vault and shared logging settings remain unchanged and functional.Live stress validation and capacity fix at
7384f9b0:TransactionConflict. Bounded retries preserve the exact transaction, idempotency token and worker-lease conditions. An isolated live reproduction went from 6/12 successful releases to 12/12; concurrent admission still accepted exactly 10/12. All 71 focused unit/transaction tests and the full local build passed: 5,723 CDK, 2,231 agent, 1,005 CLI tests.The later main merge at
2a79c0eretains this fix; its CI is separate from the live deployment above.Earlier live approval-boundary validation used the actual approval service and Python signing client: 34 AWS checks covered creation, field rejection, task/tag isolation, denied direct writes, timeout races and MicroVM lease fencing; nine IAM simulation checks also passed. These were isolated API tests with task records for all three backends, without coding-agent images.
Earlier coding-agent tests additionally covered explicit expiry/cancellation and AWS access after credential expiry. Those earlier configurations remain separate from the latest-image cases above. Retained Linear fixtures and reproducible integration harnesses stay outside this public PR.
Before marking ready
159576e6); full local build and live stress validation passed for capacity fix7384f9b0.2a79c0e).35f05bbb).bf7c271d).10777d5e).mainare a follow-up. Until then, existing flat installations keepmicrovm_nested_stack=false.Review decisions and limits
ADR-023 records the approval writer, rollout and retained-request decision. No default approval expiry is deliberate; zero is the no-expiry sentinel and the positive timeout range starts at 30 seconds. Worker/resource lifetime remains separate. A public SigV4 endpoint is intentional, with task-path IAM authorization.
This protects approval-record writes, not complete isolation from compromised ambient compute credentials: those credentials can still select session tags, and legacy channel bundles still include the webhook signing key. Action descriptions and policy metadata are worker assertions.
TIMED_OUTcurrently also includes worker polling failures and is not proof that a human deadline elapsed. These limits are documented rather than presented as solved by the writer API.The normal pipeline propagates failed terminal writes, while a superseding cancellation is benign and does not produce a false failure reaction. Actual pipeline entry points and the outer runtime's unhealthy response after a failed backup write are tested. Pure transaction conflicts get bounded retries; failed ownership checks do not. The continuation scan cursor uses compare-and-set to preserve progress when old and new schedules overlap during upgrade. Existing orchestrator heartbeat/backend monitoring handles lost running workers; a second broad
RUNNINGreaper was not added. Checkpoint field renames or hash-encoding consolidation require a versioned migration, not a style-only edit.Deployment notes
Re-bootstrap to bundle 1.9.0 or later. For the approval permission change, pause submissions and drain existing tasks, including suspended workers and retained continuations; deploy CDK and the matching rebuilt image together. Old workers lose direct approval-write access and fail closed at their next gate. See the upgrade procedure.
Automatic suspension remains behind the deployment compatibility gate, which defaults off. Once enabled, the default sleep delay is ten minutes. MicroVM deployments must now explicitly select
microvm_nested_stack: usetruefor new/already-nested installations and retainfalsefor existing flat installations. Omission fails synthesis. Explicitly selectingtruedoes not migrate a flat deployment. Regenerate old cloud assemblies before deploying. This PR does not include flat-to-nested migration tooling; that is a follow-up.Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution under the terms of the project license.