Commit 3ffbb82
authored
🤖 fix: suppress browser notifications for idle compaction completions (#2554)
## Summary
Suppress browser notification noise for compaction flows by moving
idle-compaction detection to activity snapshots, skipping compaction
notifications when an automatic follow-up message is queued, and
hardening idle-marker cleanup across race/error paths.
## Background
The previous idle-compaction suppression relied on an
`idle-compaction-started` chat event. That signal is unreliable for true
background work because `onChat` is only active for the currently
selected workspace. During Codex review, additional edge cases surfaced
where stale idle markers could leak across turns and incorrectly
suppress non-idle notifications.
## Implementation
1. **Activity snapshot contract**
- Added optional `isIdleCompaction` to
`WorkspaceActivitySnapshotSchema`.
2. **Backend idle marker lifecycle (`WorkspaceService`)**
- Track in-flight idle maintenance with `idleCompactingWorkspaces`.
- Set marker only after idle dispatch succeeds **and** the session is
still busy.
- Tag `isIdleCompaction` only on `streaming=false` snapshots (stop
snapshots), not on `streaming=true` snapshots.
- Always clear marker for `streaming=false` transitions in `finally`, so
metadata write failures cannot leak state into future turns.
3. **Frontend completion suppression (`WorkspaceStore` + `App`)**
- Use activity transitions (`streaming true→false` + recency advance)
for background completion detection.
- Preserve idle detection via `previous || snapshot` for
reconnect/restore resilience.
- Route completion callbacks through a store-level wrapper.
- For compaction completions, if a queued follow-up exists (auto-sent
next turn), coerce `hasContinueMessage=true` so App suppresses
intermediate "Compaction complete" notifications.
- `App.tsx` suppresses notifications for `compaction?.isIdle` and
`compaction?.hasContinueMessage`.
4. **Cleanup**
- Removed dead `idle-compaction-started` plumbing across
backend/frontend:
- backend emitter method
- frontend callback subscription/export
- stream schema branch and ignored-event handling
5. **Tests**
- Updated idle-compaction dispatch tests.
- Added regression coverage for:
- no stale marker when send succeeds without active stream
- marker cleared when `setStreaming` fails on stream-stop
- `streaming=true` snapshots are never idle-tagged
- active compaction completion with queued follow-up suppression path
## Validation
- `make static-check`
- `bun test src/browser/stores/WorkspaceStore.test.ts`
- `bun test
src/browser/utils/messages/applyWorkspaceChatEventToAggregator.test.ts`
- `bun test src/node/services/workspaceService.test.ts`
- `make typecheck`
## Risks
Low risk and scoped to compaction completion notification behavior. Main
risk is over-suppression in edge cases where queued follow-up intent is
ambiguous, but this is preferable to duplicate/intermediate
notifications and matches compaction auto-send semantics.
## Pains
This needed several Codex-driven hardening passes for subtle
ordering/failure edges (startup-abort, metadata write failure, and
cross-turn marker bleed), which required tightening marker lifecycle
guarantees rather than adding timing-based coordination.
---
_Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking:
`xhigh` • Cost: `$10.37`_
<!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh
costs=10.37 -->1 parent 7ccc1d9 commit 3ffbb82
9 files changed
Lines changed: 387 additions & 99 deletions
File tree
- src
- browser
- stores
- utils/messages
- common/orpc/schemas
- node/services
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
867 | 867 | | |
868 | 868 | | |
869 | 869 | | |
870 | | - | |
| 870 | + | |
871 | 871 | | |
872 | 872 | | |
873 | 873 | | |
| |||
882 | 882 | | |
883 | 883 | | |
884 | 884 | | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
885 | 888 | | |
886 | 889 | | |
887 | 890 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1169 | 1169 | | |
1170 | 1170 | | |
1171 | 1171 | | |
1172 | | - | |
| 1172 | + | |
1173 | 1173 | | |
1174 | 1174 | | |
1175 | 1175 | | |
| |||
1297 | 1297 | | |
1298 | 1298 | | |
1299 | 1299 | | |
1300 | | - | |
| 1300 | + | |
1301 | 1301 | | |
1302 | 1302 | | |
1303 | 1303 | | |
| |||
1344 | 1344 | | |
1345 | 1345 | | |
1346 | 1346 | | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
1347 | 1456 | | |
1348 | 1457 | | |
1349 | 1458 | | |
| |||
1397 | 1506 | | |
1398 | 1507 | | |
1399 | 1508 | | |
1400 | | - | |
| 1509 | + | |
1401 | 1510 | | |
1402 | 1511 | | |
1403 | 1512 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
569 | 569 | | |
570 | 570 | | |
571 | 571 | | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | 572 | | |
576 | 573 | | |
577 | 574 | | |
| |||
585 | 582 | | |
586 | 583 | | |
587 | 584 | | |
588 | | - | |
| 585 | + | |
589 | 586 | | |
590 | 587 | | |
591 | 588 | | |
| |||
1290 | 1287 | | |
1291 | 1288 | | |
1292 | 1289 | | |
1293 | | - | |
| 1290 | + | |
1294 | 1291 | | |
1295 | 1292 | | |
1296 | 1293 | | |
1297 | 1294 | | |
1298 | 1295 | | |
1299 | 1296 | | |
1300 | | - | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
1301 | 1313 | | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
1302 | 1368 | | |
1303 | 1369 | | |
1304 | 1370 | | |
| |||
2369 | 2435 | | |
2370 | 2436 | | |
2371 | 2437 | | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + | |
| 2441 | + | |
| 2442 | + | |
| 2443 | + | |
2372 | 2444 | | |
2373 | 2445 | | |
2374 | 2446 | | |
2375 | 2447 | | |
2376 | 2448 | | |
2377 | 2449 | | |
2378 | | - | |
2379 | | - | |
2380 | | - | |
2381 | | - | |
2382 | | - | |
2383 | | - | |
2384 | | - | |
2385 | | - | |
2386 | | - | |
2387 | | - | |
2388 | | - | |
2389 | | - | |
2390 | | - | |
| 2450 | + | |
| 2451 | + | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
2391 | 2467 | | |
2392 | 2468 | | |
2393 | 2469 | | |
| |||
3118 | 3194 | | |
3119 | 3195 | | |
3120 | 3196 | | |
3121 | | - | |
3122 | | - | |
3123 | | - | |
3124 | | - | |
3125 | | - | |
3126 | | - | |
3127 | | - | |
3128 | | - | |
3129 | | - | |
3130 | | - | |
3131 | | - | |
3132 | | - | |
3133 | | - | |
3134 | | - | |
3135 | | - | |
3136 | | - | |
3137 | | - | |
3138 | | - | |
3139 | | - | |
3140 | | - | |
3141 | | - | |
3142 | | - | |
3143 | | - | |
3144 | 3197 | | |
3145 | 3198 | | |
3146 | 3199 | | |
| |||
3211 | 3264 | | |
3212 | 3265 | | |
3213 | 3266 | | |
3214 | | - | |
| 3267 | + | |
3215 | 3268 | | |
3216 | 3269 | | |
3217 | 3270 | | |
| |||
3362 | 3415 | | |
3363 | 3416 | | |
3364 | 3417 | | |
3365 | | - | |
3366 | | - | |
3367 | | - | |
3368 | | - | |
3369 | | - | |
3370 | | - | |
3371 | 3418 | | |
3372 | 3419 | | |
3373 | 3420 | | |
| |||
3535 | 3582 | | |
3536 | 3583 | | |
3537 | 3584 | | |
3538 | | - | |
3539 | | - | |
3540 | 3585 | | |
3541 | 3586 | | |
3542 | 3587 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
409 | 409 | | |
410 | 410 | | |
411 | 411 | | |
412 | | - | |
| 412 | + | |
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
197 | | - | |
| 196 | + | |
198 | 197 | | |
199 | 198 | | |
200 | 199 | | |
| |||
0 commit comments