diff options
| author | Igor Soarez <igor@soarez.org> | 2026-10-23 18:45:06 +0300 |
|---|---|---|
| committer | Igor Soarez <igor@soarez.org> | 2026-10-23 18:45:06 +0300 |
| commit | b4f45632debe6b8dc2f44ca6cc1b003d9093ad33 (patch) | |
| tree | 550add91d02656156330f497d60fe0e6bdf2fc35 /tests | |
| parent | 12ce9f3f8edc84064458b649e8615247641dad36 (diff) | |
session groups: list each pane once, save each group once
a pane in several sessions (a session group, `new-session -t`, or a
linked window) was listed once per session: every agent of a group showed
twice in the menu, panel, search, `dingger status`, and the counts. and
snapshots saved each session of a group with its own copy of the windows,
so restore would have rebuilt them twice and resumed each agent twice on
one session file.
- a pane keeps its first listing (tmux lists sessions by name) and is
attended if the user looks at it through any session of the group.
- snapshots keep the first session of each group; the others are not
restored.
e2e step 19 covers both; the previous binaries fail it. two checks (step
11's and this one) waited for idle after a turn that started from idle,
which passed before the turn was even processed: they now wait for
working first, and the negative control for group attendance fails as it
should. step 18 now waits for the snapshot it later restores from.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/e2e.sh | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/tests/e2e.sh b/tests/e2e.sh index 670f84a..75dbc31 100755 --- a/tests/e2e.sh +++ b/tests/e2e.sh @@ -250,7 +250,10 @@ if [ -x "$MENUBAR" ]; then expect "menu title" "mb --print | head -1" "title: ×1 ✓1" expect "menu rows: herdr priority; idle most recent first (C1 since its jump in step 4, B1 since the start)" \ "mb --print | tail -n +2 | cut -f1,2 | tr '\t\n' '|;'" "× blocked|pi;✓ done|Deploy the widget;○ idle|pi;○ idle|Review PR 42;" - hook "$B1" working; hook "$B1" idle + # Wait for working: B1 was idle before, so idle alone would not show the turn. + hook "$B1" working + expect "B1 working" "opt $B1 @agent_state" working + hook "$B1" idle expect "B1 finishes a turn while watched: idle" "opt $B1 @agent_state" idle expect "and is now the most recent idle agent: listed first" \ "mb --print | tail -n +2 | cut -f1,2 | tr '\t\n' '|;'" "× blocked|pi;✓ done|Deploy the widget;○ idle|Review PR 42;○ idle|pi;" @@ -618,6 +621,7 @@ expect "claude is detected" "r show -pv -t '=cc:talked' @agent 2>/dev/null; r sh claude" 80 expect "its hook's session is kept on its pane" "r show -pv -t $TALKED @agent_session 2>/dev/null" "$W/claude/talked.jsonl" 80 expect "snapshot: claude's session" "in_snapshot '\"session\": \"$W/claude/talked.jsonl\"'" True 80 +expect "snapshot: the command line of the claude without a transcript" "in_snapshot '\"command\": \"claude fresh\"'" True 80 r kill-server expect "a new restore candidate" \ "python3 -c 'import json,sys; print(\"cc\" in [s[\"name\"] for s in json.load(open(sys.argv[1]))[\"snapshot\"][\"sessions\"]])' $STATE2/restore.json 2>/dev/null" True 80 @@ -634,6 +638,41 @@ expect "the resumed claude reports its session again" \ "r show -pv -t '=cc:talked' @agent_session 2>/dev/null" "$W/claude/talked.jsonl" 80 [ "$FAILS" -gt 0 ] && { echo "--- restore-cc:"; cat "$DIR/restore-cc.out"; } +# --- 19. a session group: its panes once, its windows saved once ------------- +echo "19. session group" +start_viewer +r new-session -d -s grp -n agent -c "$W/one" +r new-window -d -t '=grp:' -n other -c "$W/two" +r new-session -d -t grp -s grp-2 +r send-keys -t '=grp:agent' 'pi' Enter +GA=$(r display -p -t '=grp:agent' '#{pane_id}') +expect "the group's agent is detected" "r show -pv -t $GA @agent 2>/dev/null" pi 80 +expect "dingger status lists it once" "renv \"$DINGGER\" status | grep -c ' grp'" 1 +expect "the menu lists it once" "mbr --print | grep -c 'grp'" 1 +# Watched only through grp-2: grp shows another window, nobody attaches it. +r select-window -t '=grp:other' +r select-window -t '=grp-2:agent' +r switch-client -c "$(r list-clients -F '#{client_name}' | head -1)" -t '=grp-2' +touch "$W/sessions/grp.jsonl" +# Wait for working: the agent was idle before, so idle alone would not show the turn. +hook2 "$GA" working "$W/sessions/grp.jsonl" +expect "the group's agent working" "r show -pv -t $GA @agent_state" working 80 +hook2 "$GA" idle "$W/sessions/grp.jsonl" +expect "a turn finished while watched through grp-2 is idle, not done" "r show -pv -t $GA @agent_state" idle 80 +expect "snapshot: the group is saved once" \ + "python3 -c 'import json,sys; print(sorted(s[\"name\"] for s in json.load(open(sys.argv[1]))[\"sessions\"] if s[\"name\"].startswith(\"grp\")))' \"\$(latest_snapshot)\"" \ + "['grp']" 80 +expect "snapshot: with the agent's session" "in_snapshot '\"session\": \"$W/sessions/grp.jsonl\"'" True 80 +r kill-server +expect "the candidate: the group once" \ + "python3 -c 'import json,sys; print(sorted(s[\"name\"] for s in json.load(open(sys.argv[1]))[\"snapshot\"][\"sessions\"] if s[\"name\"].startswith(\"grp\")))' $STATE2/restore.json 2>/dev/null" "['grp']" 80 +expect "dry run plans the group once" "renv \"$DINGGER\" restore --dry-run 2>/dev/null | grep -E '^[a-z]+ +grp' | cut -c1-14" "create grp: " +: >"$DIR/pi-args" +renv "$DINGGER" restore --session grp >"$DIR/restore-grp.out" 2>&1 +expect "restore: the agent is resumed once" "grep -c -- '--session $W/sessions/grp.jsonl' $DIR/pi-args" 1 +expect "with both windows" "r list-windows -t '=grp' -F '#{window_name}' | tr '\n' ' '" "agent other " +expect "no real agent runs in a test pane (group)" "real_agents" "" + # 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 |
