fix(backup): reject repeated Drive backup page tokens - #1078
Conversation
Drive backup shared-drive and file listing copied nextPageToken without a seen-set. A repeated Google continuation token kept fetchBackupSharedDrives and fetchBackupDriveFiles requesting the same page. Route both helpers through collectAllPages so a repeated token fails with pagination loop instead of hanging gog backup push. Signed-off-by: Sebastien Tardif <SebTardif@ncf.ca>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 5, 2026, 12:38 AM ET / 04:38 UTC. ClawSweeper reviewWhat this changesRoute Drive backup’s shared-drive and file listings through the existing pagination guard, with regression tests for repeated tokens and successful multi-page results. Merge readiness⛔ Blocked before merge - 3 items remain This remains a distinct, source-proven gap on main and v0.39.0; the linked merged fixes cover other listing paths. The supplied fault-injection evidence supports the repair. Priority: P2 Review scores
Verification
How this fits togetherDrive backup collects shared-drive and file metadata before building encrypted backup shards. Listing errors stop snapshot collection before the final backup snapshot is published. flowchart TD
A[Backup push command] --> B[Drive backup collector]
B --> C[Google Drive HTTP listings]
C --> D[Shared pagination guard]
D -->|Complete listing| E[Build encrypted backup shards]
D -->|Repeated token or page limit| F[Return collection error]
E --> G[Publish completed snapshot]
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep the shared guard, document its Drive listing ceiling, and preserve the strict snapshot-error contract with focused compatibility coverage. Do we have a high-confidence way to reproduce the issue? Yes: current main repeatedly requests the same page when either Drive endpoint returns a repeated nonempty token. The contributor supplies a bounded before/after HTTP reproduction; this read-only review did not execute it. Is this the best way to solve the issue? Yes: reusing the established collector is a narrow repair that preserves normal request and result behavior. Its additional page ceiling needs explicit Drive documentation and compatibility coverage. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 25703c789da5. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Consolidate the repeated-token fixes from openclaw#1078 through openclaw#1087 using a shared cycle guard. Preserve unlimited distinct-page scans, early matches, and previously fetched ACL/member rows on ordinary API errors. Add generated-client regression coverage, stock-binary HTTPS fault proof, and credited release notes. Co-authored-by: Sebastien Tardif <SebTardif@ncf.ca>
Consolidate the pagination repairs from #1078–#1087 using a shared cycle guard. Preserve existing scan limits, early matches, and fetched ACL/member rows on ordinary API errors while rejecting cyclic collections safely. Validated with the full local gate and 33 stock-CLI HTTPS fault-injection cases, including encrypted backup readback and unchanged existing snapshots on fatal collection errors. Co-authored-by: Sebastien Tardif <SebTardif@ncf.ca>
|
Superseded by #1087, which incorporates the Drive backup pagination repair while preserving unlimited distinct-page scans. Stock-CLI proof verifies termination and unchanged existing backup state on failure. Thanks @SebTardif. Superseded by #1087, which incorporates Groups, Admin, and Keep cycle protection and preserves fetched membership rows on ordinary later-page API failures. Thanks @SebTardif. The separate Cloud Identity query issue #1059 remains open. Superseded by #1087, which incorporates Drive collaboration cycle protection without adding a new page ceiling. Encrypted per-file error records and continued collection were verified. Thanks @SebTardif. |
What Problem This Solves
gog backup pushwith Drive lists shared drives (Drives.List) and files (Files.List) by walking Google page tokens. Both helpers ininternal/cmd/backup_drive.gocopiednextPageTokeninto the next request with no seen-set.When Drive repeats a continuation token, those loops never terminate. Backup collection keeps requesting the same page and never finishes a Drive snapshot.
The same hang class is already closed for Chat and Classroom backup (#1063), Drive sync push listing (#1065), Drive audit permission listing (#1066), calendar and Gmail listing (#1004), and People/Gmail-from-contact/contacts-export listing (#1044, #1045, #1046). Drive backup listing was still on the unguarded loop.
Evidence
terminal output from the compiled
internal/cmdlisting binary after the patch. A stuck continuation token is rejected after two list calls, with no third request:Before the patch, the same stuck token made a third list request and returned HTTP 400 from the safety cap (
unexpected extra ... page request after 3 list calls) instead of stopping on the repeated token.Real behavior proof
gog backup pushwith Drive never finished those listings.fix/backup-paging-seen-tokenat current HEAD, compiledinternal/cmdlisting binary.go, then rangogcli-backup-paging.exewith-test.von the shared-drive and file hang-guard cases.pagination loop: repeated page token "stuck"after 2 list calls for bothfetchBackupSharedDrivesandfetchBackupDriveFiles.driveFilesListCallWithDriveSupport(corpora=allDrives).--best-efforthandling after the listing error.Summary
Route
fetchBackupSharedDrivesandfetchBackupDriveFilesthrough existingcollectAllPages. Keep the original field lists, page sizes, query, order, shared-drive flags, and shared-drive sort.Related: #1063, #1065, #1066, #1004, #1044, #1045, #1046.
Introduced in
068ff0e5(2026-04-27,feat(backup): expand workspace backup coverage).