Commit 08aea1b
committed
fix(kb-watcher): include health signals in signature — stale 'pending audit' banner
User report: sidebar Status section showed '1 background audit still
running' even though the session's auditStatus on disk was 'done'.
Root cause: KbWatcher's change-detection signature was counts-only
(memories|decisions|safety|backlog|questions). When a session's
auditStatus transitioned 'pending' → 'done' (auditor just finished),
the counts didn't move, signature didn't change, listener didn't
fire, sidebar kept showing the stale banner.
Fix: signatureOf() now folds in three health signals — pendingAudits,
lastAuditError timestamp, lastHandoffMtimeMs. Any of them changing
triggers a listener fire on the next 5-second poll tick. Sidebar
re-reads health and re-renders, banner disappears the moment the
auditor flips meta.json to 'done'.
Why not push the WHOLE health snapshot on every tick: re-rendering
the webview costs nothing visible (DOM diff is identical when
state didn't change), but if we always pushed regardless, the
agent's auto-bootstrap path would chatter the webview on every poll
for no signal — better to gate on a compact signature.1 parent 918ac8d commit 08aea1b
1 file changed
Lines changed: 30 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
37 | 59 | | |
38 | 60 | | |
39 | 61 | | |
| |||
192 | 214 | | |
193 | 215 | | |
194 | 216 | | |
195 | | - | |
| 217 | + | |
196 | 218 | | |
197 | 219 | | |
198 | 220 | | |
199 | | - | |
| 221 | + | |
200 | 222 | | |
201 | 223 | | |
202 | 224 | | |
| |||
227 | 249 | | |
228 | 250 | | |
229 | 251 | | |
230 | | - | |
| 252 | + | |
231 | 253 | | |
232 | 254 | | |
233 | 255 | | |
| |||
260 | 282 | | |
261 | 283 | | |
262 | 284 | | |
263 | | - | |
| 285 | + | |
264 | 286 | | |
265 | 287 | | |
266 | 288 | | |
| |||
0 commit comments