Skip to content

test(e2e): wait for batch evaluation before archiving - #2499

Merged
aidandaly24 merged 1 commit into
aws:mainfrom
aidandaly24:test/archive-wait-for-batch-evaluation
Oct 1, 2026
Merged

aidandaly24 merged 1 commit into
aws:mainfrom
aidandaly24:test/archive-wait-for-batch-evaluation

Conversation

@aidandaly24

Copy link
Copy Markdown
Contributor

Description

Fix the archive lifecycle E2E test's race with batch evaluation completion.

The test previously submitted an asynchronous batch evaluation and later attempted to archive it without checking whether it had finished. When it was still IN_PROGRESS, the service correctly returned 409. This also broke the local-record removal and repeated-archive assertions.

Use the existing run batch-evaluation --wait flag and assert a deletable terminal status before continuing. Keep the existing exclusion of FAILED evaluations.

This is a one-file test-only change: no production behavior, infrastructure, fixed sleeps, or new polling helpers.

Related Issue

Closes #2498

Documentation PR

Not applicable; test synchronization only.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Testing

  • I ran npm run test:unit and npm run test:integ
  • I ran npm run typecheck
  • I ran npm run lint
  • If I modified src/assets/, I ran npm run test:update-snapshots and committed the updated snapshots

Focused verification:

  • Live archive-lifecycle.test.ts: all 15 checks passed using the normal CDK dependency with no local CDK override.
  • Focused archive command and job engine/constants unit tests: 35 tests passed.
  • Prettier check passed for the changed file.
  • Pre-commit checks passed.

Full unit/integration suites were not rerun for this test-only change. Lint exited successfully with 35 existing warnings in unchanged files. No assets were modified.

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

No new documentation or dependent changes are required.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.

@aidandaly24
aidandaly24 requested a review from a team October 1, 2026 18:19
@github-actions github-actions Bot added the size/xs PR size: XS label Oct 1, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added agentcore-harness-reviewing AgentCore Harness review in progress claude-security-reviewing Claude Code /security-review in progress labels Oct 1, 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 Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.31.0.tgz

How to install

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

expect(json).toHaveProperty('success', true);
expect(json.id).toBeTruthy();
expect(json.status).not.toBe('FAILED');
expect(['COMPLETED', 'COMPLETED_WITH_ERRORS', 'STOPPED']).toContain(json.status);

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.

is completed with errors acceptable?

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.

Yes, for this archive lifecycle test. COMPLETED_WITH_ERRORS is terminal, and the service explicitly permits deleting it.

We’re testing successful archive and local-record cleanup, not evaluation correctness. The previous assertion only excluded FAILED, so it already accepted COMPLETED_WITH_ERRORS.

A test validating evaluation results should require COMPLETED and inspect the results.

@agentcore-devx-automation agentcore-devx-automation Bot left a comment

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.

AgentCore Harness Review

Verdict: Looks good

Small, well-scoped e2e test change. Adding --wait to the run batch-evaluation invocation is the right fix: the subsequent archive steps need the batch evaluation to be in a terminal state before deletion, so making the test block eliminates a race that not.toBe('FAILED') was masking. The tightened assertion (['COMPLETED', 'COMPLETED_WITH_ERRORS', 'STOPPED']) is strictly stricter than the previous check and correctly excludes FAILED/CANCELLED, which TERMINAL_STATUSES['batch-evaluation'] would otherwise allow.

One minor observation (not blocking): the outer retry(..., 6, 15000) combined with a 600s test timeout and a now-blocking --wait means retries will rarely get a second chance if the first run uses most of the budget — but a successful first attempt is the expected path, and failures surface clearly from vitest's timeout, so this is fine as-is.

@agentcore-devx-automation agentcore-devx-automation Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Oct 1, 2026
@aidandaly24
aidandaly24 merged commit f672f92 into aws:main Oct 1, 2026
37 of 44 checks passed

This branch had an error being deployed

1 failed deployment
e2e-testing — ea431410 Deployed Oct 1, 2026 by aidandaly24 via e2e #3361
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xs PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Archive lifecycle E2E test races batch evaluation completion

2 participants