Skip to content

fix(langgraph): drop 'tools' stream_mode + content-match id preservation#176

Merged
blove merged 1 commit into
mainfrom
claude/chat-langgraph-06
May 2, 2026
Merged

fix(langgraph): drop 'tools' stream_mode + content-match id preservation#176
blove merged 1 commit into
mainfrom
claude/chat-langgraph-06

Conversation

@blove
Copy link
Copy Markdown
Contributor

@blove blove commented May 2, 2026

Why

Live smoke against a real LangGraph backend (langgraph_api 0.8.5) revealed two issues after 0.0.10 / 0.0.4 shipped:

  1. Every submit failed with HTTP 422 because we were requesting `tools` as a stream_mode, which is only supported on langgraph_api ≥ 0.9.x — the server rejects the whole request when any unknown mode appears in the array.
  2. Chat messages still tore down mid-stream even with track-by-id. MutationObserver instrumentation showed AI message DOM being removed and re-added. Two id mismatches were causing it: the server echoes the optimistic human with its own id, and the final messages event sometimes carries a run id distinct from the streaming chunk id.

Changes

  • `fetch-stream.transport`: `defaultStreamMode` drops `'tools'`. Tool-call data remains derivable from messages-tuple.
  • `stream-manager.bridge`:
    • `mergeMessages`: when no id-match is found, falls back to a `(role, content)` match (with AI prefix-relationship tolerance) and preserves the existing id.
    • `preserveIds` helper applied in the values-event message sync path so full-state snapshots also retain ids by content.

Versions

  • `@ngaf/langgraph`: 0.0.4 → 0.0.6 (0.0.5 was a local pack, never tagged)

Test plan

  • `nx test langgraph` — 100 tests green
  • `nx build langgraph` — clean
  • Live smoke against ngaf-llm-backend → no more HTTP 422; user/AI bubbles render correctly through streaming
  • Confirm caret + dots animate consistently on the deployed version

🤖 Generated with Claude Code

…id preservation

Two follow-up fixes after live smoke-testing 0.0.10 against a real
LangGraph 0.8.5 backend:

1. defaultStreamMode no longer requests 'tools'. langgraph_api < 0.9.x
   rejects the entire request with HTTP 422 the moment any unknown
   stream_mode appears in the array. Tool-call data is still derivable
   from messages-tuple events. Previously every submit was failing with
   422 against current servers.

2. Content-aware id preservation. Track-by-id in chat-message-list
   relies on stable message ids across emissions, but two language-
   server quirks were tearing down the DOM mid-stream:
   - The server echoes our optimistic human message back with its own
     id (e.g. 9867e1ce vs our 'optimistic-…').
   - Final messages can arrive with a run id different from the chunk
     id used during streaming partials.
   Both cases now match by (role, content) — with prefix-relationship
   tolerance for AI streaming → final — and the existing id is retained.
   Applied in both mergeMessages and the values-event sync path so
   streaming partials, message-tuple events, and full-state snapshots
   all converge on stable ids.

Bumps @ngaf/langgraph 0.0.4 → 0.0.6 (skipping 0.0.5 which was published
via local pack but never tagged).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cacheplane Ready Ready Preview, Comment May 2, 2026 2:46pm

Request Review

@blove blove merged commit 1545b65 into main May 2, 2026
14 checks passed
@blove blove deleted the claude/chat-langgraph-06 branch May 7, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant