fix(coding-agent): avoid recursive render-signature array hashing - #690
Open
lcorncream wants to merge 2 commits into
Open
fix(coding-agent): avoid recursive render-signature array hashing#690lcorncream wants to merge 2 commits into
lcorncream wants to merge 2 commits into
Conversation
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
Why
PR #88 introduced bounded render signatures to reduce resume and render work for large session payloads. Its array
tail path calls
hashSignatureValue(value.slice(40)), so a large numeric array creates another progressivelysmaller array and recursive call for every 40 items.
Tool results can contain those arrays through normal JavaScript serialization, including
Buffer.toJSON().data. A sufficiently large payload can therefore fail while the TUI computes its render cachesignature:
This change keeps nesting recursion governed by the existing depth limit while processing sibling tail items in
one iterative pass.
Related implementation history: #88. GitHub search found no matching issue or existing fix PR for this array-tail
failure.
Validation
npm run test --workspace @code-yeongyu/senpi -- test/render-signature.test.ts test/tool-execution-render-signature.test.ts test/assistant-message-render-signature.test.tsnpm run checknpm run buildnpm testBuffer.toJSON().datareachedToolExecutionComponent.render()and rendered 7 linesExpected merge conflict zones
packages/coding-agent/src/modes/interactive/components/render-signature.tspackages/coding-agent/test/render-signature.test.tspackages/coding-agent/src/modes/interactive/changes.mdSummary by cubic
Avoid stack overflows and preserve render cache correctness by hashing large array tails iteratively in the render signature. Large session payloads now render reliably.
changes.md.Written for commit 5fadce3. Summary will update on new commits.