resume: print command when session log is unavailable · Entire

resume: print command when session log is unavailable

9048caa→main·

peyton-alt·3w ago·2 files·+12 added/-3 removed

Sessions

d9163150e6c7View transcript

[?
Add Trail Resume SubcommandCodex·GPT-5.5·1 step](/content/gh/entireio/cli/session/019ef5f3-3472-7f70-82f7-6f0ce46691f4#timeline-d9163150e6c7/index.html)

Changes

2

986 unmodified lines

987
988
989
990
990
991
992
993
12 unmodified lines

1006
1007
1008
1009
1009
1010
1011
1012
47 unmodified lines

1060
1061
1062
1063
1063
1064
1065
1066
6 unmodified lines

1073
1074
1075
1076
1077
1078
1079
1080

986 unmodified lines

logging.Debug(ctx, "resume session: empty checkpoint ID",
        slog.String("checkpoint_id", checkpointID.String()),
    )
    return unavailableSessionLogResult(w, restored, sessionLogPath, force)
    return unavailableSessionLogResult(w, ag, restored, sessionLogPath, force)
}

repo, repoErr := openRepository(ctx)
12 unmodified lines

slog.String("checkpoint_id", checkpointID.String()),
        slog.String("session_id", sessionID),
    )
        return unavailableSessionLogResult(w, restored, sessionLogPath, force)
        return unavailableSessionLogResult(w, ag, restored, sessionLogPath, force)
    }
        logging.Error(ctx, "resume session failed",
        slog.String("checkpoint_id", checkpointID.String()),
47 unmodified lines

return restored, true, nil
}

func unavailableSessionLogResult(w io.Writer, restored strategy.RestoredSession, sessionLogPath string, force bool) (strategy.RestoredSession, bool, error) {
func unavailableSessionLogResult(w io.Writer, ag agent.Agent, restored strategy.RestoredSession, sessionLogPath string, force bool) (strategy.RestoredSession, bool, error) {
    if _, statErr := os.Stat(sessionLogPath); statErr == nil {
        if force {
            fmt.Fprintf(w, "Checkpoint session log for '%s' not available; keeping existing local session log.\n", restored.SessionID)
6 unmodified lines

}

fmt.Fprintf(w, "Session '%s' found in commit trailer but session log not available\n", restored.SessionID)
    fmt.Fprintf(w, "\nTo continue this session:\n");
    fmt.Fprintf(w, "  %s\n", ag.FormatResumeCommand(restored.SessionID))
    return restored, false, nil
}

Mcmd/entire/cli/resume.go+5/-3

991 unmodified lines

992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004

991 unmodified lines

if !strings.Contains(stdout.String(), "session log not available") {
            t.Fatalf("restoreSingleSession() output = %q, want missing log message", stdout.String())
    }
    if !strings.Contains(stdout.String(), "\nTo continue this session:\n") {
            t.Fatalf("restoreSingleSession() output = %q, want continuation header", stdout.String())
    }
    wantCommand := "  " + ag.FormatResumeCommand(sessionID) + "\n"
    if !strings.Contains(stdout.String(), wantCommand) {
            t.Fatalf("restoreSingleSession() output = %q, want command %q", stdout.String(), wantCommand)
    }
}

func TestCheckRemoteMetadata_MetadataExistsOnRemote(t *testing.T) {