aboutsummaryrefslogtreecommitdiff
path: root/tests/e2e.sh
diff options
context:
space:
mode:
authorIgor Soarez <igor@soarez.org>2026-11-03 13:05:57 +0200
committerIgor Soarez <igor@soarez.org>2026-11-03 13:05:57 +0200
commitbd1eb9ef9b3b89ff5825eb8bf9b2e978167c9ad0 (patch)
treeac3ea2a1f0f2243c692ba5e5fab251df6c9f077b /tests/e2e.sh
parent8146d1db419e8bdacd75920da6f3761abf724853 (diff)
show each pi agent's context use: a meter in the panel and search, text in the menu
Diffstat (limited to 'tests/e2e.sh')
-rwxr-xr-xtests/e2e.sh34
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