detached 3ee53c5

test(agent): synchronize subagent wait completion

commit
3ee53c5c3bf65d53a05a8de2cf88968a59b9fbac
author
brice · · 2026-08-08 05:41 UTC
parent
f976a5c
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
1 file · +13 -13
M packages/agent/modes/subagents_slash_test.go +13 -13
@@ -290,20 +290,20 @@ func TestRunSupervisorWaitReportsCompletionBeforeCancellation(t *testing.T) {
290290 if err != nil {
291291 t.Fatal(err)
292292 }
293+ watcherDone := make(chan struct{})
294+ iv.subagentsWaitWatcherDone = func() { close(watcherDone) }
293295 iv.runSubagents(context.Background(), []string{"wait", a.ID})
294- deadline := time.After(time.Second)
295- for {
296- iv.mu.Lock()
297- status := iv.statusOK
298- iv.mu.Unlock()
299- if status == "completed "+a.ID {
300- return
301- }
302- select {
303- case <-deadline:
304- t.Fatalf("wait did not report completion; status = %q", status)
305- case <-time.After(time.Millisecond):
306- }
296+ select {
297+ case <-watcherDone:
298+ case <-time.After(5 * time.Second):
299+ t.Fatal("timed out waiting for wait watcher to report completion")
300+ }
301+
302+ iv.mu.Lock()
303+ status := iv.statusOK
304+ iv.mu.Unlock()
305+ if status != "completed "+a.ID {
306+ t.Fatalf("wait completion status = %q; want %q", status, "completed "+a.ID)
307307 }
308308 }
309309
@@ -290,20 +290,20 @@ func TestRunSupervisorWaitReportsCompletionBeforeCancellation(t *testing.T) {
290 if err != nil {290 if err != nil {
291 t.Fatal(err)291 t.Fatal(err)
292 }292 }
293+ watcherDone := make(chan struct{})
294+ iv.subagentsWaitWatcherDone = func() { close(watcherDone) }
293 iv.runSubagents(context.Background(), []string{"wait", a.ID})295 iv.runSubagents(context.Background(), []string{"wait", a.ID})
294- deadline := time.After(time.Second)296+ select {
295- for {297+ case <-watcherDone:
296- iv.mu.Lock()298+ case <-time.After(5 * time.Second):
297- status := iv.statusOK299+ t.Fatal("timed out waiting for wait watcher to report completion")
298- iv.mu.Unlock()300+ }
299- if status == "completed "+a.ID {301+
300- return302+ iv.mu.Lock()
301- }303+ status := iv.statusOK
302- select {304+ iv.mu.Unlock()
303- case <-deadline:305+ if status != "completed "+a.ID {
304- t.Fatalf("wait did not report completion; status = %q", status)306+ t.Fatalf("wait completion status = %q; want %q", status, "completed "+a.ID)
305- case <-time.After(time.Millisecond):
306- }
307 }307 }
308 }308 }
309 309

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