diff options
Diffstat (limited to 'tests/e2e.sh')
| -rwxr-xr-x | tests/e2e.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/e2e.sh b/tests/e2e.sh index e5b5865..b1709bc 100755 --- a/tests/e2e.sh +++ b/tests/e2e.sh @@ -1144,6 +1144,40 @@ expect "in the total too" "gopt @dingger_cost_today" 2.75 t kill-session -t cost expect "closed agents still count" "gopt @dingger_cost_today" 2.75 10 +# --- 26. how full each agent's context is -------------------------------------- +echo "26. context use" +context_report() { # pane context + python3 - "$HOOK" "$1" "$2" <<'PY' +import json, socket, sys +params = {"pane_id": sys.argv[2], "agent": "pi", "state": "idle", "context": sys.argv[3]} +s = socket.socket(socket.AF_UNIX) +s.connect(sys.argv[1]) +s.sendall((json.dumps({"method": "pane.report_agent", "params": params}) + "\n").encode()) +s.close() +PY +} +# A process named pi (found by name, so it can also exit), started in a +# shell that stays. +t new-session -d -s ctx -n x1 -c "$DIR" "/bin/sh" +X1=$(t display -p -t ctx:x1 '#{pane_id}') +t send-keys -t "$X1" "$DIR/rbin/real/pi 100000" Enter +# The daemon polls slowly here; a poke has it look now. +expect "a pi agent" "$DINGGER poke; opt $X1 @agent" pi 80 +context_report "$X1" 78.4 +expect "kept in whole percent" "opt $X1 @dingger_context" 78 50 +expect "the menu: its percentage" "mb --print | grep -F 'ctx · x1' | cut -f3" "ctx · x1 · pi · 78%" +expect "the panel: in its own column" "mb --print-panel --full | grep -F 'ctx · x1' | cut -f3,4" "ctx · x1 · pi 78%" +expect "dingger status: CTX" "$DINGGER status | grep -F 'ctx · x1' | grep -c ' 78% '" 1 +context_report "$X1" "" +expect "unknown (compacted): none" "opt $X1 @dingger_context" "" 50 +expect "nor in the menu" "mb --print | grep -F 'ctx · x1' | cut -f3" "ctx · x1 · pi" +context_report "$X1" 12 +expect "known again" "opt $X1 @dingger_context" 12 50 +t send-keys -t "$X1" C-c +expect "the agent exits" "$DINGGER poke; opt $X1 @agent" "" 80 +expect "its context goes with it" "opt $X1 @dingger_context" "" 50 +t kill-session -t ctx + # Every daemon this run started must stop with it. kill "$DAEMON_PID" "$DAEMON2_PID" 2>/dev/null expect "the test daemons stop" "ps -o pid= -p $DAEMON_PID,$DAEMON2_PID | wc -l | tr -d ' '" 0 |
