Conversation
Test Coverage Report
Per-file breakdown
Uncovered lines
|
Greptile SummaryThis PR fixes dashboard notification routing so that all producers (the
Confidence Score: 5/5Safe to merge — routing logic is correct and the PID-keyed cache invalidates cleanly on daemon restart. The daemon store path is deterministic and consistent across all three write/read paths. The only gap is a missing test-reset export for the module-level cache, which does not affect production correctness. No files require special attention.
|
| Filename | Overview |
|---|---|
| packages/core/src/dashboard-notifications.ts | Adds daemon-level store path, a PID-keyed module-level cache, and validation logic; cache has no exported reset function for tests. |
| packages/core/src/process-utils.ts | New shared isProcessAlive helper with pid <= 0 guard and EPERM handling; consolidates three duplicated copies. |
| packages/web/server/mux-websocket.ts | NotificationBroadcaster now resolves store path dynamically: envStorePath then live daemon store then config-scoped fallback. |
| packages/plugins/notifier-dashboard/src/index.ts | resolveStorePath() prefers the live daemon store and falls back to config-scoped path. |
| packages/cli/src/lib/running-state.ts | RunningState gains dashboardNotificationStore field; register() always writes it. |
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
packages/core/src/dashboard-notifications.ts:81
The module-level `liveDashboardNotificationStoreCache` has no exported reset function. The codebase already has the `_clearProcessCacheForTests` convention (exported from `process-cache.ts` and re-exported from `index.ts`). Tests currently work around the missing reset by changing `HOME`/`USERPROFILE` env vars to shift the `runningStatePath` key, but this is an implicit coupling. A future test that needs to observe cache invalidation with the same HOME dir (e.g. same-PID daemon restart) would have no direct way to clear it.
```suggestion
let liveDashboardNotificationStoreCache: LiveDashboardNotificationStoreCache | null = null;
/** @internal – test-only */
export function _clearLiveDashboardNotificationStoreCacheForTests(): void {
liveDashboardNotificationStoreCache = null;
}
```
Reviews (3): Last reviewed commit: "fix: validate dashboard notification sto..." | Re-trigger Greptile
There was a problem hiding this comment.
Pull request overview
This PR fixes a real-world mismatch where dashboard notifications could be persisted to a config-scoped JSONL store that the currently running dashboard daemon was not watching. It introduces a daemon-scoped notification store (persisted via running.json) and updates both notification producers and the dashboard broadcaster to prefer the live daemon’s store, with env/config fallbacks.
Changes:
- Add daemon-level dashboard notification store path helpers and live-daemon resolution (
running.json) in@aoagents/ao-core. - Update dashboard notification producer (dashboard notifier plugin) and consumer (mux notification broadcaster) to prefer the live daemon store (and allow an explicit env override for the dashboard process).
- Deduplicate PID liveness probing by introducing and reusing a shared
isProcessAlive()utility.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/web/server/mux-websocket.ts | NotificationBroadcaster now prefers env-provided store, then live-daemon store, then config-scoped store. |
| packages/web/server/tests/mux-websocket.test.ts | Adds coverage for preferring the live daemon store and env override behavior. |
| packages/plugins/notifier-dashboard/src/index.ts | Dashboard notifier now persists to the live daemon store when available, falling back to config-scoped store. |
| packages/plugins/notifier-dashboard/src/index.test.ts | Adds coverage for persisting to the live daemon store and updated warning text. |
| packages/core/src/dashboard-notifications.ts | Adds daemon store path helper + live-daemon store resolution from running.json (with caching). |
| packages/core/src/process-utils.ts | Introduces shared isProcessAlive(pid) helper. |
| packages/core/src/daemon-children.ts | Uses shared isProcessAlive instead of local implementation. |
| packages/core/src/windows-pty-registry.ts | Uses shared isProcessAlive for pruning registry entries. |
| packages/core/src/index.ts | Exports isProcessAlive and new dashboard notification store helpers from core. |
| packages/core/src/tests/process-utils.test.ts | Adds unit tests for isProcessAlive behavior (invalid PID, EPERM, ESRCH). |
| packages/core/src/tests/dashboard-notifications.test.ts | Adds coverage around live-daemon store path caching behavior. |
| packages/cli/src/lib/running-state.ts | Persists dashboardNotificationStore into running.json (defaulting to daemon store path). |
| packages/cli/src/lib/web-dir.ts | Passes daemon notification store path to dashboard process via AO_DASHBOARD_NOTIFICATION_STORE. |
| packages/cli/src/commands/start.ts | Computes/passes daemon store path when spawning the dashboard process. |
| packages/cli/tests/lib/running-state.test.ts | Updates running-state tests to include the new dashboardNotificationStore field. |
Summary
Closes #1984
Tests
Notes