Skip to content

Commit d8b6c3f

Browse files
authored
fix(test-classifier): --submit interactivity guard must probe /dev/tty, not fd 0 (#67)
Follow-up to #66. The helpfulness prompt reads from /dev/tty, but the early 'non-interactive' guard still tested fd 0 ([[ ! -t 0 ]]). During an OBSERVED run the agent's Bash tool subprocesses (pnpm install, vitest, …) inherit the dispatcher's fd 0 as their stdin and can leave it non-TTY / consumed-to-EOF by the time --submit runs. The guard then reports 'non-interactive', returns early, and the prompt is skipped silently — the comment posts but no 'Was this helpful?' question appears and no Testing Events row is written. (Observed: a --submit run ended at 'Comment posted … Awaiting the developer's reaction' with no prompt.) Fix: gate on the SAME resource the prompt uses — whether /dev/tty can be opened — instead of fd 0. CI / real non-TTY runs have no controlling terminal so they still skip correctly. The probe ': <>/dev/tty' is set -e-safe inside the if.
1 parent 55c1e4b commit d8b6c3f

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

testing/classifier/.skills/test-classifier/scripts/test-classifier-dispatcher.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -746,8 +746,16 @@ submit_metrics_row() {
746746
local pr_number="$1"
747747
local classifier_json="$2"
748748

749-
if [[ ! -t 0 ]] || [[ "${CI:-}" == "true" ]]; then
750-
ai_review::info "--submit: non-interactive run — comment posted; skipping the helpfulness prompt + metrics row." >&2
749+
# Interactivity check: probe the CONTROLLING TERMINAL (/dev/tty), NOT fd 0.
750+
# The OBSERVED agent runs Bash tool subprocesses (pnpm install, vitest, …) with
751+
# the dispatcher's fd 0 as their stdin; those can consume it to EOF or leave it
752+
# non-TTY by the time we get here. Testing `[[ ! -t 0 ]]` then wrongly reports
753+
# "non-interactive" and silently skips the prompt — even though /dev/tty is
754+
# available and we could ask. The prompt below reads from /dev/tty, so the guard
755+
# must gate on the SAME thing: can we open /dev/tty? In CI / a real non-TTY run
756+
# there is no controlling terminal, so this still skips correctly.
757+
if [[ "${CI:-}" == "true" ]] || ! { : <>/dev/tty; } 2>/dev/null; then
758+
ai_review::info "--submit: non-interactive run (no controlling terminal) — comment posted; skipping the helpfulness prompt + metrics row." >&2
751759
return 0
752760
fi
753761
if ! command -v python3 &>/dev/null; then

0 commit comments

Comments
 (0)