fix(langgraph): regenerate via as_node='__start__' (0.0.29)#209
Merged
Conversation
…nerate re-run (0.0.29) After the original run, the LangGraph thread is at `__end__` with `next: []`. The 0.0.28 regenerate flow called `updateState` to apply the RemoveMessage rollback and then `submit(null)` — but submit-with-null is a no-op against a terminal thread, so the new generation never fired. The visible regression in the live cockpit smoke (and `~/tmp/ngaf`) was 1u/1a → 1u/0a: the assistant disappeared and never came back. Fix: extend `transport.updateState` and the stream-manager bridge with an optional `asNode` parameter, and have `regenerate()` pass `asNode: '__start__'`. LangGraph treats the update as if the start node had just produced the values, so `next` flips to `['generate']` and the subsequent `submit(null)` resumes at the entry node and produces a fresh assistant message against the rolled-back state. Also broadens `@ngaf/chat`'s `@cacheplane/partial-json` dep range to `>=0.1.1 <0.3.0` so consumers can pull the recently-published 0.2.x (StreamStatus rename — non-breaking for the surface @ngaf/chat actually uses). Bumped all 16 @Ngaf packages to 0.0.29. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The api-docs gate failed because libs/langgraph/src/lib/agent.types.ts still carried the older "Truncate the thread..." description while the canonical version in libs/chat/src/lib/agent/agent.ts reads "Discards the assistant message...". Aligning both keeps the generator output deterministic. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 tasks
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
Live
~/tmp/ngafsmoke against the freshly-published 0.0.28 reproduced the 1u/1a → 1u/0a regression: regenerate truncated the assistant message but a new one never streamed in.Root cause confirmed via direct LangGraph API probe:
__end__withnext: []updateState({messages: [removeInstr]})correctly applied the rollback (server state → just the user message)submit(null)is a no-op against a terminal thread — there's nothing pending to execute, sogeneratenever re-ranPOST /threads/$ID/statewithas_node: '__start__'flippednextto['generate']; subsequentruns/waitwithinput: nullproduced a fresh assistant — confirming the fixCode change:
transport.updateState+StreamManagerBridge.updateStatewith an optionalasNodeparameteragent.fn.tsregenerate()passesasNode: '__start__'so the next pull resumes at the entry nodeupdateCalls[0].options.asNode === '__start__'Also broadens
@ngaf/chat's@cacheplane/partial-jsondep range to>=0.1.1 <0.3.0so consumers can pull the recently-published 0.2.x (StreamStatus rename — non-breaking for the surface @ngaf/chat actually uses).Bumped all 16 @Ngaf packages 0.0.28 → 0.0.29.
Test plan
nx run langgraph:testgreen (new asNode spec covers the wire-shape)nx run-many -t test --projects=langgraph,chat,ag-ui,a2ui,render,licensinggreennx run-many -t lint --projects=langgraph,chat,ag-uigreen~/tmp/ngafto 0.0.29, live smoke regenerate produces 1u/1a (NOT 1u/0a)