fix: large tool inputs break bash PTC replay and pending-call serialization - #48
Open
kenzaelk98 wants to merge 1 commit into
Open
fix: large tool inputs break bash PTC replay and pending-call serialization#48kenzaelk98 wants to merge 1 commit into
kenzaelk98 wants to merge 1 commit into
Conversation
kenzaelk98
force-pushed
the
fix/ptc-large-tool-input
branch
from
August 11, 2026 15:12
bf21a61 to
6325b72
Compare
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.
Bash PTC tools are meant to handle arbitrary-size input, but the preamble's
internal plumbing quietly assumes inputs stay well under the kernel's
ARG_MAX(~128KB) — which isn't a safe assumption for every PTC use case.Problem
Three spots in the bash PTC preamble pass raw tool input to
jqvia--argjson(a command-line argument), capped byARG_MAX:_ptc_call_tool's pending-call write hits this hard:jqfails outrightand the script aborts with "Argument list too long."
_ptc_history_matches_by_signature/_ptc_history_entry_matches_current_callhit it silently instead — the error is swallowed, so a cached result never
matches, and the call re-executes on every replay round rather than
reusing it.
Fix
Read the input via stdin (pending-call write — stdin is free there) or
--slurpfile(the two matchers — stdin is already used for their primaryinput) instead of argv, in all three spots.
Also makes
tool_history's per-entry/aggregate byte caps inreplay-state.tsconfigurable viaPTC_MAX_TOOL_RESULT_BYTES/PTC_MAX_TOOL_HISTORY_TOTAL_BYTES(defaults unchanged), for deploymentswhose tools return larger outputs.
Testing
run instead of re-issuing.
bun run build/bun run testpass inservice/.