fix(coding-agent): avoid recursive render tail hashing - #782
Open
achieve0410 wants to merge 4 commits into
Open
Conversation
…e-stack-overflow # Conflicts: # packages/coding-agent/CHANGELOG.md
…e-stack-overflow # Conflicts: # packages/coding-agent/CHANGELOG.md
…e-stack-overflow # Conflicts: # packages/coding-agent/CHANGELOG.md
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
Root cause
hashSignatureValue()restartedsummarizeSignatureValue()with a fresh depth andWeakSetfor each omitted tail. Arrays larger than the 40-item signature limit therefore removed only 40 entries per recursive call, making stack depth proportional to the number of omitted items and repeatedly copying smaller tails.A 160,000-item array reproduced the reported error on Node 26:
Fix
The omitted portions now feed framed
[key, summarizedValue]entries into the existing FNV-1a state in one pass. Omitted values retain the former synthetic-tail depth of 1 while sharing the parentWeakSet, so the wide-value stack overflow is removed without weakening deep-tail cache invalidation or cycle handling.Verification
npx vitest run test/render-signature.test.ts test/assistant-message-render-signature.test.ts test/tool-execution-render-signature.test.ts— 3 files, 14 tests passednpm run check— passed, including Biome, pinned dependencies, import checks, lock checks, TypeScript, and browser smokenpm run build— passedsenpi-qaTUI smoke — 5/5 passedsenpi-qaCLI smoke — 8/8 passed, including help and unknown-option handlingupstream/main— passedThe full coding-agent suite completed 7,007 tests successfully with 35 skipped. Four unrelated existing XML recovery wire assertions failed because their broad
authorizationregex matched ambient repository security instructions in the provider body; this PR does not touch those tests or their support modules.Summary by cubic
Fixes stack overflows in
coding-agentinteractive render signature hashing by iterating over omitted array items and truncated object keys with an FNV-1a accumulator. Preserves cache invalidation, depth limits, sparse-hole semantics, and cycle handling.WeakSetancestor tracking, and distinct hole vsundefinedbehavior.Written for commit a2285fe. Summary will update on new commits.