logout: stop double-wrapping session revoke errors · Entire

logout: stop double-wrapping session revoke errors

16fcb5d→main·

toothbrush·1mo ago·1 file·+4 added/-2 removed

revokeAllSessions wrapped ListSessions/RevokeSession failures with their own prefixes, but (*api.Client) already wraps both (incl. the session id), producing "list sessions: list sessions: …" / "revoke session X: revoke session X: …". Return the wrapped errors verbatim.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

Sessions

009341d5e790View transcript

[?
Refine logout Command with --all-contexts FlagClaude Code·1 step](/content/gh/entireio/cli/session/65e7cd20-dacf-4c93-a475-a4cd7e235c9c#timeline-009341d5e790/index.html)

Changes

1

107 unmodified lines

108
109
110
111
112
113
114
113
115
116
117
118
119
118
120
121
122
123

107 unmodified lines

// failure, so one stuck session doesn't strand the rest.
func revokeAllSessions(ctx context.Context, coreURL, token string) error {
    client := newSessionsClient(coreURL, token)
    // ListSessions and RevokeSession already wrap with their own action
    // context (incl. the session id), so return their errors verbatim.
    sessions, err := client.ListSessions(ctx)
    if err != nil {
        return fmt.Errorf("list sessions: %w", err)
        return err //nolint:wrapcheck // ListSessions already wraps with "list sessions"
    }
    var firstErr error
    for _, s := range sessions {
        if err := client.RevokeSession(ctx, s.ID); err != nil && firstErr == nil {
            firstErr = fmt.Errorf("revoke session %s: %w", s.ID, err)
            firstErr = err
        }
    }
    return firstErr
}

Mcmd/entire/cli/logout.go+4/-2