Commit daa4664
fix(langgraph): replace partial accumulator when final canonical content arrives (#218)
* chore(langgraph): script to capture streaming reasoning fixture
* test(langgraph): capture gpt-5 reasoning streaming chunks fixture
* fix(langgraph): replace partial accumulator when final canonical content arrives
* test(langgraph): pin accumulateContent (delta append + final-canonical replace)
* test(langgraph): pin mergeMessages (id-match, trailing-ai, final-canonical)
* test(langgraph): pin collapseAdjacentAi (collapse identical, keep distinct)
* docs(spec): @ngaf/langgraph streaming content dedup
Targets Finding C from the live smoke pass: visible answer renders
~1.83x expected length in chat-streaming-md when the AI message
content array has both a reasoning block (with summary items) and a
text block.
Root cause: accumulateContent's fallback blindly appends when neither
side is a strict prefix. Streaming accumulator (~690 chars) plus final
canonical text (830 chars) differ by trailing whitespace or
normalization, so the prefix check fails and the bug fires.
Reference research grounded the approach. Stays with the current
model; hardens the fallback with a captured-fixture replay test plus
9 helper unit tests pinning both the genuine delta-append path and
the bug-fix path.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs(plan): @ngaf/langgraph streaming content dedup plan
Six-phase plan: branch, capture script (Node ESM using LangGraph SDK
directly to dump chunks as JSON fixture), failing replay test, targeted
fix in accumulateContent (narrow heuristic for final-canonical
reasoning+text array shape), 9 helper unit tests pinning both legitimate
delta-append and bug-fix replace paths, verification and PR.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 3c5ec1f commit daa4664
6 files changed
Lines changed: 73544 additions & 0 deletions
File tree
- docs/superpowers
- plans
- specs
- libs/langgraph
- src/lib/internals
- test/fixtures
0 commit comments