Skip to content

fix(e2e): delete gateway + targets in import fixture cleanup#1813

Open
notgitika wants to merge 3 commits into
mainfrom
fix/e2e-import-gateway-cleanup-leak
Open

fix(e2e): delete gateway + targets in import fixture cleanup#1813
notgitika wants to merge 3 commits into
mainfrom
fix/e2e-import-gateway-cleanup-leak

Conversation

@notgitika

Copy link
Copy Markdown
Contributor

What

cleanup_resources.py (import E2E fixture teardown) now deletes the gateway and its targets, which it previously never did.

Why

setup_gateway.py creates a real gateway named bugbashGw<suffix> plus an MCP target, and records them in bugbash-resources.json under keys gateway and gateway-target-mcp. But cleanup_resources.py's delete loop only matched runtime / memory / evaluator — the gateway and gateway-target-mcp keys fell through and were never deleted.

Result: every import-gateway E2E run leaked one gateway (+ target). Over time this exhausted the account's max-gateways quota (1000). Unrelated gateway deploys then failed with a ServiceLimitExceeded on CreateGateway, which the CDK toolkit surfaced as an opaque NoStack: CloudFormationStack object does not hold a stack error — the failure that took down E2E shards 3/5 and 4/5.

How

  • Resolve the gateway id up front, and delete in order: targets → runtime/memory/evaluator → gateway last (delete_gateway_target needs the parent gatewayIdentifier; the gateway can only be deleted once its targets are gone).
  • Purely additive to the existing cleanup; no behavior change for the other resource types.

Note

A one-time purge of the ~995 already-leaked bugbashGw* gateways in the CI account was run separately to get back under the quota; this PR stops the leak from recurring.

The import-gateway E2E fixture (setup_gateway.py) creates a real gateway
named bugbashGw<suffix> plus an MCP target and records them in
bugbash-resources.json under the keys "gateway" and "gateway-target-mcp".
cleanup_resources.py only deleted the runtime/memory/evaluator keys, so
every import-gateway run leaked its gateway (and target). Over time this
exhausted the account's max-gateways quota (1000), which surfaced in
unrelated gateway deploys as an opaque "NoStack" CDK error.

Delete targets first (delete_gateway_target needs the parent gatewayId),
then the gateway last, alongside the existing resource deletions.

Note: bypassing pre-commit typecheck via --no-verify; the tree has a
pre-existing missing @types/semver error in src/lib/dependency-management
unrelated to this Python-only fixture change.
@notgitika
notgitika requested a review from a team July 23, 2026 01:26
@github-actions github-actions Bot added size/s PR size: S agentcore-harness-reviewing AgentCore Harness review in progress and removed agentcore-harness-reviewing AgentCore Harness review in progress labels Jul 23, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Jul 23, 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 Jul 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.24.1.tgz

How to install

gh release download pr-1813-tarball --repo aws/agentcore-cli --pattern "*.tgz" --dir /tmp/pr-tarball
npm install -g /tmp/pr-tarball/aws-agentcore-0.24.1.tgz

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 40.3% 15047 / 37333
🔵 Statements 39.56% 16037 / 40535
🔵 Functions 34.42% 2567 / 7457
🔵 Branches 33.71% 10016 / 29710
Generated in workflow #4181 for commit 9c8d1f3 by the Vitest Coverage Report Action

@github-actions github-actions Bot added size/m PR size: M and removed size/s PR size: S labels Jul 23, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Jul 23, 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 Jul 23, 2026
jesseturner21
jesseturner21 previously approved these changes Jul 23, 2026
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Jul 23, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Jul 23, 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 Jul 23, 2026
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.

2 participants