feat: add retry logic, concurrent fetching, and extended commands#18
Merged
Merged
Conversation
Resilience: - RetryTransport with circuit breaker for 429/5xx resilience - Exponential backoff with jitter, respects Retry-After headers - Circuit breaker auto-resets after 30s of successful requests Performance: - Concurrent gmail thread fetching (fixes N+1 query pattern) - Bounded concurrency with semaphore (max 10 parallel) New calendar commands: - colors: list available event/calendar colors - conflicts: check availability across calendars - search: find events by text query - time: show current time in multiple timezones New gmail commands: - autoforward: get/enable/disable auto-forwarding - delegates: list/add/remove mail delegation - filters: list/create/delete inbox filters - forwarding: manage forwarding addresses - sendas: manage send-as aliases - vacation: get/enable/disable vacation responder - batch: bulk operations (mark-read, archive, label, delete) - watch: Pub/Sub push with webhook forwarding New services: - Sheets: read/write/append spreadsheet data - Tasks: manage tasklists and tasks Developer experience: - Shell completion (bash, zsh, fish, powershell) - version command with build info - --debug flag for verbose logging - lefthook for pre-commit hooks Documentation: - Expanded README with examples - Gmail watch/Pub/Sub guide (docs/watch.md) - Architecture spec (docs/spec.md) - Release process (docs/RELEASING.md)
f6587f3 to
d2be673
Compare
Drive: - Add context propagation to all API calls - Add path traversal security fix in download Gmail: - Add context propagation to labels and thread commands - Simplify MIME building (remove unused ReplyTo, BodyHTML) - Add --from flag for send-as aliases in send and drafts - Simplify base64 decoding - Add path traversal security fix in attachments Calendar: - Add needsAction status support to respond command - Add --comment flag for response comments - Add organizer check to prevent self-response Auth: - Add browser-based account management command (auth manage) - Add web UI for managing connected accounts Maintenance: - Update golangci-lint config for v2 compatibility
List events from all calendars at once with merged, time-sorted output.
- Update Makefile to install golangci-lint v2.1.6 - Migrate .golangci.yml to v2 format - Add exclusions for common false positives - Remove unused helper functions
Collaborator
|
Thanks, that's a big one. I'll review. |
steipete
reviewed
Dec 26, 2025
Collaborator
steipete
left a comment
There was a problem hiding this comment.
Taking over from here.
High-level: majority looks salvageable. Branch builds + tests pass locally, and most changes are additive. Biggest risk is size + merge conflicts + CLI flag consistency.
Blocker
- PR currently not mergeable (conflicts). Merge attempt shows conflicts in: README.md, internal/cmd/auth.go, internal/cmd/calendar.go, internal/cmd/drive.go, internal/cmd/execute_auth_add_test.go (modify/delete), internal/cmd/gmail.go, internal/cmd/gmail_drafts.go, internal/cmd/gmail_send.go, internal/cmd/root.go, internal/cmd/version.go (add/add), internal/secrets/store.go.
Resilience/retry
- Potential body leak: internal/googleapi/transport.go:51-64 overwrites req.Body when req.GetBody != nil without closing the original body.
- Keep-alive friendliness: before resp.Body.Close() on retry paths, consider draining (io.Copy(io.Discard, resp.Body)) so the connection can be reused. (internal/googleapi/transport.go:99,123)
- Backoff footgun: internal/googleapi/transport.go:151 can panic if BaseDelay/2 == 0; clamp.
- Two retry stacks: internal/googleapi/retry.go exists but transport retry is already wired in internal/googleapi/client.go; please pick one approach + delete/unused.
- Logging: retry logs at Info (internal/googleapi/transport.go:94,119); likely Debug unless --debug.
Gmail/thread
- JSON shape: DownloadError field never set; current behavior returns on first download failure (internal/cmd/gmail_thread.go:44-85). Either populate per-attachment error and continue, or remove the field.
Watch server auth
- shared token compare uses plain string equality; low-risk but easy win: subtle.ConstantTimeCompare (internal/cmd/gmail_watch_server.go:352-358). Also consider header-only tokens; query param tokens tend to leak into logs.
Repo/tooling consistency
- .lefthook.yml runs gofmt + golangci-lint directly, while Makefile uses goimports+gofumpt and installs golangci-lint under .tools. Recommend single source of truth.
Suggested merge strategy (what I’m going to do next)
- Create an integration branch; merge PR branch into it; resolve conflicts there.
- Normalize CLI args/flags with current conventions (output/json/plain/debug/confirm/no-input/etc) so UX stays consistent.
- Fix the retry/transport issues above.
- Run full gate (fmt/lint/tests/docs).
- Add missing tests where it fits + add changelog/release note entry.
- Then merge the cleaned integration branch back to main.
steipete
reviewed
Dec 26, 2025
Collaborator
steipete
left a comment
There was a problem hiding this comment.
Thanks — big upgrade (retry/circuit breaker + expanded cmds).
I’m taking over from here.
Majority salvageable: yes. Needs follow-up polish to match gogcli conventions:
- flag unification (avoid collisions; keep output flags consistent)
- help text + args consistency across services
- more regression tests + CI gate
- changelog + README tweaks
I’ll do the cleanup on main in a focused follow-up PR/commits.
manascb1344
pushed a commit
to manascb1344/gogcli
that referenced
this pull request
Jan 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds resilience, performance improvements, and significant feature expansion to gogcli.
Resilience
Retry-AfterheadersPerformance
Multi-Account Management
auth add: authorize and store accounts via OAuth flowauth list: list all stored accountsauth remove: remove stored accountsauth manage: open accounts manager UI in browserauth tokens: manage refresh tokens (list, export, import, delete)auth credentials: store OAuth client credentialsNew Calendar Commands
events --all: list events from all calendars (merged, time-sorted)colors: list available event/calendar colorsconflicts: check availability across calendarssearch: find events by text querytime: show current time in multiple timezonesrespond: respond to calendar invites (accept/decline/tentative)freebusy: check free/busy status for calendarsNew Gmail Commands
get: get message by ID (full/metadata/raw format)attachment: download attachmentshistory: list mailbox history entrieswatch: Pub/Sub push with webhook forwardingautoforward: get/enable/disable auto-forwardingdelegates: list/add/remove mail delegationfilters: list/create/delete inbox filtersforwarding: manage forwarding addressessendas: manage send-as aliasesvacation: get/enable/disable vacation responderbatch: bulk operations (mark-read, archive, label, delete)New People Commands
me: get current authenticated user infocontacts: search contactsdirectory: search organization directoryNew Services
lists: list, create task listsitems: list, create, update, complete, delete tasksclear: remove completed tasksDeveloper Experience
versioncommand with build info--debugflag for verbose loggingTest Plan
-raceflag (thread-safe)