Commit 55c1e4b
authored
fix(test-classifier): --submit prompt skipped a typed answer (type-ahead) (#66)
Symptom: after a long OBSERVED run, answering 'y' at 'Was the classification
helpful?' still printed 'no answer — skipping the metrics row'. The comment
posted but the Testing Events row was dropped.
Cause: the prompt used a bare `read -r answer` on fd 0. During the multi-second
streamed suite run, stray newlines/keystrokes (and the agent's own Bash tool
calls perturbing the TTY) queue in the terminal input buffer. `read` consumed
that buffered line — usually empty → the `*)` 'no answer' branch — while the
'y' typed AT the prompt was handed back to the shell after the script exited
(hence 'y' echoed but never seen).
Fix:
• open the controlling terminal ONCE on fd 3 and read from it throughout, so
successive reads (answer, then the 👎 reason) advance the same stream rather
than re-opening /dev/tty and re-grabbing the first line;
• flush pending type-ahead (read -t 0) before prompting, so only a fresh
keypress is read;
• re-prompt up to 3× on unrecognized input instead of silently skipping — a
stray char shouldn't discard the row after a full suite run; an explicit
empty Enter still skips.
Tested the loop logic (single-fd harness): plain y → 👍; stray char then y →
re-prompts and recovers; n + reason → 👎 with the full reason string (previously
captured 'n'); empty Enter → skip.1 parent 5c6512e commit 55c1e4b
1 file changed
Lines changed: 57 additions & 15 deletions
Lines changed: 57 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
755 | 755 | | |
756 | 756 | | |
757 | 757 | | |
758 | | - | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
759 | 771 | | |
760 | | - | |
761 | | - | |
762 | | - | |
763 | | - | |
764 | | - | |
765 | | - | |
766 | | - | |
767 | | - | |
768 | | - | |
769 | | - | |
770 | | - | |
771 | | - | |
772 | | - | |
773 | | - | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
774 | 816 | | |
775 | 817 | | |
776 | 818 | | |
| |||
0 commit comments