Repository navigation
plans: prioritized plan to close the LangGraph gaps - #157
davidkpiano wants to merge 1 commit into
Conversation
Seven gaps (per-state update stream, time travel, memory store, subgraph mapping, published test fake, the September sweep's library gaps, durable store recipes), each with current state, design, touches, effort, risks, and the examples and docs that exercise it. Grouped into three PR-sized batches with decisions recorded. Planning only; no library code.
|
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing: 2
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| ### Batch A: sweep fixes and the testing seam (one PR, `next`) | ||
|
|
||
| - Gap 2: 6c, 6d, 6e, 6f, 6h. (6a can ride along or split into its own PR if the choices API needs discussion; it is the only M item.) | ||
| - Gap 5: `settings(request, info)` on the three adapters, `examples/mock-model.ts` `byRequestId`, the three docs recipes, comparison row. | ||
| - Changeset: minor. Tests: unit per gap, `pnpm check`, `pnpm docs:check`, `pnpm vitest run examples`. | ||
|
|
||
| ### Batch B: streaming (one PR, `next`) | ||
|
|
||
| - Gap 1: trace fields, `streamAgent`, two stream examples rewritten, observability and comparison docs. | ||
| - Changeset: minor. Follow-up issue: adapter-subpath UI-protocol bridges; child emits; richer chunk parts. | ||
|
|
||
| ### Batch C: persistence and composition docs (one PR, `next`) | ||
|
|
||
| - Gap 3: event-log "Branch with edited state" section, `forkThread`, fresh `executionId` on fork + `forkedFrom`, `examples/time-travel`. |
There was a problem hiding this comment.
| **Proposed design** (smallest; provider-free; keeps `onTrace` as the single emission point per `run-agent.ts:1069-1080`): | ||
|
|
||
| 1. Enrich the existing `machine.transition` trace variant rather than add a new event bus: | ||
| ```ts | ||
| | { type: "machine.transition"; snapshot; event; | ||
| changed: boolean; // next !== prev | ||
| previousValue?: StateValue; // undefined on run.start / restore | ||
| contextPatch?: Record<string, unknown>; // shallow top-level diff, Object.is per key; removed keys as undefined | ||
| } | ||
| ``` | ||
| `commit(snapshot, event, prev)` takes `prev` from `transition()` (`:2960`) and `undefined` from `start` (`:2956`). `JsonSerializableTraceEvent` is derived, so JSON projection follows automatically; the pinned shape test in `src/serialize-trace-event.test.ts` needs updating. Optionally pass the same `{ changed, previousValue, contextPatch }` as a third argument to `onTransition`. |
There was a problem hiding this comment.
| **Proposed design** (docs and examples only): | ||
|
|
||
| 1. `docs/event-log.md` "Stores" section is rewritten to lead with the contract and the suite: "implement four methods, run `assertEventLogStoreConformance`, you're done". Include the SQL shape (`(thread_id, index)` primary key, append in one transaction with a length check). | ||
| 2. `examples/stores/` (or three sibling example dirs, per the one-flat-directory rule): `sqlite` (`better-sqlite3`, ~60 lines), `postgres` (`pg`, ~60 lines), and a pointer to `cloudflare-agent-host`'s Durable Object store. Each has a test that runs the conformance suite; SQLite in-memory runs in CI, Postgres is gated on a `DATABASE_URL` env var and skipped otherwise. |
|
Closed: the plan stays local; the docs and examples it calls for will come as their own PR. |
Planning only. Adds
plans/langgraph-gaps.mdand indexes it inplans/README.md. No library code.What it covers
Seven gaps versus LangGraph, each with current state (file refs on
nextat b884c73), proposed design, what it touches, effort, risks, and the examples and docs that exercise it:streamAgentoveronTrace, no trace-envelope change.executionIdon fork (fixes acallKeycollision), documented fork-edit-resume recipe,examples/time-travel.docs/scope.md.settings(request, info); the 2026-09-24 ruling stands.Grouped into three PR-sized batches with the decisions table at the top. Recommendation: Batch A first.
Verification caveat
Repros ran on a stale install (xstate alpha.57 vs pinned alpha.64); alpha.64 types were read by hand for 6b. Re-run the repro files after
pnpm installbefore implementing.Summary by CodeRabbit