Route logs and traces to session directory by default#23
Merged
Conversation
Add 'session' output mode for observability that writes logs.jsonl and
traces.jsonl into the session directory alongside messages.jsonl. This
keeps stdout/stderr clean and co-locates all run artifacts in one place.
Session directory structure is now:
.ra/sessions/{uuid}/
meta.json, messages.jsonl, checkpoint.json,
logs.jsonl, traces.jsonl
Logger and Tracer buffer lines in memory until setSessionDir() is called,
then flush pending entries and continue writing to the session file.
A session is now created eagerly at startup so observability has a
target directory before the interface starts.
https://claude.ai/code/session_01SaCbHUH9Lfnp3R7ZD5tabt
Instead of adding pendingLines buffering and setSessionDir() to Logger and Tracer, resolve 'session' → 'file' with computed paths in createObservability(). Logger and Tracer stay unchanged from their original form — no new output modes, no deferred setup. Session is created before observability so the directory path is known upfront. Net -96 lines. https://claude.ai/code/session_01SaCbHUH9Lfnp3R7ZD5tabt
…racefully - Ensure session directory exists via mkdir before creating file writers (create() does this, but --resume skips create()) - Fall back to stderr when output is 'session' but no sessionDir provided https://claude.ai/code/session_01SaCbHUH9Lfnp3R7ZD5tabt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add 'session' output mode for observability that writes logs.jsonl and traces.jsonl into the session directory alongside messages.jsonl. This keeps stdout/stderr clean and co-locates all run artifacts in one place.
Session directory structure is now:
.ra/sessions/{uuid}/
meta.json, messages.jsonl, checkpoint.json,
logs.jsonl, traces.jsonl
Logger and Tracer buffer lines in memory until setSessionDir() is called, then flush pending entries and continue writing to the session file. A session is now created eagerly at startup so observability has a target directory before the interface starts.
https://claude.ai/code/session_01SaCbHUH9Lfnp3R7ZD5tabt