Add safety margin to ECS container overrides length limit - #195
Merged
Merged
Conversation
ECS rejects runTask when the serialized container overrides exceed 8192 characters, but real-world failures were happening even when our own length check passed, since ECS's actual accounting doesn't match ours exactly. Trim at 7500 instead so the oversized private_key env var gets dropped earlier, leaving margin before the hard limit. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013BnUutcaMNynydRnay6KPn
7500 was too large a jump from the real 8192 limit. Express the trim threshold as 8192 minus an adjustable overridesLengthSafetyMargin const (64) instead, so it's easy to tune if the observed gap between our length calculation and AWS's own accounting changes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013BnUutcaMNynydRnay6KPn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adjusted the ECS container overrides length limit to include a safety margin below AWS's hard limit of 8192 bytes, accounting for discrepancies between our serialization calculations and AWS's internal accounting.
Changes
overridesLengthSafetyMarginconstant set to 64 bytesoverridesMaxLengthfrom 8192 to 8128 bytes (8192 - 64)Details
AWS's ECS API has a hard limit of 8192 bytes for serialized container overrides, but their internal accounting can be stricter than our calculations. By applying a 64-byte safety margin, we reduce the risk of task submission failures due to length validation errors. This provides a buffer to account for any differences in how AWS measures the payload size versus our implementation.
https://claude.ai/code/session_013BnUutcaMNynydRnay6KPn