Skip to content

fix(contacts): cap contacts search at Google's 30-result limit - #1323

Closed
saariuslystoned wants to merge 2 commits into
openclaw:mainfrom
saariuslystoned:fix/contacts-search-page-cap
Closed

saariuslystoned wants to merge 2 commits into
openclaw:mainfrom
saariuslystoned:fix/contacts-search-page-cap

Conversation

@saariuslystoned

@saariuslystoned saariuslystoned commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

What problem this solves

people.searchContacts and otherContacts.search both document pageSize as "Values greater than 30 will be capped to 30". Neither returns a page token, so no request can get more than 30 results.

contacts search and contacts other search default to --max 50 and pass any --max through unchanged. By default, and for every --max above 30, they show at most 30 contacts with no sign the list was cut short. contacts export --query already enforces this cap (--max must be between 1 and 30).

Change

  • Both commands default to --max 30, and their help says Google returns at most 30.
  • A --max above 30 is clamped to 30 with a stderr note: # Google returns at most 30 contact search results; showing up to 30 of the requested N. Scripts that pass a larger value keep working and see why fewer results came back.
  • Requests and output are otherwise unchanged. The command docs are regenerated.

If you'd rather reject a value above 30 with a usage error, as contacts export does, that's a one-line change.

Evidence

TestContactsSearch_RespectsThe30ResultCap runs both commands through the CLI against an httptest People server that, like the API, returns at most 30 results. It checks the pageSize sent and stderr for the default and for --max 50.

  • On main (e8428c3), all four cases send pageSize=50.
  • With this change, every case sends 30. The note appears only for --max 50.

The existing contacts tests pass. - Built gog binaries from main and from this branch were run against a local People stand-in through GOG_GOOGLE_API_BASE_URL. The stand-in is not Google: like the API, it returns at most 30 results.

$ gog --json contacts search ada                 main: pageSize=50, 30 results, stderr empty   branch: pageSize=30, 30 results, stderr empty
$ gog --json contacts search ada --max 50        main: pageSize=50, 30 results, stderr empty   branch: pageSize=30, 30 results, stderr "# Google returns at most 30 contact search results; showing up to 30 of the requested 50"
$ gog --json contacts other search ada [--max 50]  same as above

Stdout stays the same JSON either way.

Every make ci step passed on 0c94ae0 (go1.27.3); the head 8869299 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

people.searchContacts and otherContacts.search cap pageSize at 30 and return no page token. contacts search and contacts other search defaulted to --max 50 and silently showed at most 30. Default to 30 and note on stderr when a larger --max is clamped.

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. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. 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: ready, awaiting a maintainer decision.

What this changes

Both contact search commands default to 30 results and explain on stderr when a larger requested limit is capped.

Example: Run gog --json contacts search ada --max 50.

  • Before: Requests 50, receives at most 30, and gives no explanation.
  • After: Requests 30 and explains the cap on stderr while preserving JSON stdout.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused implementation has adequate shipped-CLI evidence and no concrete correctness finding; the remaining owner decision limits overall readiness.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The updated body exercises built CLI binaries and both production search handlers against a local HTTP People stand-in, recording default and --max 50 request limits, the new stderr explanation, and unchanged JSON stdout; this resolves the previous proof request without requiring a live account for the local formatting behavior.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: Search help promises a default limit of 50 while Google can return only 30, leaving larger-limit callers without an explanation.
Reason: The clarification has clear value, but changing established defaults and stderr behavior requires an owner decision under the review policy.

Merge readiness

⏳ Ready, awaiting maintainer decision

Keep open: current main still advertises an unattainable search limit, and this focused patch needs an owner decision on its changed default and stderr behavior.

Priority: P3
Reviewed head: 88692999f515710741002166eb4adc53e56a5ca2
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should both search commands default to 30 and warn while continuing when --max exceeds 30?
  • Recommendation: Approve the proposed clamp: Keep larger-limit scripts working and explain Google's fixed ceiling on stderr.
  • Why: This changes owner-built defaults and output, while export uses rejection; no recorded owner approval settles the intended CLI policy.

Before merge

None.

Findings

None.

Agent review details

How this fits together

The contacts CLI handlers turn queries and limits into People API searches, then format returned contacts as JSON or tables.

flowchart LR
 CLI[CLI query and max] --> Handler[Contact search handlers]
 Handler --> Limit[Shared limit helper]
 Limit --> API[People API search]
 Limit --> Stderr[Stderr explanation]
 API --> Output[JSON or table stdout]
Loading

Technical review

Best possible solution:

Approve the backward-compatible clamp and explanation in the existing search handlers.

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

Current-main source requests 50 by default despite both API contracts capping results at 30; the contributor also supplies matching before-and-after CLI output.

Is this the best way to solve the issue?

The shared helper is a small complete fix that preserves successful existing calls; strict rejection would unnecessarily break oversized-limit callers unless the owner chooses it.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Contact search defaults and request limits changes intended behavior with a stated reason (4252ad5: The Kong migration carried forward existing defaults and direct PageSize forwarding; the PR explains the replacement using Google's documented ceiling.)
  • Generated command documentation keeps the original intent (8b8fd09: Generated command pages expose CLI defaults and help; updating their rows preserves that purpose.)
  • Unreleased changelog keeps the original intent (e8428c3: The development-cycle commit opened the Unreleased section, where this PR records its user-visible change and contributor credit.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Current-main behavior remains unchanged: Both main handlers default to 50 and pass c.Max directly to PageSize; GitHub confirms main remains at the pinned base. (internal/cmd/contacts.go:31, e8428c36dd31)
  • Small shared implementation: The introduced diff changes both existing handlers to use one limit helper, updates their help and command pages, and adds an Unreleased changelog entry with contributor thanks. (internal/cmd/contacts.go:276, 88692999f515)
  • Existing API-limit precedent: Contact export already documents a 30-result search limit and rejects --max outside 1–30; the search commands instead preserve successful larger-limit callers. (internal/cmd/contacts_export.go:102, 88692999f515)
  • Authoritative API contract: Both people.searchContacts and otherContacts.search document that pageSize values above 30 are capped to 30.
  • Updated shipped-CLI evidence: The complete current PR body reports built main and branch binaries using GOG_GOOGLE_API_BASE_URL against a local People stand-in: both commands send 30 after the fix, explicit --max 50 adds the explanation, and JSON stdout stays unchanged. (88692999f515)
  • Feature history and provenance: The Kong migration retained the earlier 50-result default, subsequent alias work preserved it, and later main changes maintained validation, cache warmup, and service injection; no specific reason for 50 was found. Historical blob access reached the documented local missing-object boundary. (internal/cmd/contacts.go:31, 4252ad53f480)

Likely related people:

  • Peter Steinberger: Raw commit 365c4aa adds internal/cmd/contacts.go:45 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 365c4aa2b27b; files: internal/cmd/contacts.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 size Production +19/-4; tests +77; docs and changelog +4/-2 The production change is focused, and the tests cover defaults and explicit oversized limits through both command handlers.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit 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: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: ⏳ waiting on maintainer.

Label justifications:

  • P3: This improves limit discoverability and diagnostics without changing Google's effective result ceiling.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit 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.

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:05:01.715Z sha 8869299 :: 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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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. labels Nov 9, 2026
@steipete

Copy link
Copy Markdown
Collaborator

Thank you for the fix. I reproduced the claim and consolidated applying and documenting Google’s effective 30-result Contacts search ceiling 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

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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