Skip to content

Unsloth Studio logs: collect the backend session log in support reports - #8761

Closed
LeoBorcherding wants to merge 1 commit into
unslothai:mainfrom
LeoBorcherding:fix-desktop-diag-backend-session-log
Closed

LeoBorcherding wants to merge 1 commit into
unslothai:mainfrom
LeoBorcherding:fix-desktop-diag-backend-session-log

Conversation

@LeoBorcherding

Copy link
Copy Markdown
Collaborator

Why

A native crash of the Studio backend (STATUS_ACCESS_VIOLATION in a GPU runtime) leaves its
only stack trace in the per-session disk log that run.py points faulthandler at. The support
bundle collected tauri.log, tauri.log.1 and the phase-log groups, but never that file, so the
faulting library was unidentifiable from the report.

What

Adds a backend-session-log tail to the Log tails section. The path comes from the
Session log: line the backend prints on stdout and the backend phase log captures, which
stays correct when the studio home is overridden; otherwise it falls back to the newest
server-*.log under logs/server. Only an existing <...>/server/server-*.log is accepted,
so a stray line in captured output cannot aim the collector elsewhere.

Collection reuses append_tail_section/read_tail, so the existing line and byte caps, the
size/mtime/truncated metadata and the report-wide redaction pass all apply unchanged. A
missing file or directory emits the same graceful unavailable= line plus a collection
warning.

Testing

cargo check clean. Not exercised against a real native crash.

A native crash of the Studio backend (STATUS_ACCESS_VIOLATION in a GPU
runtime) leaves its only stack trace in the per-session disk log that
run.py points faulthandler at. The support bundle collected tauri.log,
tauri.log.1 and the phase-log groups, but never that file, so the
faulting library was unidentifiable from the report.

Add a backend-session-log tail to the Log tails section. The path is
taken from the `Session log:` line the backend prints on stdout and the
backend phase log captures, which stays correct when the studio home is
overridden; otherwise fall back to the newest server-*.log under
logs/server. Only an existing <...>/server/server-*.log is accepted, so
a stray line in captured output cannot aim the collector elsewhere.

Collection reuses append_tail_section/read_tail, so the existing line
and byte caps, the size/mtime/truncated metadata and the report-wide
redaction pass all apply unchanged, and a missing file or directory
emits the same graceful unavailable= line plus a collection warning.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 96156e0427

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

fn session_log_from_phase_logs(groups: &[PhaseGroup]) -> Option<PathBuf> {
for group in groups.iter().filter(|g| g.label.starts_with("backend:")) {
for path in group.paths.iter().rev() {
let Ok(tail) = read_tail(path, TAIL_MAX_LINES, TAIL_MAX_BYTES) else {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Read the session marker before tailing phase logs

When a backend phase segment grows beyond TAIL_MAX_BYTES (200 KiB) or 1,000 lines, this tail no longer contains the startup-only Session log: line, even though the segment remains retained up to 5 MiB. Resolution then falls back to the globally newest server-*.log; if another CLI/backend session has created or written a log more recently, the support report silently includes that unrelated session instead of the backend represented by this phase group. Read the beginning of the first retained segment for this marker, or persist the parsed path when it is initially captured.

Useful? React with 👍 / 👎.

Comment on lines +506 to +507
if is_session_log_path(&candidate) && candidate.is_file() {
found = Some(candidate);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the trusted startup marker instead of the last match

The real Session log: marker is emitted at backend startup, but this assignment lets every later matching line replace it. If backend output from a dependency, plugin, or user-controlled workload later contains Session log: /some/path/server/server-foo.log, the lexical filename/parent check accepts that unrelated readable file and the support report copies its contents. Return the first valid startup marker rather than the last one, and validate the resolved path against a trusted server-log directory.

Useful? React with 👍 / 👎.

@LeoBorcherding LeoBorcherding changed the title Studio: collect the backend session log in support reports Unsloth Studio logs: collect the backend session log in support reports Aug 14, 2026
@LeoBorcherding

Copy link
Copy Markdown
Collaborator Author

Closing this one. #8690 puts the logs in Settings > Debugging, so reaching them no longer depends on the support report, and the report path is much less load-bearing than it was when this was written. Happy to revisit if the report stays in use.

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