Skip to content

fix(deploy): add harness teardown to TUI deploy flow#1394

Merged
jesseturner21 merged 3 commits into
mainfrom
fix/tui-harness-teardown
May 28, 2026
Merged

fix(deploy): add harness teardown to TUI deploy flow#1394
jesseturner21 merged 3 commits into
mainfrom
fix/tui-harness-teardown

Conversation

@jesseturner21
Copy link
Copy Markdown
Contributor

Summary

  • The TUI deploy path (useDeployFlow.ts) was missing imperative harness deployment and teardown logic, causing "remove all and deploy" to skip harness deletion
  • Added post-CDK harness deploy during normal deploys (persists harness state to deployed-state.json)
  • Added imperative teardown before stack destroy during teardown deploys (deletes harnesses via API)
  • Added E2E test validating the full create → deploy → remove all → deploy → verify deleted lifecycle

Root Cause

When the feature flag PR (#1341) consolidated preview/main into a single branch, the TUI deploy hook was not updated to include the imperative harness manager calls. The CLI path (actions.ts) had them but useDeployFlow.ts did not.

Test plan

  • Typecheck passes
  • Lint passes
  • Manual E2E: created harness, deployed, removed all, deployed (teardown), verified ResourceNotFoundException from get-harness API
  • CI passes
  • New E2E test (harness-remove-all.test.ts) passes with BUILD_PREVIEW=1

The TUI deploy path (useDeployFlow.ts) was missing the imperative
harness deployment and teardown logic that exists in the CLI deploy
path (actions.ts). This caused "remove all and deploy" to skip
harness deletion when run through the TUI.

Add post-CDK harness deploy during normal deploys so harness state
is persisted to deployed-state.json, and add imperative teardown
before stack destroy during teardown deploys.

Constraint: Must be gated behind isPreviewEnabled() to match CLI path
Rejected: Ungated harness deploy | would expose harness features in GA builds
Confidence: high
Scope-risk: narrow
@jesseturner21 jesseturner21 requested a review from a team May 27, 2026 17:23
@github-actions github-actions Bot added the size/m PR size: M label May 27, 2026
@github-actions github-actions Bot added the agentcore-harness-reviewing AgentCore Harness review in progress label May 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.15.0.tgz

How to install

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

@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label May 27, 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 May 27, 2026
@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label May 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 27, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 34.97% 10665 / 30489
🔵 Statements 34.33% 11328 / 32996
🔵 Functions 29.95% 1808 / 6035
🔵 Branches 28.97% 6730 / 23228
Generated in workflow #3328 for commit 61a5f2c by the Vitest Coverage Report Action

@jesseturner21
Copy link
Copy Markdown
Contributor Author

Consider folding the remove-all teardown verification into the existing createHarnessE2ESuite (in harness-e2e-helper.ts) instead of a separate test file. The existing suite already does create → deploy → invoke → status, so adding a final step that runs remove all → deploy → verify deleted would cover the same regression guard while saving an entire deploy cycle (~10+ min) in CI. Then harness-remove-all.test.ts can be removed.

Move the remove-all → deploy → verify-deleted assertions from the
standalone harness-remove-all.test.ts into createHarnessE2ESuite so
all harness e2e tests (bedrock, gemini, openai) verify teardown,
saving an entire deploy cycle in CI.

Rejected: Keep separate test file | wastes ~10min CI time duplicating deploy
Confidence: high
Scope-risk: narrow
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels May 27, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label May 27, 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 May 27, 2026
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels May 27, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label May 27, 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 May 27, 2026
… build

- Replace separate build+CDK steps with `npm run bundle` which produces
  both GA and preview tarballs with CDK embedded
- GA e2e: install GA tarball, run strands-bedrock baseline + extras
- Preview e2e: install preview tarball, run harness-bedrock baseline + extras
- Detect helper file changes to trigger all e2e tests

Confidence: high
Scope-risk: moderate
@jesseturner21 jesseturner21 force-pushed the fix/tui-harness-teardown branch from c692e75 to 61a5f2c Compare May 27, 2026 18:48
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels May 27, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label May 27, 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 May 27, 2026
echo "extra_tests=$CHANGED" >> "$GITHUB_OUTPUT"
echo "Changed e2e tests: ${CHANGED:-none}"
# If any helper file changed, run all e2e tests
HELPERS_CHANGED=$(git diff --name-only "$BASE_SHA"..HEAD -- 'e2e-tests/*.ts' \
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This changes the e2e tests on pr so that if any helper files change it runs all the tests on the pr. This is important as when people are changing tests we want to see the changes for the tests.

cfg.modelProvider === 'open_ai' ? 'OpenAI' : cfg.modelProvider === 'gemini' ? 'Gemini' : 'Bedrock';

describe.sequential(`e2e: harness/${providerLabel} — create → deploy → invoke`, () => {
describe.sequential(`e2e: harness/${providerLabel} — create → deploy → invoke → teardown`, () => {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Add a check in these tests that remove all and deploy actually deletes the harness

const existingState = await configIO.readDeployedState().catch(() => undefined);

// Post-CDK: deploy imperative resources (harness) — preview mode only
let deployedHarnesses: Record<string, HarnessDeployedState> | undefined;
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.

Since this let is outside the feature flag it becomes dead code in the GA release.

I think this specific pattern isn't very dangerous, but I'm worried this pattern may make it harder to cleanup since the codepaths are no longer isolated.

const teardownConfigIO = new ConfigIO();
const existingTeardownState = await teardownConfigIO
.readDeployedState()
.catch(() => ({ targets: {} }) as DeployedState);
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: why do we need to cast the type here? is there something we're assuming?

@jesseturner21 jesseturner21 merged commit af7becb into main May 28, 2026
32 checks passed
@jesseturner21 jesseturner21 deleted the fix/tui-harness-teardown branch May 28, 2026 12:51
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