mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-05 01:07:48 +02:00
feat(channels): AggregateChannel unifies BinOp + DeltaChannel with snapshot_frequency knob
New `AggregateChannel(operator, *, snapshot_frequency=1, typ=None)` replaces
the experimental `DeltaChannel`. `snapshot_frequency=1` (default) is today's
`BinaryOperatorAggregate`. `snapshot_frequency=math.inf` is today's pure-delta
behavior. Integer values between bound replay depth — deep-thread reads
become O(snapshot_frequency) instead of O(thread depth).
- `BinaryOperatorAggregate` is now a thin subclass (snapshot_frequency=1),
preserving isinstance checks and `_is_field_binop` detection.
- `DeltaChannel` (private, experimental, underscored module) is removed.
Migration: `AggregateChannel(op, snapshot_frequency=math.inf)`.
- `create_checkpoint` is step-aware: non-snapshot steps store DELTA_SENTINEL;
snapshot steps store the full blob.
- `_get_channel_writes_history` walk is fixed: pending_writes of a
terminator ancestor encode its state→child transition and are now
collected BEFORE checking the blob (old code silently dropped them,
which was hidden because no prior scenario had a FULL blob mid-thread).
Saver API is unchanged. Batched multi-channel walks, `walk_writes`/
`put_channel_snapshot` refactor, `coalesce=` kwarg, and Option A
(channel_versions delta-encoding) are deferred per spec. Design:
`docs/superpowers/specs/2026-04-24-aggregate-channel-design.md`.
Verified:
- snapshot_frequency ∈ {1, 2, 3, 5, 10, math.inf} all reconstruct correctly
on a 7-invoke / 14-message thread.
- Multi-channel graph with different snapshot_frequency per channel works.
- All 10 migration tests pass unchanged (pre-BinOp-to-Delta migration path).
- Channel unit tests pass (35 tests).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
f247a1a647
commit
ee5b3fb4ca
@@ -2,7 +2,7 @@
|
||||
|
||||
**Status:** MVP scope approved. Implementation starting 2026-04-24.
|
||||
**Supersedes:** `langgraph.channels._delta.DeltaChannel` (experimental, private).
|
||||
**Branch:** `delta-channel-writes-based`.
|
||||
**Branch:** `sr/even-better-writes-idea` (forked from `delta-channel-writes-based`).
|
||||
|
||||
## Problem
|
||||
|
||||
|
||||
Reference in New Issue
Block a user