trail: tolerate resumed agent exit status · Entire
trail: tolerate resumed agent exit status
206d725→main·
peyton-alt·3w ago·2 files·+31 added/-0 removed
Sessions
e1d941a3cd43View transcript
[?
Add Trail Resume SubcommandCodex·GPT-5.5·1 step](/content/gh/entireio/cli/session/019ef5f3-3472-7f70-82f7-6f0ce46691f4#timeline-e1d941a3cd43/index.html)
Changes
2
cmd/entire/cli
Mtrail_resume_cmd.go+5
Mtrail_resume_cmd_test.go+26
5 unmodified lines
6
7
8
9
10
11
12
1026 unmodified lines
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
5 unmodified lines
"errors"
"fmt"
"io"
"os/exec"
"sort"
"strconv"
"strings"
1026 unmodified lines
}
fmt.Fprintf(w, "\nLaunching: %s\n", resumeCmd)
if err := cmd.Run(); err != nil {
var exitErr *exec.ExitError
if errors.As(err, &exitErr) {
return nil
}
return fmt.Errorf("resume command failed: %w", err)
}
return nil
Mcmd/entire/cli/trail_resume_cmd.go+5
7 unmodified lines
8
9
10
11
12
13
14
896 unmodified lines
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
7 unmodified lines
"io"
"os"
"path/filepath"
"runtime"
"strings"
"testing"
"time"
896 unmodified lines
}
}
func TestLaunchTrailRestoredSessionTreatsAgentExitAsHandled(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("uses POSIX shell script fake executable")
}
binDir := t.TempDir()
fakeCodex := filepath.Join(binDir, "codex")
if err := os.WriteFile(fakeCodex, []byte("#!/bin/sh\nexit 42\n"), 0o755); err != nil {
t.Fatalf("write fake codex: %v", err)
}
t.Setenv("PATH", binDir+string(os.PathListSeparator)+os.Getenv("PATH"))
var out strings.Builder
err := launchTrailRestoredSession(context.Background(), &out, strategy.RestoredSession{
SessionID: "codex-session",
Agent: types.AgentType("Codex"),
})
if err != nil {
t.Fatalf("launchTrailRestoredSession() error = %v, want nil", err)
}
if !strings.Contains(out.String(), "Launching: codex resume codex-session") {
t.Fatalf("launch output missing command:\n%s", out.String())
}
}
func lineContaining(text, needle string) string {
for _, line := range strings.Split(text, "\n") {
if strings.Contains(line, needle) {