[pull] main from danny-avila:main#124
Merged
Merged
Conversation
* feat(run): default durability to 'exit' when a checkpointer is active Runs that attach a checkpointer (the HITL MemorySaver fallback or a host-supplied saver) only need to persist at the graph's exit/interrupt boundary, not after every superstep. processStream now defaults `durability: 'exit'` whenever a checkpointer is present, so normal runs skip per-superstep checkpoint writes. An explicit caller `durability` still wins, and runs without a checkpointer keep langgraph's default. Extract the repeated processStream/resume config shape into `RunStreamConfig` and add the optional `durability` field (local `Durability` union, since langgraph does not export it from the root). Coverage: unit tests for the default / explicit-override / no-checkpointer cases, plus a mongodb-memory-server integration test (real Run + fake streaming model + official MongoDBSaver) proving the default writes one checkpoint document versus more than one under an async override. * fix(run): address Codex review on durability default - Detect the checkpointer at graph-creation time via a `hasCheckpointer` flag instead of reading `Graph.compileOptions` in processStream. For a standard graph with HITL enabled and caller compileOptions that omit a checkpointer, the constructor restores the raw caller options onto Graph.compileOptions and drops the fallback MemorySaver from that metadata, so the old check missed it and that HITL run kept langgraph's per-superstep default. Captured before the overwrite, the flag is correct. - Expose `durability` on AgentSessionRunOptions.config so session consumers can pass an object-literal override without a cast. - Move the mongodb-memory-server spec to durability-checkpoint.integration.test.ts (excluded from the unit shards, which avoids a mongod binary download in the default suite) and run it via a change-gated step in the integration job so coverage is preserved. Adds a HITL-fallback regression test for the first fix. * fix(deps): bump langgraph to 1.4.6, use mongodb-memory-server-core - Bump @langchain/langgraph to 1.4.6, which emits valid UUIDs for exit-mode delta task_ids (1.4.5 produced a 6-segment string that Postgres / LangGraph API checkpointers reject for the `checkpoint_writes.task_id` uuid column). Since this PR makes `durability: 'exit'` the default whenever a checkpointer is present, pin the patched version so a host-supplied Postgres saver with delta channels is not broken by it. - Switch the integration-test devDep from mongodb-memory-server to mongodb-memory-server-core, which has no postinstall binary download, so `npm ci` no longer fetches a mongod binary on every cache miss. The binary downloads lazily only when the gated integration test runs. * test(durability): assert the full storage optimization, not just doc count Strengthen the Mongo integration test to lock in the optimization end to end: - Normal run (real Run + fake model): assert exit writes exactly one checkpoint and zero per-superstep write docs, while async writes strictly more of both collections. - HITL interrupt (langgraph graph + real saver): assert exit checkpoints only at the interrupt boundary (one at pause, two once resumed) while async checkpoints every superstep and writes strictly more. * test(durability): cover multiple sequential interrupts under exit Adds a regression test for back-to-back ask-user-question rounds: each interrupt writes its own checkpoint at the boundary, the chain grows (1 -> 2 -> 3) rather than overwriting, both answers are applied, and the run resumes correctly each time. Confirms exit durability never discards a checkpoint the thread still needs across multiple interrupts.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )