Commit 4595fdc
fix: flush telemetry events before process exit (#46)
* fix: flush telemetry events before process exit
Telemetry events were silently lost because:
1. Telemetry.shutdown() was only called from the session prompt flow
(prompt.ts). Non-session commands (auth, upgrade, mcp, etc.) tracked
events but never flushed them before process.exit().
2. shutdown() didn't await the in-flight init() promise. Since init() is
called fire-and-forget in CLI middleware, shutdown() would see
enabled=false and skip the flush entirely.
Fix: add Telemetry.shutdown() in the index.ts finally block (before
process.exit) and make shutdown() await initPromise so buffered events
are flushed even when init hasn't completed yet.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: flush telemetry in TUI worker shutdown
The TUI worker subprocess calls Telemetry.init() but its shutdown()
handler never called Telemetry.shutdown(), causing events tracked in
the worker (MCP server status, engine events) to be lost when the
worker exits.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 0dee1f3 commit 4595fdc
3 files changed
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| 151 | + | |
151 | 152 | | |
152 | 153 | | |
153 | 154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
203 | 212 | | |
204 | 213 | | |
205 | 214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
481 | 481 | | |
482 | 482 | | |
483 | 483 | | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
484 | 494 | | |
485 | 495 | | |
486 | 496 | | |
| |||
0 commit comments