summaryrefslogtreecommitdiff
path: root/tests/tui.exp
blob: b8cdf4d2658963821a040fc0552d5aa84dbf2330 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
set timeout 12
set stty_init "rows 32 columns 180"
log_user 0
log_file -a $env(QUOTA_LOG)
match_max 32000
spawn -noecho $env(PANTO) -m antigravity:fast -r low
proc see {pattern} {expect {
 -re $pattern {}
 timeout {puts stderr "timeout awaiting $pattern"; exit 1}
 eof {puts stderr "early exit: $expect_out(buffer)"; exit 1}
}}
see {antigravity:}; see {27%}
foreach {prompt answer} {hello primary-tool-ok again same-session-ok} {
 send -- $prompt; see $prompt; send -- "\r"
 if {$prompt == "hello"} {
   see {steer-window-open}; send -- "boundary steer"; see {boundary steer}; send -- "\r"; see {1 steering}
   set flag [open "$env(HOME)/.local/share/panto-antigravity/google/steer-queued" w]; close $flag
   see {8\.2k/1M ctx}; set flag [open "$env(HOME)/.local/share/panto-antigravity/google/context-visible" w]; close $flag
   see $answer
   send -- "/reasoning high"; see {/reasoning high}; send -- "\r"; see {reasoning -> high}
 } else {see $answer}
}
send -- "/fixture-notice "; see {/fixture-notice }; send -- "\r"; see {workflow-notice-ok}
send -- "\003"; expect eof; wait
set flag [open "$env(HOME)/.local/share/panto-antigravity/google/usage-failure" w]; close $flag
spawn -noecho $env(PANTO) resume -m antigravity:fast -r high
see {antigravity:}; see {unavailable}; send -- "resume"; see {resume}; send -- "\r"; see {resumed-ok}
send -- "\003"; expect eof; wait

# Select an earlier answer (not the resumed tip), then cold-resume after an
# unsuccessful turn.
spawn -noecho $env(PANTO) resume -m antigravity:fast -r low
see {antigravity:}; send -- "/tree "; see {/tree }; send -- "\r"; see {session tree}
send -- "primary-tool-ok"; after 150; send -- "\r"; see {branched from}
foreach {query answer} {branch-probe branch-seed-ok warm-probe warm-after-seed-ok cancel-probe {stopped: cancelled}} {
 send -- $query; see $query; send -- "\r"; see $answer
}
send -- "\003"; expect eof; wait
spawn -noecho $env(PANTO) resume -m antigravity:fast -r low
see {antigravity:}; send -- "cold-probe"; see {cold-probe}; send -- "\r"; see {cold-resume-ok}
send -- "\003"; expect eof; wait

# Recreate the saved tail from the original failure using this fake home's
# real session log: tool result, steering text, workflow text, no answer.
set recovered 0
foreach path [glob $env(HOME)/.local/share/panto/sessions/*/*.jsonl] {
 set fd [open $path r]; set records [split [read $fd] "\n"]; close $fd
 set end [lsearch -glob $records {*"text":"boundary workflow notice"*}]; if {$end < 0} continue
 set fd [open $path w]; puts $fd [join [lrange $records 0 $end] "\n"]; close $fd
 spawn -noecho $env(PANTO) resume [file rootname [file tail $path]] -m antigravity:fast -r low
 see {antigravity:}; send -- "\030"; see {\[reloaded\]}; send -- "\020"; see {proceed-recovered-ok}
 send -- "\003"; expect eof; wait; set recovered 1; break
}
if {!$recovered} {error "no persisted steering fixture"}

# Setup that never lists the relay must fail without submitting.
set flag [open "$env(HOME)/.local/share/panto-antigravity/google/skip-list" w]; close $flag
spawn -noecho $env(PANTO) --incognito -m antigravity:fast -r low
see {antigravity:}; send -- "stall"; see {stall}; send -- "\r"; see {prompt not sent}
send -- "\003"; expect eof; wait

# Also check unconditional launch flags when nothing is exported.
set cfg [open "$env(HOME)/.panto/config.toml" a]; puts $cfg {tools=[]}; close $cfg
set flag [open "$env(HOME)/.local/share/panto-antigravity/google/no-tools" w]; close $flag
spawn -noecho $env(PANTO) --incognito -m antigravity:fast -r low
see {antigravity:}; send -- "no-tools"; see {no-tools}; send -- "\r"; see {no-tools-ok}
send -- "\003"; expect eof; wait
# xhigh exists before switching models, but not on gemini-test.
spawn -noecho $env(PANTO) --incognito -m antigravity:fast -r xhigh
see {antigravity:}; send -- "unsupported"; see {unsupported}; send -- "\r"
see {reasoning level xhigh}
send -- "\003"; expect eof; wait