Skip to content

fix(ecs): suppress shouldUseCircuitBreaker warning for DAEMON scheduling strategy services - #38140

Open
gingeekrishna wants to merge 7 commits into
aws:mainfrom
gingeekrishna:fix/38102-daemon-circuit-breaker-warning
Open

fix(ecs): suppress shouldUseCircuitBreaker warning for DAEMON scheduling strategy services#38140
gingeekrishna wants to merge 7 commits into
aws:mainfrom
gingeekrishna:fix/38102-daemon-circuit-breaker-warning

Conversation

@gingeekrishna

@gingeekrishna gingeekrishna commented Jun 13, 2026

Copy link
Copy Markdown

Summary

Fixes #38102

The @aws-cdk/aws-ecs:shouldUseCircuitBreaker warning fires for Ec2Service with daemon: true, even though the ECS deployment circuit breaker does not apply to DAEMON services. The circuit breaker threshold is 0.5 × desiredCount (min 3), but DAEMON services have no desiredCount — they run one task per container instance. Following the warning's advice and setting circuitBreaker on a daemon service is meaningless, and the only way to silence the false positive today is acknowledgeWarning().

Root cause: BaseService guards the warning with !props.circuitBreaker && this.isEcsDeploymentController, with no check for the scheduling strategy. Ec2Service passes schedulingStrategy only in additionalProps, so BaseService never accounts for it.

Fix: Add additionalProps?.schedulingStrategy !== 'DAEMON' to the warning guard. This is consistent with how CDK already special-cases daemon mode in multiple other places (desiredCount validation, minHealthyPercent default/warning, availabilityZoneRebalancing check, placement strategy checks).

Changes

  • base-service.ts: Skip shouldUseCircuitBreaker warning when schedulingStrategy is DAEMON
  • ec2-service.test.ts: Add test asserting the warning is not emitted for daemon services

Test plan

  • New test: does not suggest circuitBreaker for DAEMON scheduling strategy services — passes
  • Existing tests: suggests using circuitBreaker if false set and suggests using circuitBreaker if true set — still pass (non-daemon replica services are unaffected)
  • Existing daemon-related tests (minHealthyPercent, placement strategy, desiredCount validation) — unaffected

Copilot AI review requested due to automatic review settings June 13, 2026 19:05
@github-actions github-actions Bot added bug This issue is a bug. effort/small Small work item – less than a day of effort p2 labels Jun 13, 2026
@github-actions github-actions Bot added the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label Jun 13, 2026

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

Note

Copilot was unable to run its full agentic suite in this review.

Adds an exclusion so ECS “should use circuit breaker” warnings aren’t emitted for DAEMON services, and introduces a regression test covering the DAEMON case.

Changes:

  • Add a DAEMON scheduling-strategy guard to the circuit breaker recommendation warning.
  • Add a new unit test ensuring no circuit breaker suggestion is emitted for daemon EC2 services.

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/test/ec2/ec2-service.test.ts Adds coverage to ensure DAEMON services don’t get circuit breaker recommendation warnings.
packages/aws-cdk-lib/aws-ecs/lib/base/base-service.ts Skips the circuit-breaker recommendation warning when scheduling strategy is DAEMON.

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

Comment on lines 958 to 962

@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.

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.

✅ A exemption request has been requested. Please wait for a maintainer's review.

The ECS deployment circuit breaker is desiredCount-based (threshold = 0.5 × desiredCount)
and is not applicable to DAEMON scheduling strategy services, which have no desiredCount.
BaseService was emitting a false-positive shouldUseCircuitBreaker warning for daemon
services because the guard only checked !circuitBreaker && isEcsDeploymentController
without accounting for the scheduling strategy.

Fix: skip the warning when schedulingStrategy is DAEMON, consistent with how CDK
already special-cases daemon mode for desiredCount validation, minHealthyPercent,
and placement strategy checks.

Fixes aws#38102

Signed-off-by: Radhakrishnan Pachyappan <radhakrishnan.p@op.tech>
@gingeekrishna
gingeekrishna force-pushed the fix/38102-daemon-circuit-breaker-warning branch from ef50dd8 to 4236026 Compare June 13, 2026 19:13
@gingeekrishna

Copy link
Copy Markdown
Author

Exemption Request

This PR only suppresses a false-positive advisory annotation () for DAEMON scheduling-strategy services. It does not change any synthesized CloudFormation template, resource property, or deployment behavior — the only observable effect is that no longer emits a misleading warning for daemon services.

Integration tests verify infrastructure behavior via snapshot diffs; because no snapshot would change as a result of this fix, an integration test would add no signal beyond what the existing unit tests already cover.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jul 31, 2026
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 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.

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

5 participants