Skip to content

bug(calendar): events --page with several calendars sends one calendar's token to all of them #1281

Closed

Description

@privatenumber

Summary

With --cal/--calendars/--all, --page is passed to every selected calendar's events.list. A page token belongs to one calendar, so the others reject it. Each rejection is only a stderr line, and the command exits 0.

Current (v0.47.1)

gog calendar events --cal 1 --cal 2 --page <token from calendar 1>
# calendar <calendar 2 id>: googleapi: Error 400: Invalid page token value., invalid
# No events          (exit 0)

calendar_list.go#L168 calls loadPagedItems(page, …) with the same page for each calendar. The JSON output's nextPageTokens lists tokens per calendar, but there is no way to pass one back for its calendar.

Suggested

Either reject --page with more than one calendar (pointing to --all-pages), or accept per-calendar tokens, such as --page CALENDAR_ID=TOKEN (repeatable), matching nextPageTokens.

Environment

gog v0.47.1 (main at 82e7fd6). Reproduced against a local fake of the Calendar API through GOG_GOOGLE_API_BASE_URL.

Activity

  1. added
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    P2Normal priority bug or improvement with limited blast radius.
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.
    clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.
    impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.
    issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.
    no-staleExempts this issue from stale automation.
    and removed
    clawsweeper:intake:bugPreliminary submission classification; full source review pending.
    on Oct 31, 2026
  2. clawsweeper commented on Oct 31, 2026

    @clawsweeper
    Contributor

    Codex review: this still needs some work.

    Summary
    Keep open: current main forwards one page token to multiple calendars and suppresses their request errors, establishing a focused existing-behavior bug.

    Reproducibility: Current source proves that two selected calendars receive the same starting token and that request failures are swallowed by default; the reporter's fake-API reproduction was not rerun during this read-only review.

    Next step
    Add a resolved-calendar-count guard and establish a failing command regression showing that a token cannot be sent to multiple calendars.

    Review details

    Best possible solution:

    Reject nonempty --page/--cursor when more than one distinct calendar is resolved, with guidance to use --all-pages or select one calendar.

    Do we have a high-confidence way to reproduce the issue?

    Current source proves that two selected calendars receive the same starting token and that request failures are swallowed by default; the reporter's fake-API reproduction was not rerun during this read-only review.

    Is this the best way to solve the issue?

    The suggested rejection is the smallest complete repair because existing multi-calendar hints already recommend --all-pages; repeatable per-calendar token syntax would unnecessarily expand the command contract.

    AGENTS.md: found and applied where relevant.

    Codex review notes: model internal, reasoning medium; reviewed against 82e7fd6005d4.

    Label changes

    Label changes:

    • add P2: Manual multi-calendar continuation can return incomplete results with success, while single-calendar reads and token-free --all-pages provide bounded workarounds.
    • add impact:ux-friction: The command accepts an unusable flag combination and leaves callers to diagnose per-calendar API errors on stderr.
    • add issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.
    • add clawsweeper:source-repro: Current issue advisory state selects this label.
    • add clawsweeper:queueable-fix: Current issue advisory state selects this label.
    • add clawsweeper:fix-shape-clear: Current issue advisory state selects this label.

    Label justifications:

    • P2: Manual multi-calendar continuation can return incomplete results with success, while single-calendar reads and token-free --all-pages provide bounded workarounds.
    • impact:ux-friction: The command accepts an unusable flag combination and leaves callers to diagnose per-calendar API errors on stderr.
    Evidence reviewed

    Acceptance criteria:

    • Establish the multi-calendar token regression failing before the repair.
    • go test ./internal/cmd -run 'TestExecute_CalendarEvents|TestListAllCalendarsEvents' -count=1
    • Verify multi-calendar --page/--cursor returns a usage error before event requests for --cal, --calendars, and --all.
    • Verify single-calendar continuation and token-free per-calendar --all-pages still return complete results.
    • make ci

    What I checked:

    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge; those execution lanes are retired.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

    Reviewed October 30, 2026, 11:11 PM ET / October 31, 2026, 03:11 UTC.

  3. steipete commented on Nov 5, 2026

    @steipete
    Collaborator

    Fixed by #1301 in d358b6c. A multi-calendar page token now exits 2 before any event request; single-calendar continuation remains available. Reproduced before and verified after through the built CLI against a synthetic Calendar API. Regression tests, independent P0–P2 review, and final-head CI pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal priority bug or improvement with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.no-staleExempts this issue from stale automation.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions