Commit 73be3eb
fix(apme): route adapter-emitted task_boundary spans to closeTask
The collector's task_boundary span case handled only signal='clear'
(splitRun) and silently dropped every other signal with a comment claiming
they were "handled automatically elsewhere". That contract broke when the
new adapter hooks landed: OpenClaw emits 'manual' on chat.aborted and
'idle_gap' on its idle-gap timer; OpenCode emits 'todo_complete' on its
TodoWrite all-completed detection. None of those signals reach the
Claude-Code-only auto-detection paths the comment relied on, so the active
task stayed open until session_end — task_judge never fired and the
upserted Timeline task_end row never received score/outcome.
Fix routes signal in {todo_complete, manual, idle_gap} to
`closeTask(sessionId, signal)`. session_end stays out of the route because
closeRun fires that transition directly and a duplicate would re-emit
onTaskClosed. Unknown signals log + drop (failure surfaces in test) rather
than silently disappear.
Added test coverage in apme-telemetry-envelope.test.ts for each of the
three signals and for the unknown-signal drop. Existing /clear test
preserved. Full suite: 1267/1267 (up from 1263, +4).
TaskBoundarySignal type widened to include 'idle_gap' (already referenced
unchecked in index.ts label switch).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent a09fc78 commit 73be3eb
2 files changed
Lines changed: 55 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
406 | 406 | | |
407 | 407 | | |
408 | 408 | | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
409 | 449 | | |
410 | 450 | | |
411 | 451 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
505 | 505 | | |
506 | 506 | | |
507 | 507 | | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
513 | 522 | | |
514 | 523 | | |
515 | 524 | | |
| |||
0 commit comments