fix: Bound the two uncapped in-memory buffers in the agent run#516
Merged
Conversation
collectedText grew for the whole run and was re-joined on every assistant message. Replace it with AgentOutputSignals, which keeps only signal-bearing lines. One OUTPUT_SIGNALS table drives both retention and every query, so the filter and consumers cannot drift. $statusMessages appended forever. Cap it at 100 with a FIFO that drops the oldest entry. The status bar shows at most 10, so nothing visible changes. Generated-By: PostHog Code Task-Id: dc10b8c8-7d3c-494e-a7e2-95a9ca412017
🧙 Wizard CIRun the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands: Test all apps:
Test all apps in a directory:
Test an individual app:
Show more apps
Results will be posted here when complete. |
Move the output parser out of the 1718-line agent-interface file. New leaf modules signals.ts (the marker/error vocabulary) and output-signals.ts (the AgentOutputSignals parser) break the import cycle. agent-interface re-exports the moved symbols so existing importers are untouched. Drop the redundant API_ERROR_401/429 table rows. API_ERROR is the one needle and the status is a parameter: hasApiError() and hasApiErrorStatus(code). Tie the status FIFO cap to the render window. New constants.ts holds COLLAPSED_COUNT/EXPANDED_COUNT; the store caps at EXPANDED_COUNT instead of an arbitrary 100, since the status bar is the only consumer and shows at most that many lines. Generated-By: PostHog Code Task-Id: dc10b8c8-7d3c-494e-a7e2-95a9ca412017
Collaborator
Author
|
K I'm gonna hold this off for another release. I need to give this some good testing. It should be fine but just in case i missed smthing |
Collaborator
Author
|
/wizard-ci basic-integration/next-js |
🧙 Wizard CI ResultsTrigger ID:
Configuration
|
Collaborator
Author
|
/wizard-ci basic-integration/next-js |
Collaborator
Author
|
This is working locally, gonna fix ci |
Collaborator
Author
Collaborator
Author
|
Tested in CI and locally, is working, CI slightly broken by anthropic lol |
sarahxsanders
added a commit
that referenced
this pull request
Jun 12, 2026
…n deletion Conflict resolution: main's #516 introduced the bounded AgentOutputSignals parser, including a signals-based checkYaraViolation. This branch deletes output-text YARA sniffing entirely (yaraViolationReason from onTerminate is the single source of truth), so the resolution keeps the deletion and adopts signals for the API-error paths. Also removes the now-dead hasYaraViolation and YARA needles from output-signals, with a comment explaining why YARA is deliberately not an output signal. Co-Authored-By: Claude Fable 5 <noreply@anthropic.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.
What
Two buffers grew without limit during an agent run. This bounds both.
collectedText held every assistant text block for the whole run. Line 1187 re-joined the whole array on every assistant message, so cost was O(n squared). It is replaced by
AgentOutputSignals, a class that keeps only lines containing a known signal and drops all other prose. OneOUTPUT_SIGNALStable drives both what gets kept and every query, so the filter and the consumers cannot fall out of sync. Consumers now call typed methods likehas('API_ERROR_401')instead of scanning raw strings.$statusMessages appended forever via
pushStatus. It now caps at 100 entries with a FIFO that drops the oldest. The status bar renders at most 10, so nothing visible changes.Why
Both buffers leaked memory for the lifetime of a run. The log file tailing was already safe. These were the real growth points.
Behavior
Detection logic is byte for byte identical. No user facing change.
Tests
AgentOutputSignals: prose is dropped, each marker is detected, API error lines and the remark are extracted.createStopHooktests to the new type. Assertions unchanged.pnpm build && pnpm test && pnpm lintall pass. 766 tests green.