Skip to content

fix(aws-ecs): suppress shouldUseCircuitBreaker warning for DAEMON scheduling services#38250

Open
gingeekrishna wants to merge 1 commit into
aws:mainfrom
gingeekrishna:fix/38102-no-circuit-breaker-warning-for-daemon
Open

fix(aws-ecs): suppress shouldUseCircuitBreaker warning for DAEMON scheduling services#38250
gingeekrishna wants to merge 1 commit into
aws:mainfrom
gingeekrishna:fix/38102-no-circuit-breaker-warning-for-daemon

Conversation

@gingeekrishna

Copy link
Copy Markdown

Summary

Closes #38102

Problem: The @aws-cdk/aws-ecs:shouldUseCircuitBreaker warning is emitted for Ec2Service and ExternalService instances created with daemon: true. The warning says to enable the circuitBreaker property, but the ECS circuit breaker doesn't apply to DAEMON services: its failure threshold is defined as 0.5 × desiredCount (min 3, max 200), and a DAEMON service has no desired count — it runs one task per instance. Following the advice is meaningless, and the only way to suppress the warning today is acknowledgeWarning(...) on text that doesn't apply.

Fix: Add a schedulingStrategy !== 'DAEMON' guard to the warning condition in BaseService. Both Ec2Service and ExternalService already pass schedulingStrategy: props.daemon ? 'DAEMON' : ... via additionalProps, so the existing field covers both callers with no interface changes.

Changes

  • packages/aws-cdk-lib/aws-ecs/lib/base/base-service.ts — one-line condition guard
  • packages/aws-cdk-lib/aws-ecs/test/ec2/ec2-service.test.ts — regression test asserting no circuit breaker warning for daemon: true services

Testing

Tests: 16 passed (daemon|circuit filter)

All existing circuit breaker tests still pass (the warning still fires for non-daemon ECS services as before).

…services

The shouldUseCircuitBreaker warning was emitted for Ec2Service and
ExternalService instances created with daemon: true. The ECS circuit
breaker is not applicable to DAEMON services: its failure threshold is
0.5 × desiredCount (min 3, max 200), and a DAEMON service has no
desired count (one task per instance). Following the advice is
meaningless, and the only way to silence it was to acknowledgeWarning
with text that doesn't apply.

Guard the warning with additionalProps.schedulingStrategy !== 'DAEMON',
which is already set by both Ec2Service and ExternalService when
daemon: true.

Fixes aws#38102
Copilot AI review requested due to automatic review settings July 4, 2026 16:29
@github-actions github-actions Bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/small Small work item – less than a day of effort p2 labels Jul 4, 2026
@aws-cdk-automation
aws-cdk-automation requested a review from a team July 4, 2026 16:29

@aws-cdk-automation aws-cdk-automation left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The pull request linter fails with the following errors:

❌ Fixes must contain a change to an integration test file and the resulting snapshot.
❌ The title scope of the pull request should omit 'aws-' from the name of modified packages. Use 'ecs' instead of 'aws-ecs'.

If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a false-positive ECS warning by suppressing the @aws-cdk/aws-ecs:shouldUseCircuitBreaker recommendation for services using the DAEMON scheduling strategy, where the deployment circuit breaker is not meaningful.

Changes:

  • Guard the shouldUseCircuitBreaker warning in BaseService so it doesn’t fire for schedulingStrategy: 'DAEMON'.
  • Add a regression test ensuring Ec2Service with daemon: true does not emit the circuit breaker suggestion.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/aws-cdk-lib/aws-ecs/lib/base/base-service.ts Adds a DAEMON scheduling-strategy guard to prevent emitting an inapplicable circuit breaker warning.
packages/aws-cdk-lib/aws-ecs/test/ec2/ec2-service.test.ts Adds a regression test asserting the circuit breaker suggestion warning is not emitted for daemon services.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +120 to +121
const warnings = flattenMeta(app.synth().getStackByName('Stack').metadata)['/Stack/Ec2Service']['aws:cdk:warning'];
expect(warnings ?? []).not.toContainEqual(expect.stringContaining("Enable the 'circuitBreaker' property"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/small Small work item – less than a day of effort p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(aws-ecs): shouldUseCircuitBreaker warning is emitted for DAEMON scheduling-strategy services, where the deployment circuit breaker doesn't apply

4 participants