feat(macos): persist heartbeat queue to disk across watcher restarts
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Read PR #162 and inspect the HeartbeatSender actor and aw_watcher_window/macos.py; compare the Swift sender with aw_client.client.ActivityWatchClient and its persist-queue behavior. First determine whether the Python wrapper can receive structured heartbeats from the Swift binary. Done means pending heartbeats survive watcher restarts, using an approach selected after resolving that architecture question.
Written by the indexing model from the issue text.
Description
Background
PR #162 (merged 2026-10-10) replaced fire-and-forget per-heartbeat Tasks with a serialised HeartbeatSender actor that retries failures with exponential backoff and creates the bucket lazily. This fixes the immediate reliability gap.
The PR description explicitly notes two follow-ups:
Persisting the queue to disk across watcher restarts (the Python watchers get that from aw-client's persist-queue); the TODO about letting the Python wrapper own the sending still stands.
Gaps
1. In-memory queue is lost on watcher crash
The current HeartbeatSender queue survives a server outage (up to ~28 h at one heartbeat per 10 s), but is lost if the watcher process itself crashes. The Python-based watchers avoid this via aw-client's persist-queue which writes pending heartbeats to disk and replays them on restart.
Risk window: watcher crash after a server outage → queued backlog is dropped and the gap appears as idle time.
2. Python wrapper could own the sending
aw_watcher_window/macos.py spawns the Swift binary and proxies its output. An alternative architecture would have the Python wrapper intercept heartbeats from the Swift binary and route them through aw-client (which already has persist-queue). This would:
- Remove the need for Swift-native persistence
- Reuse the battle-tested
aw-clientpersist-queue implementation - Let the macOS watcher benefit from future
aw-clientreliability improvements automatically
Open question: can the Python wrapper intercept Swift binary output as structured heartbeats rather than display strings? If not, this architecture is blocked and Swift-native persistence is the path.
Relation
- Follows from: #162
- Related: the Python watchers use
aw-clientpersist-queue viaaw_client.client.ActivityWatchClient
- Dominant language
- Python
- Stars
- 133
- Forks
- 92
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 4
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ActivityWatch/aw-watcher-window
-
[macos] Accessibility permission prompt reappears every ~10s even after granting accessPossibly taken @StreamOfRon claimed this 57 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
-
[macos] Swift helper never appears in the Accessibility list on its own; users must manually dig out the helper binaryPossibly taken @StreamOfRon claimed this 57 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
ActivityWatch/aw-watcher-window#123 · 1 comment · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
ActivityWatch/aw-watcher-window#119 · 1 comment ·
All issues in ActivityWatch/aw-watcher-window
Similar issues
-
`gitlab_importer_v2` pipeline failing due to malformed YAML filePossibly taken @Gowri213 claimed this today. Openbug Pipeline: Failure Priority: high
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
aboutcode-org/vulnerablecode#2523 · 1 comment ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
intuitem/ciso-assistant-community#5380 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
confluentinc/cp-ansible#2767 ·
Maintainers usually reply within 3 days
-
bug docs
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 2 days