Commit cd57dce
fix(interview-coach): end-during-connect race, model gate, grade timing
Three findings from review on #391, plus one same-class gap found while
checking:
- endInterview cleared clientRef but never touched connectAbortRef, so
ownsSession() still reported the in-flight startInterview as the owner.
Since onConnected/onBotReady flip the UI to "active" before connect()
resolves, End could be pressed mid-connect and the resumed call would then
run setSession("active") and attach audio after the user had ended the
session. endInterview now aborts and clears the controller, and the success
path additionally requires clientRef.current === client. Replayed the
interleaving: previously ended {session:"active", audioAttached:true};
now {session:"idle", audioAttached:false}.
Same class, unflagged: component unmount disconnected the client but did
not abort an in-flight connect, so it ran to completion against an already
disconnected client. The unmount cleanup now aborts first.
- /health only proved the Ollama daemon answered. An unpulled OLLAMA_MODEL or
OLLAMA_GRADE_MODEL still reported ready, so the failure surfaced later
inside the background pipeline once WebRTC was already negotiated. It now
parses /api/tags and reports the missing model(s) with the pull command,
tolerating the usual `:latest` omission. Covered by 7 cases including
untagged config, explicit tags, a wrong explicit tag, and an empty daemon.
- _wait_until_coach_quiet treated the pre-speech gap as silence. Grading is
launched right after the tool ack, before the follow-up has been generated,
so bot_speaking was still False and the wait returned in ~450ms — putting
the grader's Ollama request in competition with the coach's own response.
Added a bot_speech_turns counter so a waiter can tell "not started yet"
from "already finished", and the wait now requires speech to start (bounded
by start_timeout_secs, since the coach may not speak) before waiting it out.
Measured with a follow-up starting at 0.8s and lasting 1.5s: previously
returned at 0.36s mid-speech, now 2.78s after it finished; with no speech at
all it still returns, at 4.36s.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 8faf2d3 commit cd57dce
3 files changed
Lines changed: 78 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
128 | 131 | | |
129 | 132 | | |
130 | 133 | | |
| |||
303 | 306 | | |
304 | 307 | | |
305 | 308 | | |
| 309 | + | |
306 | 310 | | |
307 | 311 | | |
308 | 312 | | |
| |||
457 | 461 | | |
458 | 462 | | |
459 | 463 | | |
| 464 | + | |
460 | 465 | | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
461 | 475 | | |
462 | | - | |
463 | | - | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
464 | 487 | | |
465 | | - | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
466 | 491 | | |
467 | 492 | | |
468 | 493 | | |
| |||
857 | 882 | | |
858 | 883 | | |
859 | 884 | | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
860 | 890 | | |
861 | 891 | | |
862 | 892 | | |
863 | 893 | | |
| 894 | + | |
864 | 895 | | |
865 | 896 | | |
866 | 897 | | |
867 | 898 | | |
868 | | - | |
869 | | - | |
870 | | - | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
871 | 923 | | |
872 | 924 | | |
873 | 925 | | |
| |||
884 | 936 | | |
885 | 937 | | |
886 | 938 | | |
| 939 | + | |
887 | 940 | | |
888 | 941 | | |
889 | 942 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
285 | 291 | | |
286 | 292 | | |
287 | 293 | | |
| |||
505 | 511 | | |
506 | 512 | | |
507 | 513 | | |
508 | | - | |
509 | | - | |
510 | | - | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
511 | 519 | | |
512 | 520 | | |
513 | 521 | | |
| |||
561 | 569 | | |
562 | 570 | | |
563 | 571 | | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
564 | 576 | | |
| 577 | + | |
565 | 578 | | |
566 | 579 | | |
567 | 580 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments