detached 2b65822

fix: stabilize cross-platform test cleanup

commit
2b658227ff30f594db23f13951b5396ee18269bb
author
brice · · 2026-08-05 04:05 UTC
parent
d926884
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
3 files · +12 -4
M packages/agent/lsp/client.go +3 -2
@@ -543,6 +543,7 @@ func (c *Client) Close() error {
543543 _ = c.stdin.Close()
544544 c.writeMu.Unlock()
545545 killed := false
546+ process := c.cmd.Process
546547 exited := make(chan error, 1)
547548 go func() { exited <- c.cmd.Wait() }()
548549 timer := time.NewTimer(500 * time.Millisecond)
@@ -550,8 +551,8 @@ func (c *Client) Close() error {
550551 case waitErr = <-exited:
551552 timer.Stop()
552553 case <-timer.C:
553- if c.cmd.Process != nil && c.cmd.ProcessState == nil {
554- killed = c.cmd.Process.Kill() == nil
554+ if process != nil {
555+ killed = process.Kill() == nil
555556 }
556557 waitErr = <-exited
557558 }
@@ -543,6 +543,7 @@ func (c *Client) Close() error {
543 _ = c.stdin.Close()543 _ = c.stdin.Close()
544 c.writeMu.Unlock()544 c.writeMu.Unlock()
545 killed := false545 killed := false
546+ process := c.cmd.Process
546 exited := make(chan error, 1)547 exited := make(chan error, 1)
547 go func() { exited <- c.cmd.Wait() }()548 go func() { exited <- c.cmd.Wait() }()
548 timer := time.NewTimer(500 * time.Millisecond)549 timer := time.NewTimer(500 * time.Millisecond)
@@ -550,8 +551,8 @@ func (c *Client) Close() error {
550 case waitErr = <-exited:551 case waitErr = <-exited:
551 timer.Stop()552 timer.Stop()
552 case <-timer.C:553 case <-timer.C:
553- if c.cmd.Process != nil && c.cmd.ProcessState == nil {554+ if process != nil {
554- killed = c.cmd.Process.Kill() == nil555+ killed = process.Kill() == nil
555 }556 }
556 waitErr = <-exited557 waitErr = <-exited
557 }558 }
M packages/agent/subagents/profiles.go +5 -1
@@ -51,7 +51,11 @@ func Discover(cwd, userHome string) ([]*Profile, []error) {
5151 for _, loc := range searchDirs(cwd, userHome) {
5252 entries, err := os.ReadDir(loc.dir)
5353 if err != nil {
54- if !os.IsNotExist(err) {
54+ if os.IsNotExist(err) {
55+ if info, statErr := os.Stat(loc.dir); statErr == nil && !info.IsDir() {
56+ errs = append(errs, fmt.Errorf("read subagent directory %s: not a directory", loc.dir))
57+ }
58+ } else {
5559 errs = append(errs, fmt.Errorf("read subagent directory %s: %w", loc.dir, err))
5660 }
5761 continue
@@ -51,7 +51,11 @@ func Discover(cwd, userHome string) ([]*Profile, []error) {
51 for _, loc := range searchDirs(cwd, userHome) {51 for _, loc := range searchDirs(cwd, userHome) {
52 entries, err := os.ReadDir(loc.dir)52 entries, err := os.ReadDir(loc.dir)
53 if err != nil {53 if err != nil {
54- if !os.IsNotExist(err) {54+ if os.IsNotExist(err) {
55+ if info, statErr := os.Stat(loc.dir); statErr == nil && !info.IsDir() {
56+ errs = append(errs, fmt.Errorf("read subagent directory %s: not a directory", loc.dir))
57+ }
58+ } else {
55 errs = append(errs, fmt.Errorf("read subagent directory %s: %w", loc.dir, err))59 errs = append(errs, fmt.Errorf("read subagent directory %s: %w", loc.dir, err))
56 }60 }
57 continue61 continue
M packages/core/session_snapshot_test.go +4 -1
@@ -508,10 +508,13 @@ func TestSnapshotRemovesOrphanedToolResultsAndMapsCheckpointCount(t *testing.T)
508508 if err != nil {
509509 t.Fatal(err)
510510 }
511- _, branchMessages, err := OpenSession(branchPath)
511+ branchSession, branchMessages, err := OpenSession(branchPath)
512512 if err != nil {
513513 t.Fatal(err)
514514 }
515+ if err := branchSession.Close(); err != nil {
516+ t.Fatal(err)
517+ }
515518 if len(branchMessages) != 3 {
516519 t.Fatalf("branch messages = %d, want 3", len(branchMessages))
517520 }
@@ -508,10 +508,13 @@ func TestSnapshotRemovesOrphanedToolResultsAndMapsCheckpointCount(t *testing.T)
508 if err != nil {508 if err != nil {
509 t.Fatal(err)509 t.Fatal(err)
510 }510 }
511- _, branchMessages, err := OpenSession(branchPath)511+ branchSession, branchMessages, err := OpenSession(branchPath)
512 if err != nil {512 if err != nil {
513 t.Fatal(err)513 t.Fatal(err)
514 }514 }
515+ if err := branchSession.Close(); err != nil {
516+ t.Fatal(err)
517+ }
515 if len(branchMessages) != 3 {518 if len(branchMessages) != 3 {
516 t.Fatalf("branch messages = %d, want 3", len(branchMessages))519 t.Fatalf("branch messages = %d, want 3", len(branchMessages))
517 }520 }

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