Skip to content

feat: Crash log reporting - #543

Draft
hhvrc wants to merge 3 commits into
developfrom
feat/crash-log-reporting
Draft

hhvrc wants to merge 3 commits into
developfrom
feat/crash-log-reporting

Conversation

@hhvrc

@hhvrc hhvrc commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

No description provided.

hhvrc added 2 commits October 26, 2026 16:12
Logging: OS_LOG* go through openshock_log_write, which writes the console line once
and hands level, tag and message to an optional log tap (LogTap.h). Panics print with
the letter C.

HTTP: HTTP::Client::Upload POSTs a body streamed from a callback.

New diagnostics component:
- Log lines at the upload level or more severe (errors always) are kept in a ring in
  __NOINIT memory, so the lines before a panic or watchdog reset survive into the
  next boot. Lines from the upload task itself are never kept.
- The coredump in flash is found at boot and erased once every configured sink has it.
- Coredump upload (on/off) and log upload level (none..verbose) are NVS settings, off
  by default (diag coredump / diag logs), uploaded from a short-lived task while the
  gateway is connected, with backoff.

CONFIG_OPENSHOCK_DIAG_SDCARD (off by default) stores every log record and coredump on
an SD card in the raw format of docs/SDCARD.md, through ESP-IDF's sdmmc layer on the
SDMMC host or in SPI mode: an MBR written from scratch, a 0xFA dump partition of
1 MiB slots and a 0x7F log ring of CRC'd, epoch-tagged blocks; no filesystem.
tools/sdlog/sdlog.py reads a card or an image of one, tested against a golden image
written by the diagnostics host test.

CONFIG_APP_RETRIEVE_LEN_ELF_SHA=64 so a dump names the exact build that crashed.
…pt-ins in the config

CONFIG_OPENSHOCK_DIAG_UPLOAD_DOMAIN (from OPENSHOCK_DIAG_UPLOAD_DOMAIN in scripts/build.py)
compiles uploading in when set; CONFIG_OPENSHOCK_DIAG, derived from it and the SD card
option, compiles the component, its main.cpp calls and its commands in at all. Without
either the firmware has no diagnostics code. ci-build passes the DIAG_UPLOAD_DOMAIN
repository variable to every build except pull requests; diagnostics-compile.yml
compiles the upload and SD code (upload.invalid, SD on) so they don't rot.

The coredump upload checkbox and the log upload level move into the config as a
DiagnosticsConfig section (schemas: HubConfig.fbs), persisted with the rest of it and
mapped in the frontend. Uploads go to the configured domain; the hub token goes along
only when that is the linked backend.

Replaces the official-firmware flag and the runtime upload domain override.
@hhvrc hhvrc self-assigned this Oct 27, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Roadmap Oct 27, 2026
@coderabbitai

coderabbitai Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

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

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant