Skip to content

fix(calendar): read further event pages up to --max in search and team - #1322

Closed
saariuslystoned wants to merge 3 commits into
openclaw:mainfrom
saariuslystoned:fix/calendar-search-team-paging
Closed

saariuslystoned wants to merge 3 commits into
openclaw:mainfrom
saariuslystoned:fix/calendar-search-team-paging

Conversation

@saariuslystoned

@saariuslystoned saariuslystoned commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

What problem this solves

calendar search and calendar team make one events.list call and drop nextPageToken. The events.list reference says a page can hold fewer events than maxResults, "or none at all, even if there are more events matching the query". Incomplete pages are marked by a non-empty nextPageToken. Matches past the first page are therefore silently missing:

  • calendar search neither pages nor shows the token in JSON or text output, so a short page looks like the complete result. calendar events, which uses the same API, surfaces nextPageToken.
  • calendar team reads one page per member calendar. Its client-side --query filter then runs on that page alone, so a member's matching event on page 2 never appears in the merged view.

Change

  • New helper listCalendarEventsUpTo reads events.list pages until it has --max events or the listing ends. It asks only for the events still needed and stops on a repeated page token.
  • calendar search uses it. When it stops at --max with more matches left, it prints a stderr hint, # More results: raise --max (currently N) …, in the style of the existing next-page hints.
  • calendar team uses it per member calendar. --max keeps its meaning of "max events per calendar".
  • Output fields are unchanged.

Evidence

Tests in internal/cmd/calendar_events_paging_test.go use an httptest events.list that returns event1 with nextPageToken: p2, then event2:

  • TestCalendarSearch_ReadsLaterPagesUpToMax (--json and --plain, --max 50): on main (e8428c3) only event1 is printed. With this change both appear, with no hint.

  • TestCalendarSearch_StopsAtMaxAndSaysMoreRemain (--max 1): one request, only event1, and the stderr hint.

  • TestCalendarTeamEvents_ReadsLaterPagesPerCalendar: on main the team view lists only event1. With this change it lists both.

  • The existing calendar search, team and events tests pass.

  • Built gog binaries from main and from this branch were run against a local Calendar stand-in through GOG_GOOGLE_API_BASE_URL. The stand-in is not Google: it returns event1 with nextPageToken: p2, then event2. The output below shows each binary's events.list requests:

    $ gog --json calendar search standup --max 50
    main:   GET events maxResults=50                        -> event1 only, stderr empty
    branch: GET events maxResults=50; GET events pageToken=p2 maxResults=49 -> event1, event2
    $ gog --json calendar search standup --max 1
    main:   -> event1, stderr empty
    branch: -> event1, stderr "# More results: raise --max (currently 1) to see more matching events"
    

Every make ci step passed on 3cdb086 (go1.27.3); the head dbf8b18 only adds this PR's number to the CHANGELOG entry. The Go test suite ran on a second macOS arm64 machine, and the fmt, lint, deadcode, docs, agent-skills and node checks ran locally.

☁️

🤖 Generated with Claude Code

saariuslystoned and others added 2 commits November 9, 2026 01:35
events.list may return fewer events than maxResults together with a nextPageToken. calendar search and calendar team read one page and dropped the token, so later matches were silently missing. Read pages until --max events are collected or the listing ends, and note on stderr when calendar search stops with more matches remaining.

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

clawsweeper Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

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

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 9, 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. 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 9, 2026
@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Read successive Calendar event pages up to the existing --max limit in search and team commands.

Example: calendar search standup --max 50 receives event1 and token p2, followed by event2.

  • Before: Only event1 appears.
  • After: Both events appear; --max 1 instead returns event1 with a stderr hint that more results remain.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, correct repair supported by supplied CLI request traces and targeted HTTP regressions; the updated evidence resolves the earlier proof blocker.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The updated body records built-CLI execution against a local Calendar stand-in through the existing API-base transport: a short first page triggers a real continuation request and both events appear, while --max 1 stops with the expected stderr hint. This exercises the shared production paging owner; the team HTTP regression separately covers its per-calendar integration. The evidence is synthetic HTTP execution, not live Google Calendar verification.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Search and team views silently omit events when Google returns an incomplete first page.
Reason: Following continuation tokens fulfills the existing bounded listing contract without adding options or changing team filtering semantics.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current Calendar pagination defect and remains necessary; the focused patch has no actionable correctness findings.

Priority: P2
Reviewed head: dbf8b18429567bdfaf98180923ea21eaf01779da

Before merge

None.

Findings

None.

Agent review details

How this fits together

Calendar search queries one calendar and team queries member calendars; API pages feed existing redaction, filtering, deduplication, and JSON or text output.

flowchart TD
 A[Calendar CLI commands] --> B[Calendar service client]
 B --> C[Bounded event paging]
 C --> D[Google Calendar API]
 D --> C
 C --> E[Filtering and redaction]
 E --> F[JSON or text output]
Loading

Technical review

Best possible solution:

Use the shared bounded paging helper while preserving existing limits, filtering, redaction, and output contracts.

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

Current-main source deterministically discards later pages after a short response with a continuation token, consistent with the supplied before/after CLI traces; no target code was run during this read-only review.

Is this the best way to solve the issue?

The focused helper fixes the shared pagination cause while retaining command-specific behavior; existing all-pages collectors would not preserve the total-event limit.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Search event loading keeps the original intent (d2be673: The original feature added text search with a maximum result count; its source and linked feature description establish no intentional first-page-only behavior.)
  • Team per-calendar loading keeps the original intent (f8b83e5: The feature added parallel calendar fetching, filtering, and deduplication; these behaviors remain intact.)
  • Search redaction and output keeps the original intent (5afc19f: Zoom support introduced output redaction; the changed path still redacts collected events before rendering and retains the existing JSON fields.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit eeb6791 adds internal/cmd/calendar_search.go:75 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: eeb6791a3f34; files: internal/cmd/calendar_search.go)
  • salmonumbrella: Raw commit f8b83e5 adds internal/cmd/calendar_team.go:231 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f8b83e560933; files: internal/cmd/calendar_team.go)

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.

Review metrics

Metric Value Why it matters
Patch scope Production +64/-23 lines; tests +113; changelog +2 One shared helper repairs both commands, with focused output and limit regressions.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • 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: 👀 ready for maintainer look.

Label justifications:

  • P2: Calendar search and team views can silently omit later-page events, with impact limited to these read commands.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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-09T07:04:49.886Z sha dbf8b18 :: needs real behavior proof before merge. :: none

Reviewed November 9, 2026, 11:33 AM ET / 16:33 UTC (Revision 2).

@saariuslystoned

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 9, 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. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. 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. labels Nov 9, 2026
@steipete

Copy link
Copy Markdown
Collaborator

Thank you for the fix. I reproduced the claim and consolidated reading short event pages until the requested Calendar search/team limit 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: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants