Skip to content

debug(langgraph): add console.debug to LangGraphThreadsAdapter.refresh()#486

Merged
blove merged 2 commits into
mainfrom
claude/debug-threads-refresh
May 20, 2026
Merged

debug(langgraph): add console.debug to LangGraphThreadsAdapter.refresh()#486
blove merged 2 commits into
mainfrom
claude/debug-threads-refresh

Conversation

@blove
Copy link
Copy Markdown
Contributor

@blove blove commented May 20, 2026

Summary

PR #488 already replaced the silent catch with console.error in the new shared adapter. This adds the complementary console.debug calls on invoke + resolve so prod can distinguish:

Why

Production demo (demo.threadplane.ai/embed) shows empty sidenav on cold load even though /api/threads/search returns 50 threads when poked from the page console. After deploy + reload, presence/absence of [LangGraphThreadsAdapter.refresh] invoked tells us whether the effect even fires.

Test plan

  • vitest run threads-adapter — 7/7 pass
  • CI green
  • After merge + deploy: check console on cold-load of demo.threadplane.ai/embed

🤖 Generated with Claude Code

@vercel
Copy link
Copy Markdown

vercel Bot commented May 20, 2026

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

Project Deployment Actions Updated (UTC)
threadplane Ready Ready Preview, Comment May 20, 2026 4:30pm

Request Review

blove added a commit that referenced this pull request May 20, 2026
The same SDK-backed ThreadsService has been duplicated across consumers
(canonical demo, c-threads cap, future caps). Hoist it into @ngaf/langgraph
so one implementation serves them all.

What's exported:

- createLangGraphClient(apiUrl) — wraps `new Client({ apiUrl })` with
  the absolute-URL rewrite (`/api` → `window.location.origin + /api`)
  the SDK requires. Single source of truth — fetch-stream.transport
  now goes through it instead of inlining the same workaround.

- LangGraphThreadsAdapter — Angular service wrapping
  client.threads.search/create/delete/rename/update with the SDK→Thread
  mapping. Configurable via LANGGRAPH_THREADS_CONFIG which titleMetadataKey
  to read ('title' for the demo, 'thread_title' for c-threads — spec
  2026-05-19-llm-generated-labels-design). Pin/archive/projects/sort
  supported. Failures log to console.error (no more silent catches —
  that's been hiding prod issues; see PR #486).

- refreshOnRunEnd(agent, fn) — collapses the
  `lastStatus = ...; effect(...)` snippet both consumers duplicated for
  "refresh threads when a run finishes" into one line.

Converts examples/chat to consume the adapter directly via
inject(LangGraphThreadsAdapter), drops the local 138-line
shell/threads.service.ts. c-threads' adapter conversion lands in a
follow-up (waiting on #481 merge).

@ngaf/chat stays adapter-agnostic — no new LangChain dependency.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
blove added a commit that referenced this pull request May 20, 2026
…488)

* feat(langgraph): hoist threads adapter + Client helper out of demos

The same SDK-backed ThreadsService has been duplicated across consumers
(canonical demo, c-threads cap, future caps). Hoist it into @ngaf/langgraph
so one implementation serves them all.

What's exported:

- createLangGraphClient(apiUrl) — wraps `new Client({ apiUrl })` with
  the absolute-URL rewrite (`/api` → `window.location.origin + /api`)
  the SDK requires. Single source of truth — fetch-stream.transport
  now goes through it instead of inlining the same workaround.

- LangGraphThreadsAdapter — Angular service wrapping
  client.threads.search/create/delete/rename/update with the SDK→Thread
  mapping. Configurable via LANGGRAPH_THREADS_CONFIG which titleMetadataKey
  to read ('title' for the demo, 'thread_title' for c-threads — spec
  2026-05-19-llm-generated-labels-design). Pin/archive/projects/sort
  supported. Failures log to console.error (no more silent catches —
  that's been hiding prod issues; see PR #486).

- refreshOnRunEnd(agent, fn) — collapses the
  `lastStatus = ...; effect(...)` snippet both consumers duplicated for
  "refresh threads when a run finishes" into one line.

Converts examples/chat to consume the adapter directly via
inject(LangGraphThreadsAdapter), drops the local 138-line
shell/threads.service.ts. c-threads' adapter conversion lands in a
follow-up (waiting on #481 merge).

@ngaf/chat stays adapter-agnostic — no new LangChain dependency.

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

* refactor(c-threads): consume shared LangGraphThreadsAdapter

PR #481 added a c-threads-local ThreadsService; this drops it in
favor of the shared LangGraphThreadsAdapter (exported from
@ngaf/langgraph in this same PR). Configures the adapter via
LANGGRAPH_THREADS_CONFIG with titleMetadataKey: 'thread_title' to
match the cap's Python graph.

Inline run-end refresh effect collapses to refreshOnRunEnd(agent, fn).

c-threads is now the second consumer of the hoisted adapter — proves
the per-cap titleMetadataKey config works (demo uses 'title',
c-threads uses 'thread_title') without duplicating the SDK glue.

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

* chore(docs): regenerate api docs

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
PR #488 already replaced the silent catch with console.error; that
half of the original debug PR is done. This adds the complementary
console.debug calls on invoke + resolve so prod inspection can
distinguish "never called" from "called but resolved empty" from
"called and threw."

Targets the demo.threadplane.ai cold-load bug where the sidenav stays
empty with no visible signal. After this lands, redeploy + reload the
demo + check the console: presence/absence of '[...] invoked' tells
us whether the effect even fires.

Tighten the log volume if it becomes noisy.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@blove blove force-pushed the claude/debug-threads-refresh branch from e6978b5 to 33643a5 Compare May 20, 2026 16:21
@blove blove changed the title debug(examples-chat): surface threads.refresh() failures debug(langgraph): add console.debug to LangGraphThreadsAdapter.refresh() May 20, 2026
@blove blove enabled auto-merge (squash) May 20, 2026 16:21
@blove blove merged commit beb437f into main May 20, 2026
2 checks passed
blove added a commit that referenced this pull request May 20, 2026
The frontend debug PR (#486) confirmed refresh() runs and resolves
with 50 threads on demo.threadplane.ai/embed — so the empty-looking
sidenav is actually 50 rows all labeled "Untitled" because
metadata.title is missing on every prod thread. The Python title
write is failing silently.

Suspected cause: examples/chat/python/src/graph.py:99 falls back to
LANGGRAPH_API_URL='http://localhost:2024' when the env var is unset
inside the LangGraph Platform runtime container — which it almost
certainly is. The get_client() call points at a port that doesn't
exist in the container, threads.update() throws, the bare
`except Exception: return` swallows it.

Replace the bare swallow with a print(..., flush=True) in both
graphs so the next prod run surfaces the actual error in LangGraph
Platform logs. Once we see the error we can fix the URL/auth.

Same anti-pattern, same fix as PR #486 (frontend adapter).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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