Skip to content

debug(graph): surface _maybe_write_thread_title failures#491

Merged
blove merged 1 commit into
mainfrom
claude/debug-python-title-writes
May 20, 2026
Merged

debug(graph): surface _maybe_write_thread_title failures#491
blove merged 1 commit into
mainfrom
claude/debug-python-title-writes

Conversation

@blove
Copy link
Copy Markdown
Contributor

@blove blove commented May 20, 2026

Summary

Replace the bare except Exception: return in two graphs with print(..., flush=True) so prod runtime logs surface the actual error when the title write fails.

  • examples/chat/python/src/graph.py::_maybe_write_thread_title (the prod demo's graph)
  • cockpit/chat/threads/python/src/graph.py::generate_title (sibling — same env var, same anti-pattern)

Why

After #486 shipped frontend debug logs, I drove Chrome to demo.threadplane.ai/embed and confirmed:

[LangGraphThreadsAdapter.refresh] invoked
[LangGraphThreadsAdapter.refresh] resolved 50

So refresh() works fine — the SDK returns 50 threads. The bug isn't on the frontend. All 50 threads have metadata.title missing, so the sidenav renders 50 rows of "Untitled" — visually indistinguishable from "empty." That's the actual user-visible bug.

Suspected root 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. get_client() then targets a port that doesn't exist in the container, threads.update() throws, and the bare except swallows it on every run. This PR will let us see the actual exception so we know what to fix.

Test plan

  • Both graphs still compile (syntax + from src.graph import graph)
  • CI green
  • After merge + deploy: hit the demo, send a message, check LangGraph Platform logs for [_maybe_write_thread_title] failed
  • Use the captured error to scope the actual fix

Follow-up (not this PR)

The real fix — likely either:

  • Use the correct env var the LangGraph Platform exposes inside the container (not LANGGRAPH_API_URL)
  • Or use langgraph_sdk.RemoteGraph / the runtime's internal-call mechanism instead of looping through HTTP

🤖 Generated with Claude Code

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>
@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 9:23pm

Request Review

@blove blove enabled auto-merge (squash) May 20, 2026 21:21
@blove blove merged commit def749a into main May 20, 2026
38 checks passed
blove added a commit that referenced this pull request May 20, 2026
…res errors (#492)

LangGraph Platform's stdout (where PR #491's print() lands) isn't
reachable via the LangSmith Runs API. After firing a probe against
prod (thread 019e475a-4add-79a3-95b1-348525d79b0e) we confirmed the
title stays null AND no actionable error surfaces in any API we can
query.

Wrap the helper with @langsmith.traceable so it becomes a child run
in the trace tree, and convert all early-returns to typed dict
returns (skipped/wrote_title/error_type/error_message). The error
branch now captures type, message, and the sdk_url that was used —
all of which show up in the run's `outputs` field when queried via
the LangSmith Runs API.

Cleaner than stdout grep, gives us the proximate cause without
needing platform log access.

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