Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions cockpit/chat/threads/python/src/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,17 @@ async def generate_title(state: MessagesState, config) -> dict:
title = (response.content or "").strip().strip('"').strip("'")[:80]
if title:
await client.threads.update(thread_id, metadata={"thread_title": title})
except Exception: # noqa: BLE001 — title is a UX nicety; never block
pass
except Exception as e: # noqa: BLE001 — title is a UX nicety; never block
# Don't break the run, but DO log. A bare pass has hidden a prod
# bug in the sibling examples/chat graph where the title write was
# failing silently on every thread (LANGGRAPH_API_URL fallback to
# localhost:2024 inside the runtime container). Surface here to
# catch the same class of failure early.
print(
f"[generate_title] failed for thread {thread_id}: "
f"{type(e).__name__}: {e}",
flush=True,
)
return {}


Expand Down
13 changes: 11 additions & 2 deletions examples/chat/python/src/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,17 @@ async def _maybe_write_thread_title(state: "State", config: RunnableConfig) -> N
thread_id,
metadata={"title": title},
)
except Exception:
# Title write must never break the run. Swallow.
except Exception as e: # noqa: BLE001 — title is a UX nicety; never block
# Don't break the run, but DO log. A bare swallow has hidden a prod
# bug where the title write was failing silently on every thread
# (LANGGRAPH_API_URL fallback to localhost:2024 inside the runtime
# container). Print to stdout so it surfaces in LangGraph Platform
# logs without needing a logger to be configured.
print(
f"[_maybe_write_thread_title] failed for thread {thread_id}: "
f"{type(e).__name__}: {e}",
flush=True,
)
return


Expand Down