Repository navigation
feat(config): add exclude_apps option to suppress logging for matched apps - #156
Conversation
|
🤖 AI code reviewAdds an exclude_apps config key and --exclude-apps CLI flag that suppress heartbeats for matching app names. Wires the flag through build_swift_command into the macOS Swift helper, which checks the frontmost app before browser processing and drops pending heartbeats. In the Python heartbeat loop, transform_window returns None for matching apps and the loop skips the heartbeat, using pulsetime=0 for the next heartbeat to break the merge chain. Adds tests for config coercion, transform behavior, and heartbeat-loop sequencing. Safe to merge — no P0/P1 findingsConfidence 5/5 ✅ No findings. The diff looks correct to me on this pass. Files changed (6) — the diff as I read it
Previous review passes
Reviewed Maintainer commands
|
|
@greptileai review |
|
Addressed the review findings — head CI red — Research mode bypass — Default macOS strategy ignored exclusions — Case consistency — Python now compiles exclusion patterns with Tests — 87 passing, including Behavior note: a suppressed window leaves a gap rather than closing the previous event with a sentinel heartbeat, since a sentinel would itself be logged; the server only merges within Greptile re-triggered after the push. |
|
@greptileai review |
|
Checked the latest Greptile pass on One theoretical residue: a |
|
Pushed All Greptile threads are now resolved. The 4/5 score reflects the macOS Swift excluded-time note, which I traced in the previous comment (every entry point funnels through |
Merge recommendation — adjudication of escalated review findingsFixed (this session)
Remaining (non-blocking, disposed)
Verified against: CI: pending on Domain risk: the macOS Swift helper has no CI coverage here — the excluded-window/same-app merge semantics are exercised only through the Python path's new test. A maintainer manual smoke test on macOS (brief switch into an excluded app between two same-app intervals) would confirm the Convergence: Not merging — stopping at maintainer judgment. |
|
CI is now green on |
|
Addressed the two P2 findings from the 04:09 AI review in
Both threads are resolved. |
|
Handled the 05:04 AI review pass on
0 unresolved review threads; CI re-running on |
Merge recommendation — convergence adjudication (head
|
870f414 to
5fe8f99
Compare
|
Rebased onto master ( Two conflicts, both from master moving underneath:
No behaviour changes. Locally: 117 tests pass, and mypy reports no issues. |
5fe8f99 to
f5bcacf
Compare
Merge recommendation — convergence adjudication
|
|
The No rerun permission as a contributor, so pushed an empty commit ( |
|
@greptileai review |
This comment has been minimized.
This comment has been minimized.
|
@greptileai review |
|
CI-green and mergeable — waiting only on a maintainer click. This PR is ready to merge, but the bot has pull-only access to this repo and can't self-merge — surfacing it here so it isn't lost. The monitoring loop will stop re-flagging it now that this note is posted. |
… apps Users can now configure a list of regex patterns in aw-watcher-window's config to prevent specific apps from ever being logged. Matching windows are dropped before the heartbeat is sent — no data ever leaves the client. # In aw-watcher-window's config file: exclude_apps = ["1Password", "keepassxc"] # Or via CLI: aw-watcher-window --exclude-apps 1Password keepassxc This is distinct from --exclude-title (which still logs the app name). The new option gives privacy-conscious users a clean way to suppress sensitive apps entirely. Closes #N (forum.activitywatch.net/t/add-an-exclude-list/345) Git-Session-Id: 0012
…OS swift path - config: read exclude_apps with .get() so configs/tests without the key don't crash parse_args (fixes 2 failing tests) - transform_window: apply exclude_apps before the research transform — a matching app must never be logged, research mode included - macos: wire --exclude-apps through build_swift_command and the Swift helper so the default macOS swift strategy honours exclusions instead of silently bypassing them Git-Session-Id: 77f733c5-217c-5d05-bb77-a00832ca811f
- use one try_compile_regex helper (IGNORECASE + invalid-pattern guard) for both exclude_titles and exclude_apps, so a config value matches the same on Linux/Windows (Python) as on macOS (Swift .caseInsensitive) - document that a suppressed heartbeat intentionally leaves a gap rather than closing the previous event with a sentinel Git-Session-Id: 77f733c5-217c-5d05-bb77-a00832ca811f
…eartbeats Git-Session-Id: 77f733c5-217c-5d05-bb77-a00832ca811f
- move the Swift exclusion check ahead of the Chrome/Safari/Firefox branches so an excluded app cannot surface titles/URLs in logs, and so incognito Chrome (whose app name is cleared to "") is still suppressed - drop oldHeartbeat when suppressing: otherwise the next heartbeat's elapsed-time pulse refreshes the preceding app's event across the excluded interval, recording excluded time as another app's activity Git-Session-Id: 77f733c5-217c-5d05-bb77-a00832ca811f
…d-returns) Git-Session-Id: d3074d53-f945-581b-95a4-61bf83bfaf6c
Git-Session-Id: f83f2353-d267-5fff-ac1f-6114a9d60d4e
…artbeat The exclusion path clears oldHeartbeat synchronously to keep the excluded interval a gap, but sendHeartbeat only assigned oldHeartbeat after its async network send completed. A send in flight at the moment of exclusion would therefore re-populate the cleared heartbeat, and the next allowed app's heartbeat would merge the preceding app's event across the excluded interval. Snapshot the previous heartbeat and an exclusion generation counter before starting the task, read the previous data from the snapshot (also removing a force-unwrap of a possibly-cleared global), and skip the write-back when an exclusion happened meanwhile. Also make the flanked-window test's title assertion meaningful: the excluded window's title now carries its app name, so the assertion fails if exclusion is ever bypassed (previously it passed vacuously). Git-Session-Id: bc8df157-00ca-5747-a672-894c8dc16185
…ttern A bare TOML string (`exclude_apps = "1Password"`) is natural for a single app, but argparse's `nargs='+'` passes a string default through unchanged and main.py then iterates it character-by-character, compiling each character as a regex and silently excluding far more apps than intended. Coerce a string default to a one-element list at the config read site. Git-Session-Id: 06f6d005-e246-548d-b9bd-7c05dab33f56
A TOML value like exclude_apps = 17 or a table reached main.py unvalidated: the int case crashed with TypeError on iteration and a table silently compiled its keys as patterns. Mirror the exclude_titles validation with a parser.error after parse_args. Git-Session-Id: e9426c64-f25f-5a23-9d5e-a31e179615b8
…iling step) Git-Session-Id: b2b8d4dd-1fbc-574c-b9c2-752a23d63c9a
The server merges an incoming heartbeat into the last stored event when the gap is within the heartbeat's pulsetime. After an excluded window, the next allowed-app heartbeat carried compute_pulsetime(poll_time), so a visit to an excluded app shorter than that window was merged into the preceding app's event — attributing excluded time to another app and leaking the switch. Python: track the exclusion and send the first post-exclusion heartbeat with pulsetime=0, breaking the merge chain without emitting any event for the excluded app. The excluded interval is now a real gap. Swift: same fix — after the exclusion clears oldHeartbeat, the next heartbeat used since_last(0)+1 = 1s pulsetime, still merging sub-second visits. A pulse-break flag now forces pulsetime 0 on that send. Also corrects the misleading incognito-Chrome comment (the exclusion check sees the real localizedName, not the cleared app name) and the misleading bypass-detection comment in the flanked-windows test. Git-Session-Id: 597d23ac-9d3a-5be6-acde-2183b9bdfe09
…is noticed The X-connection backoff already sleeps in 1-second chunks with a getppid() check, but the generic sustained-error backoff (added by this PR) slept the whole extra interval (up to ~59s) in one call. An orphaned watcher on a non-X strategy could thus keep running for nearly a minute after parent shutdown. Sleep in 1s chunks with the same parent-death check; update the backoff tests to assert the chunked behaviour while still verifying the 60s total-interval cap. Git-Session-Id: 251a57be-d656-5c30-abfe-89b0eba787bf
8e3d378 to
dca2077
Compare
|
Merge conflict resolved — the branch was rebased onto current Current state at head
Cross-repo and pull-only for the bot, so this is waiting only on a maintainer merge click. Nothing further to fix from my side. |
|
@TimeToBuildBob This is certainly one way, but doesn't feel very easily configured (doesn't respect settings set in webui/on server). How does it relate to the privacy filter feature in the server? What would be the best UX/feature design here? (better policy options like drop or redact) Worth a separate issue for, I'll merge this in the meantime. |
PR #156 added the --exclude-apps option but the startup test fixture's parse_args mock was missing exclude_apps=[] in its SimpleNamespace, causing main() to raise AttributeError and both tests to fail across all platforms. Git-Session-Id: f4473ca7-7cc0-433b-a9ad-a1b68c47b487
Summary
Highest-demand forum request (23 posts, ~17k views): Add an exclude list.
Users sometimes want specific apps — password managers, adult content, private notes — to never appear in their activity log at all. The existing
--exclude-titleonly redacts the title but still logs the app name and emits the event. This PR addsexclude_apps: a list of regex patterns that suppress the entire event before it reaches the server.What this changes
config.py: newexclude_apps = []default config key; new--exclude-appsCLI flag (regex patterns, can specify multiple). Read withconfig.get("exclude_apps", [])for backward compatibility with older configs.main.py:transform_window()returnsNonewhen the window'sappfield matches any pattern, applied before the research transform (a matching app must never be logged, Research Edition included); patterns are compiled case-insensitively via a shared helper, matching the Swift side.heartbeat_loop()skips the heartbeat onNone.macos.swift+macos_cli.py:--exclude-appsis wired throughbuild_swift_commandto the Swift helper, which matches the frontmost application before any browser processing — an excluded app neither emits a heartbeat nor surfaces titles/URLs in logs, and incognito Chrome (whose app name is cleared) is still suppressed. It also drops the pending heartbeat so the next elapsed-time pulse cannot extend the preceding app's event across the excluded interval. This closes the gap where the default macOSswiftstrategy silently bypassed exclusions.tests/test_main.py: unit tests covering matched/unmatched/partial/empty cases, research-mode precedence, case-insensitive compilation, and Swift command wiring; existing fixtures updated for the new key.Behavior note: excluded time is a gap
A suppressed window emits no heartbeat and does not close the previous event with a sentinel/empty heartbeat — a sentinel would itself be logged, defeating the feature. The server only extends the previous event within
pulsetime, so the excluded interval appears as a gap in the timeline rather than being attributed to the prior window.Usage
Config file (
aw-watcher-window.toml):CLI:
Test plan
python -m pytest tests/ -q— 87 passedswiftcbuild ofmacos.swift(CImake buildonmacos-latest) — validates the new--exclude-appsargument parsing--exclude-apps 1Password, open 1Password, confirm no event appears in the aw-server bucket