v0.13.0 befd698

ack_test.go RawHistoryFolder

1package subagents
2
3import (
4	"testing"
5	"time"
6)
7
8func TestResumePromptAcknowledgementRequiresDurableUserMessageAndTurnStart(t *testing.T) {
9	acceptedAt := time.Now().Add(-time.Second)
10	prompt := "follow-up prompt"
11	user := NewEvent("user_message", map[string]any{
12		"content": []any{map[string]any{"type": "text", "text": prompt}},
13	})
14	started := NewEvent(EventTurnStarted, map[string]any{
15		"lifetime_turns":    2,
16		"current_run_turns": 1,
17	})
18
19	if resumePromptAcknowledged([]Event{started}, prompt, acceptedAt) {
20		t.Fatal("turn.started alone acknowledged a pending prompt")
21	}
22	if resumePromptAcknowledged([]Event{user}, prompt, acceptedAt) {
23		t.Fatal("crash point after durable user message acknowledged before turn.started")
24	}
25	if !resumePromptAcknowledged([]Event{user, started}, prompt, acceptedAt) {
26		t.Fatal("matching durable user message followed by delegated turn.started was not acknowledged")
27	}
28}
29
30func TestResumePromptAcknowledgementIgnoresNestedTurnStart(t *testing.T) {
31	acceptedAt := time.Now().Add(-time.Second)
32	prompt := "follow-up prompt"
33	user := NewEvent("user_message", map[string]any{
34		"content": []any{map[string]any{"type": "text", "text": prompt}},
35	})
36	nested := NewEvent(EventTurnStarted, map[string]any{"nested_turn": true})
37	if resumePromptAcknowledged([]Event{user, nested}, prompt, acceptedAt) {
38		t.Fatal("nested turn.started acknowledged a pending delegated prompt")
39	}
40}
41
42func TestResumePromptAcknowledgementIgnoresStaleMatchingUserMessage(t *testing.T) {
43	acceptedAt := time.Now()
44	prompt := "follow-up prompt"
45	user := NewEvent("user_message", map[string]any{
46		"content": []any{map[string]any{"type": "text", "text": prompt}},
47	})
48	user.Time = acceptedAt.Add(-time.Millisecond)
49	started := NewEvent(EventTurnStarted, map[string]any{"lifetime_turns": 2, "current_run_turns": 1})
50	if resumePromptAcknowledged([]Event{user, started}, prompt, acceptedAt) {
51		t.Fatal("stale matching user message acknowledged a pending prompt")
52	}
53}
54
55func TestResumePromptAcknowledgementIgnoresAmbiguousUserMessage(t *testing.T) {
56	acceptedAt := time.Now().Add(-time.Second)
57	prompt := "follow-up prompt"
58	user := NewEvent("user_message", map[string]any{
59		"content": []any{map[string]any{"type": "text", "text": "older prompt"}},
60	})
61	started := NewEvent(EventTurnStarted, map[string]any{"lifetime_turns": 2, "current_run_turns": 1})
62	if resumePromptAcknowledged([]Event{user, started}, prompt, acceptedAt) {
63		t.Fatal("ambiguous user message acknowledged a pending prompt")
64	}
65}

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 477

↑↓ moveenter openesc close