Skip to content

bug(calendar): freebusy and conflicts send a calendar name containing @ as a raw ID unless another selector needs a lookup #1329

Closed

Description

@privatenumber

Summary

In calendar freebusy and calendar conflicts, a calendar name that contains @ (such as Work @ Home) is sent to the API as a literal calendar ID when every selector is primary or contains @. When any other selector needs a calendar-list lookup, the same name resolves to its calendar. So the meaning of one selector depends on the others, and conflicts can report no conflicts for a calendar it never read.

Current (v0.48.0, also main at e8428c3)

Calendar list: me@example.com (primary), Work @ Home (work@group.calendar.google.com), Team (team@group.calendar.google.com). Each has an event from 10:00 to 11:00 on 2027-01-01.

gog calendar freebusy --cal 'Work @ Home' --from 2027-01-01T00:00:00Z --to 2027-01-02T00:00:00Z --json
# request items: [{"id":"Work @ Home"}]
# "Work @ Home": {"errors":[{"domain":"global","reason":"notFound"}]}   (exit 0)

gog calendar freebusy --cal 'Work @ Home' --cal Team --from 2027-01-01T00:00:00Z --to 2027-01-02T00:00:00Z --json
# request items: [{"id":"work@group.calendar.google.com"},{"id":"team@group.calendar.google.com"}]

gog calendar conflicts --cal 'Work @ Home' --cal Team --from 2027-01-01T00:00:00Z --to 2027-01-02T00:00:00Z
# CONFLICTS FOUND: 1

gog calendar conflicts --cal 'Work @ Home' --cal primary --from 2027-01-01T00:00:00Z --to 2027-01-02T00:00:00Z
# No conflicts found   (exit 0; request items: [{"id":"Work @ Home"},{"id":"primary"}])
  • resolveSelectedCalendarIDs skips the lookup when every input is primary or contains @ (calendar_util.go#L110-L128). Both freebusy and conflicts use it.
  • resolveCalendarInputs checks calendar names and IDs before it passes an input with @ through as an ID (name_resolution.go#L173-L210). calendar events --cal 'Work @ Home' goes through it and resolves the name.

Expected

A selector resolves the same way in every combination. For freebusy and conflicts, that would be the events order: a calendar-list name or ID first, then an input with @ as a raw ID.

One possible approach, not a requirement: let the fast path skip the lookup only for primary and inputs that parse as an email address.

Related

--cal primary --cal me@example.com (the primary calendar's own address) selects one calendar under two IDs, because appendUniqueCalendarID compares ID strings (name_resolution.go#L298). calendar events then lists each event twice, under primary and me@example.com, and --page is rejected as a multi-calendar request. This may be intended; it is listed here because it is the same selection path.

Environment

gog built from main at e8428c3. 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:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.
    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 Nov 11, 2026
  2. clawsweeper commented on Nov 11, 2026

    @clawsweeper
    Contributor

    Codex review: this still needs some work.

    Summary
    This issue establishes a current selector-resolution bug that can hide calendar conflicts; the related open PR does not fix it.

    Reproducibility: Current source proves that Work @ Home bypasses lookup alone or with primary but resolves with Team; the reporter supplies a synthetic API reproduction, and this read-only review ran no tests.

    Next step
    Fix the @ fast path and first establish failing regressions showing Work @ Home resolves to the same ID alone, with primary, and with Team.

    Review details

    Best possible solution:

    Make non-address calendar names containing @ enter normal name resolution in both commands, with command-level regression coverage.

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

    Current source proves that Work @ Home bypasses lookup alone or with primary but resolves with Team; the reporter supplies a synthetic API reproduction, and this read-only review ran no tests.

    Is this the best way to solve the issue?

    Narrowing the fast-path ID classification addresses the demonstrated defect without new options; preserve legitimate raw IDs and establish failing command-level regressions before opening a repair PR.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • The repair must preserve literal email and group-calendar IDs, alias preparation, and existing lookup-error behavior.

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

    Label changes

    Label changes:

    • add P2: A bounded Calendar selector bug produces incorrect availability results for names containing @, with literal calendar IDs available as a workaround.
    • add impact:other: Conflict detection can report no overlap after querying the wrong calendar identifier.
    • 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: A bounded Calendar selector bug produces incorrect availability results for names containing @, with literal calendar IDs available as a workaround.
    • impact:other: Conflict detection can report no overlap after querying the wrong calendar identifier.
    Evidence reviewed

    Acceptance criteria:

    • go test ./internal/cmd -run 'TestCalendar(FreeBusy|Conflicts)Cmd_'
    • go test ./internal/cmd
    • make ci
    • Confirm new regressions fail before the fix and pass afterward, including resolved request IDs and the expected conflict.

    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 November 11, 2026, 9:17 AM ET / 14:17 UTC.

  3. steipete commented on Nov 14, 2026

    @steipete
    Collaborator

    Fixed in #1336. Calendar names such as Work @ Home now resolve through the calendar list; only actual email-form selectors take the raw-ID fast path.

    The regression failed against the previous main and passes with the fix. Full make ci, independent P0–P2 review, and exact-head GitHub CI passed. A built CLI also verified the outgoing request against a synthetic HTTP endpoint.

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:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.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