Skip to content

refactor(examples-chat): onTimelineFork uses ThreadsService.create()#265

Merged
blove merged 1 commit into
mainfrom
claude/timeline-fork-sdk-cleanup
May 12, 2026
Merged

refactor(examples-chat): onTimelineFork uses ThreadsService.create()#265
blove merged 1 commit into
mainfrom
claude/timeline-fork-sdk-cleanup

Conversation

@blove
Copy link
Copy Markdown
Contributor

@blove blove commented May 12, 2026

Summary

Last remaining raw-fetch call against LangGraph in the example shell. ThreadsService.create() already does the same POST /threads through @langchain/langgraph-sdk's Client (added in Phase 3b) and returns the new thread id.

This closes out the SDK-audit follow-up tracked from Phase 3b — the codebase now uses the SDK Client uniformly for every thread CRUD operation.

 async onTimelineFork(checkpointId: string): Promise<void> {
-  await fetch('http://localhost:2024/threads', {
-    method: 'POST',
-    headers: { 'Content-Type': 'application/json' },
-    body: '{}',
-  })
-    .then((r) => r.json())
-    .then((t: { thread_id: string }) => {
-      this.threadIdSignal.set(t.thread_id);
-      this.persistence.write('threadId', t.thread_id);
-      void this.agent.submit(null as never, { checkpointId } as never);
-    });
+  const id = await this.threadsSvc.create();
+  if (!id) return;
+  this.threadIdSignal.set(id);
+  this.persistence.write('threadId', id);
+  void this.agent.submit(null as never, { checkpointId } as never);
 }

Test plan

  • nx run examples-chat-angular:build — clean
  • Live timeline-fork behavior: requires exercising the chat-debug timeline replay flow (deeper UI). Functionally equivalent to existing "New chat" path which uses the same ThreadsService.create() and is exercised every session.

🤖 Generated with Claude Code

…instead of raw fetch

The last remaining raw-fetch call against LangGraph in the example
shell. ThreadsService.create() already does the same POST /threads
through @langchain/langgraph-sdk's Client (added in Phase 3b),
returning the new thread id. Saves 7 lines and removes the last
inconsistency in how the example talks to LangGraph.

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

vercel Bot commented May 12, 2026

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

Project Deployment Actions Updated (UTC)
cacheplane Ready Ready Preview, Comment May 12, 2026 10:51pm

Request Review

@blove blove merged commit 38f9cd3 into main May 12, 2026
14 checks passed
@blove blove deleted the claude/timeline-fork-sdk-cleanup branch May 12, 2026 22:52
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