Skip to content

Fix 16 problems from the log (runner, db, perf) - #202

Merged
danielehrhardt merged 3 commits into
mainfrom
godmode/54-fix-16-problems-from-the-log-runner-db-p
Oct 17, 2026
Merged

danielehrhardt merged 3 commits into
mainfrom
godmode/54-fix-16-problems-from-the-log-runner-db-p

Conversation

@danielehrhardt

Copy link
Copy Markdown
Contributor

I fixed the bug behind 37 of the 41 failed runs: the watchdog was counting time the Mac slept as a stall. I also made two smaller fixes. The watchdog, power and sources tests pass (60/60), pnpm -r typecheck is clean, and origin/main had not moved, so nothing needed merging.

What changed

1. The watchdog no longer counts sleep as a stall (37 runs on 2026-10-17)

  • Cause: the watchdog measured how long a run had been silent with the wall clock. While the Mac was in clamshell sleep it woke for about 2–20 seconds every ~16 minutes. Each time, the watchdog check ran right after the wake, saw 20–36 minutes with no output and stopped the runs.
  • Fix: it now uses performance.now() instead, which stops while the computer sleeps (the sleep detector in diagnostics/monitor.ts relies on the same clock). Only time awake counts toward the stall limit, so the timer effectively picks up where it left off after each wake. This is in runner/runner.ts and runner/watchdog.ts.
  • Test: a new test in test/heartbeats.test.ts checks that a running run's times are on this clock and that it isn't stopped.

2. Git fetches the Mac slept through no longer time out on wake

  • The 8 Timed out talking to github.com warnings each came right after a wake, after only ~11.8 s of awake time against a 2-minute limit. A fetch started in one of those short wake windows was timed out by a timer that also counted the sleep.
  • The git timeout in services/workspaceSources.ts now uses awakeTimeout, the same pattern as the run timeout.

3. Lid-closed mode tells you when it can't keep the Mac awake

  • If switching sleep off fails (for example, the sudoers rule is gone), the error only showed in Settings. It now also sends a notification, "Your Mac sleeps with the lid closed", saying what to do: switch lid-closed mode off and on again and enter the Mac password once.
  • The mode already re-checks every minute and clears the error once switching works again. The power test now checks the notification.

Not fixed: why the Mac slept on 2026-10-17

I couldn't find out why lid-closed mode didn't hold. The one pmset disablesleep 1 failed warning (2026-10-16 08:15Z) came just before the password prompt, and that request succeeded 4 seconds later. The sudoers rule is installed and sudo -n works. Nothing failed on 2026-10-17, yet the Mac slept with the lid closed on battery from 09:25Z to 19:53Z, and at 19:53Z sleep had to be switched off again. Either something outside Godmode turned it back on, or the mode was switched off and on again (which isn't logged). With fix 1, sleep like this no longer gets runs stopped.

No code change needed

  • slow database query, event loop blocked, high memory use: known heavy load from very large in-flight chat messages and screenshots in desktop chats. Fixing it means changing how messages are stored, which is bigger than an autofix.
  • browser … stopped unexpectedly (CDP connection closed): logged 25 s before the Mac slept; the browser restarts the next time it's used.
  • could not copy the setup to runner and runner update failed: … offline: the runner was offline at the time.
  • API Error: Connection lost while your computer was asleep: caused by sleep; resume picks it up.
  • Watchdog stop after 60 minutes waiting on a background task: the run kept a server running in the background with sleep 99999 and then waited on it for an hour with no output. Stopping it was correct.

Commits

  • a281d77 Time asleep is no stall for the watchdog
  • 74b4ab5 Time out git only on awake time
  • a63eda7 Tell the human when lid-closed mode can't hold the Mac awake

Task #54 · done by Self-Healer with Godmode Bot

@danielehrhardt
danielehrhardt merged commit e1de8f5 into main Oct 17, 2026
8 checks passed
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