test(agent): lock in aggregate gating of a parallel tool batch (#192) - #214
Open
justrach wants to merge 1 commit into
Open
test(agent): lock in aggregate gating of a parallel tool batch (#192)#214justrach wants to merge 1 commit into
justrach wants to merge 1 commit into
Conversation
#192 asked for a pre-send context gate between a parallel tool batch and its continuation request, plus a regression test. The gate already exists: runTurn's #193 pre-send check sits at the top of the loop — after stepResponses appends the whole batch and before the continuation request — and inputOverCompactThreshold re-estimates over the full messages, including the freshly appended outputs. So a parallel batch that crosses compactAt() only in aggregate triggers compaction before it is sent, which is exactly #192's scenario. This adds the missing regression test (the issue's ask #4): one function_call_output stays under the window; a six-output batch (each individually under the per-output cap) crosses compactAt() in aggregate and trips the gate. No code change is needed on top of #193; the #203 prefill baseline (in the in-flight .202 follow-ups) only makes the gate fire earlier/more conservatively. Refs #192 Co-Authored-By: blackfloofie <265516171+blackfloofie@users.noreply.github.com>
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.
TL;DR
No code change is needed — #192's overflow window is already closed on
mainby the #193 pre-send gate. This PR adds the regression test the issue asked for (its ask #4) and documents why the gate covers the parallel-batch case.Why it's already handled
Agent.runTurn()'s loop is:The #193 gate sits exactly between the tool batch being appended and the continuation request, and
inputOverCompactThreshold→fullInputEstimateTokensserializes the fullself.messages(including the freshly appended outputs). So a parallel batch that crossescompactAt()only in aggregate triggers compaction before the continuation is sent — which is #192's scenario.(The #203 prefill baseline, in the in-flight
.202follow-ups, only makes the gate fire earlier / more conservatively; it isn't required to close this window.)Test (the issue's ask #4)
inputOverCompactThreshold (#192): a parallel tool batch is gated as an aggregate:function_call_output(~6 KB, individually far under the window and the 16 KB per-output cap) → gate does not fire;read_filecalls) → aggregate serialized input crossescompactAt()→ gate fires.Verified on
main:zig build testgreen,zig fmtclean.Closes #192