From 2b43b8dd9035ab372202cd9e66c0604989dd2fdc Mon Sep 17 00:00:00 2001 From: Patrick Buckley Date: Tue, 4 Aug 2026 04:53:00 -0700 Subject: [PATCH] fix(streaming): correlate the fatal trace line with its recorded event MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The DEBUG trace for a fatal turn now carries ws and error_type, mirroring the ERROR-level session.fatal.recorded line — without them a stack trace under concurrent sessions correlates to its fatal event by timestamp guesswork only. Frames-only rendering is unchanged (the sanitize floor: no exception message text in the journal). --- turnstone/core/session.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/turnstone/core/session.py b/turnstone/core/session.py index 784d3c1f..9a642aad 100644 --- a/turnstone/core/session.py +++ b/turnstone/core/session.py @@ -5304,10 +5304,14 @@ class ChatSession: # Frames only — ``exc_info=True`` would render the raw exception # message, which can carry credentials verbatim (the sanitize floor # the lines above exist to hold); format_tb renders the stack - # without the message. + # without the message. ws + error_type mirror the ERROR line so a + # trace correlates to its session.fatal.recorded event under + # concurrent sessions. if exc.__traceback__ is not None: log.debug( "session.fatal.recorded.trace", + ws=self._ws_id, + error_type=type(exc).__name__, trace="".join(traceback.format_tb(exc.__traceback__)), ) try: