Skip to content

fix: apply the input size limit to multiline input - #178

Open
ferdingler wants to merge 1 commit into
strands-agents:mainfrom
ferdingler:fix/max-input-multiline
Open

ferdingler wants to merge 1 commit into
strands-agents:mainfrom
ferdingler:fix/max-input-multiline

Conversation

@ferdingler

@ferdingler ferdingler commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Description

The input size limit only worked for single-line input. When the input had more than one line, the shell checked each line on its own, so a large multiline command went through as long as no single line was over the limit.

Now the limit applies to the whole input before it runs, the same way it already did for one line. This is a behaviour change: multiline input over the limit that used to run is now refused with the same error as an oversized single line. With the default 1 MiB limit that should only affect very large scripts sent in one go, for example over the WASM module's stdin or as one MCP call. Scripts loaded with source are not affected.

I added a regression test with a small limit. On main a three-line input over the limit ran fine; with the change it's refused, and a short multiline input still runs. One existing test for the limit inside command substitutions had been relying on this gap to get its input past the top-level check, so I changed it to reach the same path through a sourced script instead. It still checks the same thing, and it passes on main and with the change. Everything else passed.

Related Issues

None

Documentation PR

None

Type of Change

Bug fix

Testing

How have you tested the change? Verify that the changes do not break functionality or introduce new warnings.

  • I ran the relevant test suites for the bindings I touched (cargo test --workspace --all-targets, pytest tests/python, npm test)
  • If I touched Rust, I ran cargo fmt and cargo clippy

Checklist

  • I have read the CONTRIBUTING document
  • I have reviewed and understand every line of code in this PR, including any generated by AI tools, and I can explain why it works
  • My change is focused and reasonably small; I have split unrelated work into separate PRs
  • 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

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

@ferdingler
ferdingler requested a review from a team as a code owner October 21, 2026 05:16

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant