diff --git a/cockpit/chat/threads/python/src/graph.py b/cockpit/chat/threads/python/src/graph.py index 89dd7c8df..02db531e2 100644 --- a/cockpit/chat/threads/python/src/graph.py +++ b/cockpit/chat/threads/python/src/graph.py @@ -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 {} diff --git a/examples/chat/python/src/graph.py b/examples/chat/python/src/graph.py index 699509bac..fe40962c1 100644 --- a/examples/chat/python/src/graph.py +++ b/examples/chat/python/src/graph.py @@ -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