Skip to content

The main process's own warnings never reach the session log #1960

Closed

Description

@MODSetter

The gap

docs/architecture/issue-reports.md lists this under Known gaps:

The main process's own warnings, such as a preference file it could not read, still go to the terminal only.

Why it matters

The session log is meant to be "what this run of the app has logged" — every sidecar's output, the renderer's console warnings and errors, and electron-updater's log. Main's own warnings are the one source missing, and a packaged app has no terminal for them to go to instead, so they go nowhere at all.

These are exactly the lines that explain a puzzling report. A window that opens in the wrong place, a theme that reverts to system every launch, an interface that ignores the chosen language: each of those has a one-line warning from main saying the preference file could not be read or written, and the user filing the issue will never see it and never send it.

Where

Three of those already write [main] at the front of the line by hand, which is what the log's source argument is for.

What done looks like

  • A warning main writes appears in Report issue's log, tagged as coming from main, and still appears on the terminal in development.
  • One helper, used by every site, rather than a sessionLog.append added beside each process.stderr.write. Two ways to log is how the next one gets missed.
  • The startup failure in index.ts fires before any window exists, so it can reach the log but nobody will read it there. Leaving it on stderr alone is a defensible answer; say which you chose.
  • Update the The session log bullet in docs/architecture/issue-reports.md, which lists the sources the log carries, and delete the Known gaps line in the same PR.

How to verify

surfsense_local/electron/src/main/session-log/session-log.test.ts covers the log's cleaning rules and is the file to extend. Write the failing test first: call the helper and assert the line is in lines() with its source.

cd surfsense_local/electron
pnpm test
pnpm typecheck

Before you start

Read CONTRIBUTING.md and the issue reports doc. These lines are written by the main process and are never translated — the log is not interface text. Open your PR against dev, not main. Comment here to claim this.

Activity

  1. nisatsama commented on Sep 29, 2026

    @nisatsama

    I'd like to work on this issue. I'll add a shared main-process logging helper, update the affected call sites and tests, and update the issue-report documentation. I'll target the dev branch.

  2. Ehaan-Dadarkar commented on Oct 8, 2026

    @Ehaan-Dadarkar
    Contributor

    Claiming this — I'll pick it up.

  3. added a commit that references this issue on Oct 8, 2026
    f5addaf
  4. MODSetter commented on Oct 8, 2026

    @MODSetter
    OwnerAuthor

    Fixed by #2205, merged into dev, by @Ehaan-Dadarkar.

    The main process's warnings now go through one helper. In development it still writes them to the terminal, and it also adds them to the session log, tagged main, so Report issue carries them too. That covers a preference or window-state file it couldn't save, a sidecar that crashed, and a failed startup.

    The Known gaps line this issue quoted is deleted in the same PR. Closing by hand: GitHub only auto-closes on a merge to the default branch, and we merge through dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions