Skip to content

fix(calendar): report freebusy calendars Google could not read - #1311

Closed
saariuslystoned wants to merge 3 commits into
openclaw:mainfrom
saariuslystoned:fix/calendar-freebusy-errors
Closed

saariuslystoned wants to merge 3 commits into
openclaw:mainfrom
saariuslystoned:fix/calendar-freebusy-errors

Conversation

@saariuslystoned

@saariuslystoned saariuslystoned commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

What problem this solves

freeBusy.query reports a calendar it could not compute as calendars.<id>.errors[] with an empty busy list. The Calendar reference documents the reasons as notFound, tooManyCalendarsRequested, groupTooBig and internalError, and says "clients should gracefully handle additional error statuses". The text and --plain views of gog calendar freebusy read only busy. A calendar you cannot see therefore prints no rows and no message, and the command exits 0, which is the same output as a calendar that is free for the whole window.

$ gog --plain calendar freebusy a@example.com,c@example.com,b@example.com --from ... --to ...
CALENDAR        START                   END
b@example.com   2026-11-10T19:00:00Z    2026-11-10T20:00:00Z
a@example.com   2026-11-10T17:00:00Z    2026-11-10T18:00:00Z

Here c@example.com came back notFound, so a script or agent that checks for busy rows sees it as free. calendar team already reports error: <reason> per member for the same response, and --json keeps errors because it prints the response as-is.

The rows also came from ranging over the response map, so with several calendars the --plain row order changed from run to run, which works against the documented stable TSV.

Change

  • For each calendar that has errors, write one stderr line with the reason and a next step: Warning: no free/busy data for c@example.com (notFound); its busy times are unknown, not free. Check the calendar ID and that the calendar is shared with this account. For tooManyCalendarsRequested and groupTooBig the next step is to query fewer calendars. For other reasons it is to retry before relying on the calendar's availability. Stdout keeps its three columns, so existing parsers are unaffected. Exit status is unchanged. Making a partial failure non-zero would be a stronger signal, but it would change what scripts see when one of many calendars is private, so I left that for you to decide.
  • Rows are listed in the requested calendar order, and calendars the response adds beyond the request are sorted by ID. A calendar's own busy periods keep Google's order.
  • JSON output is unchanged.

Evidence

  • internal/cmd/calendar_freebusy_errors_test.go drives CalendarFreeBusyCmd against an httptest freeBusy response with one notFound calendar:

    • the stderr warning
    • --plain rows in the requested order, checked over 20 runs
    • JSON keeping errors

    The warning and order tests fail on main (e8428c3). The order failure was b@example.com before a@example.com for a request of a,c,b. Both pass with this change. calendarFreeBusyRows takes the requested order, and its existing presentation test passes nil.

  • A built bin/gog from main and from this branch was run three times each against a local stand-in through GOG_GOOGLE_API_BASE_URL, with an empty GOG_HOME and the file keyring. The stand-in is not Google. It returns c@example.com with errors: [{reason: notFound}] and lists calendars in reverse order. main printed b before a with empty stderr on every run. This branch printed a, then b, plus the warning for c.

  • Transcript of the built-CLI runs. This is a local stand-in served through GOG_GOOGLE_API_BASE_URL, not Google. It answers freeBusy.query with c@example.com set to errors: [{reason: notFound}] and busy: [], and lists calendars in reverse order. Each binary ran three times with the same output every run; one run of each is shown:

    $ gog --account probe@example.com --plain calendar freebusy a@example.com,c@example.com,b@example.com --from 2026-11-10T16:00:00Z --to 2026-11-10T22:00:00Z
    
    # main (e8428c3)
    -- stdout:
    CALENDAR	START	END
    b@example.com	2026-11-10T19:00:00Z	2026-11-10T20:00:00Z
    a@example.com	2026-11-10T17:00:00Z	2026-11-10T18:00:00Z
    -- stderr:
    exit=0
    
    # this branch
    -- stdout:
    CALENDAR	START	END
    a@example.com	2026-11-10T17:00:00Z	2026-11-10T18:00:00Z
    b@example.com	2026-11-10T19:00:00Z	2026-11-10T20:00:00Z
    -- stderr:
    Warning: no free/busy data for c@example.com (notFound); its busy times are unknown, not free. Check the calendar ID and that the calendar is shared with this account.
    exit=0
    
    # stand-in request log (each run)
    POST /calendar/v3/freeBusy items=['a@example.com', 'c@example.com', 'b@example.com']
    
  • make ci passed locally on 268dbaf (macOS arm64, go1.27.3).

Boundary: the response shape comes from the freeBusy reference. No live Google Calendar was queried, so this does not show which reason Google returns for a particular unshared calendar.

🤖 Generated with Claude Code

freeBusy.query returns errors[] and no busy periods for a calendar it
could not compute, such as one the caller cannot see (notFound). The
text and --plain views read only busy, so such a calendar printed
nothing and looked free. Warn on stderr for each calendar with errors,
as calendar team already reports them, and list rows in the requested
calendar order instead of map order. Stdout columns, exit status and
JSON output are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clawsweeper

clawsweeper Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 8, 2026
@clawsweeper

clawsweeper Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

The PR warns about per-calendar free/busy errors and prints successful calendar rows in requested order.

Example: Query a@example.com,c@example.com,b@example.com when c@example.com returns notFound.

  • Before: Successful rows appear in map order, with no indication that c@example.com's availability is unknown.
  • After: Rows follow the requested order, and stderr names c@example.com's error and suggests checking its ID and sharing.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused, useful, and demonstrated through the shipped CLI; one helper-only test adds limited value, and hosted validation awaits approval.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The supplied terminal transcript exercises built gog through its existing Google API transport override on macOS arm64, showing a mixed successful/notFound response, requested row order, actionable stderr warning, and exit 0; it establishes CLI handling rather than live Google sharing behavior.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An unreadable calendar looks indistinguishable from an entirely free calendar in text output.
Reason: Surfacing returned errors and stabilizing TSV order restores useful availability reporting without adding configuration or changing the command's data contract.

Merge readiness

⛔ Blocked before merge - 1 item remains

This PR fixes a current-main availability-reporting bug; the earlier warning finding is resolved, and no correctness blocker remains.

Priority: P2
Reviewed head: 268dbaf9eaa7789ddb9ecb14582c2da1450bacc6

Before merge

  • Await maintainer action - Approve the action_required CI, CodeQL, and Docker workflow runs for the reviewed head so their checks can execute.

Findings

None.

Tests

  • Low-value test internal/cmd/calendar_freebusy_errors_test.go: TestCalendarFreeBusyErrorHint directly tests a helper and pins message fragments; remove it or move its distinct reason cases into the existing command-level warning test.
Agent review details

How this fits together

The Calendar CLI sends selected calendar IDs and a time window through the Google API client, then renders response calendars as JSON or a text table.

flowchart LR
A[Calendar CLI arguments] --> B[Calendar selection and time range]
B --> C[Google freeBusy query]
C --> D[Response calendars]
D --> E[Unchanged JSON output]
D --> F[Ordered busy rows]
D --> G[Error warnings on stderr]
Loading

Technical review

Best possible solution:

Land the focused warning and ordering fix after the existing workflow approval gate is cleared and checks pass.

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

Current-main source deterministically discards per-calendar errors; the contributor's before/after CLI transcript independently demonstrates the mixed-success response scenario.

Is this the best way to solve the issue?

The change repairs presentation in the existing command and renderer while preserving machine-readable columns, JSON, and exit semantics.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Free/busy table rendering keeps the original intent (47f1540: The commit introduced typed list presentation and retained the preceding busy-only map traversal; it did not explain silence on calendar errors.)
  • Unreleased changelog keeps the original intent (chore(release): open 0.48.1 development cycle #1307: The release follow-up opened the 0.48.1 development section while preserving published notes.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: ⏳ waiting on maintainer.

Label justifications:

  • P2: Silently omitted calendar failures can mislead availability decisions, with impact limited to affected text and plain-output queries.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Replace the helper-only hint assertions with command-level cases for the distinct recovery actions.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-08T13:17:59.103Z sha 21a6caa :: needs real behavior proof before merge. :: [P3] Add a recovery action to the availability warning

Reviewed November 8, 2026, 8:39 AM ET / 13:39 UTC (Revision 2).

The warning for a calendar Google could not read now ends with a next
step for the documented reasons: check the calendar ID and sharing for
notFound, query fewer calendars for tooManyCalendarsRequested and
groupTooBig, and otherwise retry before relying on its availability.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@saariuslystoned

Copy link
Copy Markdown
Contributor Author

Thanks for the review.

  • Proof: the body now has the built-CLI transcript for main and this branch: the invocation, the mixed success and notFound response from the local stand-in, ordered stdout, the stderr warning, exit status and the stand-in's request log. The stand-in is not Google, and no live calendar was queried.
  • Next step in the warning (P3): pushed 268dbaf. A notFound warning now ends with "Check the calendar ID and that the calendar is shared with this account." tooManyCalendarsRequested and groupTooBig suggest querying fewer calendars, and other reasons suggest retrying before relying on the calendar's availability. The returned reason stays in the message. A unit test covers each hint, and make ci passes locally.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 8, 2026
steipete added a commit that referenced this pull request Nov 14, 2026
Consolidate reproduced command bugs from #1308, #1311-#1319, #1321-#1326 and issues #1328, #1329, #1330, #1331, #1335.

Co-authored-by: Bobby Bones <159389674+saariuslystoned@users.noreply.github.com>
Co-authored-by: Sebastien Tardif <sebtardif@ncf.ca>
@steipete

Copy link
Copy Markdown
Collaborator

Thank you for the fix. I reproduced the claim and consolidated warning about inaccessible free/busy calendars while keeping table columns stable into #1336, with regression coverage and your coauthor credit retained. The full make ci gate, built-CLI checks for the new request-validation fixes, and exact-head GitHub CI passed. Closing this PR as superseded by the merged implementation in #1336.

@steipete steipete closed this Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants