tests: add cascade-failure detection to TUI integration (⬇≠success if line is cascade failure)
Some checks failed
Deploy (Gitea) / deploy (push) Failing after 3s
Some checks failed
Deploy (Gitea) / deploy (push) Failing after 3s
This commit is contained in:
@@ -340,8 +340,6 @@ test_handshake() {
|
|||||||
test_agent_responds() {
|
test_agent_responds() {
|
||||||
# Send text to the TUI and wait for an agent (⬇) response.
|
# Send text to the TUI and wait for an agent (⬇) response.
|
||||||
# This proves the full round-trip: TUI → daemon → pipeline → TUI.
|
# This proves the full round-trip: TUI → daemon → pipeline → TUI.
|
||||||
# The response may be a cascade failure message (no API key)
|
|
||||||
# or a real LLM reply — either way, ⬇ proves the daemon responded.
|
|
||||||
local before_ts
|
local before_ts
|
||||||
before_ts=$(date +%s)
|
before_ts=$(date +%s)
|
||||||
|
|
||||||
@@ -362,6 +360,17 @@ test_agent_responds() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test_agent_not_cascade_failure() {
|
||||||
|
# After test_agent_responds passes, verify the ⬇ line is NOT
|
||||||
|
# just a cascade failure message. If it is, the daemon is alive
|
||||||
|
# but no LLM backend is working.
|
||||||
|
if grep '⬇' "$TUI_LOG" | grep -qi 'cascade.*fail\|exhausted\|neural cascade'; then
|
||||||
|
echo "WARNING: LLM cascade failure — no working backend configured?" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
test_eval_command() {
|
test_eval_command() {
|
||||||
tmux send-keys -t tui-test "/eval (+ 1 2)" Enter
|
tmux send-keys -t tui-test "/eval (+ 1 2)" Enter
|
||||||
sleep 2
|
sleep 2
|
||||||
@@ -380,11 +389,12 @@ test_connection_drop() {
|
|||||||
grep -qi 'connection.*lost\|ERROR.*Connection' "$TUI_LOG"
|
grep -qi 'connection.*lost\|ERROR.*Connection' "$TUI_LOG"
|
||||||
}
|
}
|
||||||
|
|
||||||
run_test "handshake" test_handshake
|
run_test "handshake" test_handshake
|
||||||
run_test "agent-responds" test_agent_responds
|
run_test "agent-responds" test_agent_responds
|
||||||
run_test "eval-command" test_eval_command
|
run_test "agent-not-cascade-fail" test_agent_not_cascade_failure
|
||||||
run_test "status-bar" test_status_bar
|
run_test "eval-command" test_eval_command
|
||||||
run_test "connection-drop" test_connection_drop
|
run_test "status-bar" test_status_bar
|
||||||
|
run_test "connection-drop" test_connection_drop
|
||||||
|
|
||||||
# ---- Summary ----
|
# ---- Summary ----
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
@@ -45,8 +45,6 @@ test_handshake() {
|
|||||||
test_agent_responds() {
|
test_agent_responds() {
|
||||||
# Send text to the TUI and wait for an agent (⬇) response.
|
# Send text to the TUI and wait for an agent (⬇) response.
|
||||||
# This proves the full round-trip: TUI → daemon → pipeline → TUI.
|
# This proves the full round-trip: TUI → daemon → pipeline → TUI.
|
||||||
# The response may be a cascade failure message (no API key)
|
|
||||||
# or a real LLM reply — either way, ⬇ proves the daemon responded.
|
|
||||||
local before_ts
|
local before_ts
|
||||||
before_ts=$(date +%s)
|
before_ts=$(date +%s)
|
||||||
|
|
||||||
@@ -67,6 +65,17 @@ test_agent_responds() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test_agent_not_cascade_failure() {
|
||||||
|
# After test_agent_responds passes, verify the ⬇ line is NOT
|
||||||
|
# just a cascade failure message. If it is, the daemon is alive
|
||||||
|
# but no LLM backend is working.
|
||||||
|
if grep '⬇' "$TUI_LOG" | grep -qi 'cascade.*fail\|exhausted\|neural cascade'; then
|
||||||
|
echo "WARNING: LLM cascade failure — no working backend configured?" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
test_eval_command() {
|
test_eval_command() {
|
||||||
tmux send-keys -t tui-test "/eval (+ 1 2)" Enter
|
tmux send-keys -t tui-test "/eval (+ 1 2)" Enter
|
||||||
sleep 2
|
sleep 2
|
||||||
@@ -85,11 +94,12 @@ test_connection_drop() {
|
|||||||
grep -qi 'connection.*lost\|ERROR.*Connection' "$TUI_LOG"
|
grep -qi 'connection.*lost\|ERROR.*Connection' "$TUI_LOG"
|
||||||
}
|
}
|
||||||
|
|
||||||
run_test "handshake" test_handshake
|
run_test "handshake" test_handshake
|
||||||
run_test "agent-responds" test_agent_responds
|
run_test "agent-responds" test_agent_responds
|
||||||
run_test "eval-command" test_eval_command
|
run_test "agent-not-cascade-fail" test_agent_not_cascade_failure
|
||||||
run_test "status-bar" test_status_bar
|
run_test "eval-command" test_eval_command
|
||||||
run_test "connection-drop" test_connection_drop
|
run_test "status-bar" test_status_bar
|
||||||
|
run_test "connection-drop" test_connection_drop
|
||||||
|
|
||||||
# ---- Summary ----
|
# ---- Summary ----
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
Reference in New Issue
Block a user