Skip to content

Diagnostics: heed.log, a heartbeat, and a run journal for lost runs - #316

Merged
Mpdreamz merged 2 commits into
mainfrom
feature/has-quit-unexpectedly-bunch
Nov 22, 2026
Merged

Mpdreamz merged 2 commits into
mainfrom
feature/has-quit-unexpectedly-bunch

Conversation

@Mpdreamz

Copy link
Copy Markdown
Contributor

Heed has been quitting after being left alone, with no crash report, jetsam entry or log of its own. This adds what is needed to see the next one.

  • heed.log (rolls at 512 KB, mirrored to the unified log, subsystem build.heed.app): launch, quit and its reason, sleep/wake, screens, session switch, thermal state, memory pressure, SIGTERM/SIGHUP/SIGINT/SIGQUIT (logged, then re-raised so the exit is unchanged).
  • A heartbeat each minute: footprint, threads, fds, and what DomainStore wrote (writes, MB, the five most frequent change kinds), which names whatever keeps rewriting domain.json while idle.
  • run.json: marked clean on a quit; a launch that finds it unclean logs when the last run was last alive, its size, and whether the Mac restarted in between.
  • MetricKit diagnostics (crash, hang, CPU, disk-write) kept under diagnostics/.
  • Docs: files reference and a "Heed quit by itself" troubleshooting entry.

Tests: journal/lost-run wording, log rollover, store stats (mutated each to confirm they fail). Full suite and lint pass. Not run live: I did not launch a second Heed beside the running one, so the signal and MetricKit paths are untested outside the build.

The write-churn fix is a separate PR.

🤖 Generated with Claude Code

@github-actions github-actions Bot added the enhancement New feature or request label Nov 22, 2026
…the last run was lost

Heed has been quitting while left alone with no crash report and nothing of its own to read. It now keeps heed.log
(launch, quit, sleep and wake, memory pressure, signals, a heartbeat each minute with its memory and what the domain
store wrote and for which kinds of change), a run.json the next launch reads to tell a lost run from a clean quit, and
the MetricKit diagnostics macOS hands over.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@Mpdreamz
Mpdreamz merged commit 1016a36 into main Nov 22, 2026
6 checks passed
@Mpdreamz
Mpdreamz deleted the feature/has-quit-unexpectedly-bunch branch November 22, 2026 21:02
Mpdreamz added a commit that referenced this pull request Nov 22, 2026
…conds apart (#317)

macOS flagged Heed three times (Nov 19 twice, Nov 21) for excessive disk
writes: `DomainStore.flush()` rewriting the ~3 MB `domain.json` at 650
KB/s to 1.3 MB/s for 30 to 55 minutes while idle.

- `apply` schedules a write only when the domain actually changed.
- Writes are at least `minimumInterval` (5 s) apart. A hard crash can
lose the last few seconds of the cache; `flushAll` on quit still writes
at once.

This caps the rate whatever feeds it. If a timer commits real changes (a
changing timestamp, say), the cause is still there; #316's heartbeat
logs which change kinds reach the store, so it can be found.

Tests: unchanged apply writes nothing, a real change is written, writes
wait out the interval, `flushAll` ignores it. I broke the unchanged
check and the spacing on purpose and each made a test fail. Full suite
and lint pass.

Separate from #316 (diagnostics), per the correctness/behaviour split.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant