v0.12.1 b9ff687

turn_classification_test.go RawHistoryFolder

1package subagents
2
3import (
4	"testing"
5	"time"
6)
7
8func TestTurnClassificationUsesStableBoundaryFieldsAcrossProtocolVersions(t *testing.T) {
9	cases := []struct {
10		name      string
11		event     Event
12		class     turnEventClass
13		delegated bool
14	}{
15		{
16			name: "current delegated",
17			event: NewEvent(EventTurnStarted, map[string]any{
18				"lifetime_turns":    4,
19				"current_run_turns": 2,
20			}),
21			class:     turnEventDelegated,
22			delegated: true,
23		},
24		{
25			name: "current nested",
26			event: NewEvent(EventTurnStarted, map[string]any{
27				"nested_turn": true,
28				"step":        3,
29			}),
30			class: turnEventNested,
31		},
32		{
33			name:      "protocol v1 delegated fallback",
34			event:     Event{Type: EventTurnStarted, Version: 1, Time: time.Now()},
35			class:     turnEventDelegated,
36			delegated: true,
37		},
38		{
39			name:  "protocol v1 nested turn_start",
40			event: Event{Type: "turn_start", Version: 1, Time: time.Now()},
41			class: turnEventNested,
42		},
43	}
44	for _, tc := range cases {
45		t.Run(tc.name, func(t *testing.T) {
46			if got := classifyTurnEvent(tc.event); got != tc.class {
47				t.Fatalf("classifyTurnEvent = %d, want %d", got, tc.class)
48			}
49			if got := isDelegatedTurnStart(tc.event); got != tc.delegated {
50				t.Fatalf("isDelegatedTurnStart = %v, want %v", got, tc.delegated)
51			}
52		})
53	}
54}
55
56func TestTurnClassificationKeepsNestedAndDelegatedEndsSeparate(t *testing.T) {
57	if isDelegatedTurnEnd(NewEvent("turn_end", map[string]any{"stop": "tool_use"})) {
58		t.Fatal("provider turn_end was classified as delegated")
59	}
60	if !isDelegatedTurnEnd(NewEvent("turn_end", map[string]any{"step": 2})) {
61		t.Fatal("worker turn_end was not classified as delegated")
62	}
63}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 476

↑↓ moveenter openesc close