Repository navigation
fix(ios): restart Files pagination when the folder drifts under the cursor - #193660
Conversation
…ursor The workspace Files list used the deduplicated local row count as the next server offset. A file inserted before the cursor turns the final page into an overlap whose rows dedupe away, so the offset and the Load More button stall forever (openclaw#193500). Track server pagination progress in WorkspaceListPagination instead. When a consumed page reaches the reported end while local rows are still short, reload the directory once so the inserted rows appear.
|
🦞👀 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: needs maintainer review before merge. What this changesTrack consumed server rows separately from displayed files and reload the directory when pagination detects inserted or deleted files. Example: Load 250 of 251 files, create A new note.md before the pagination cursor, then tap Load More.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current iOS Files pagination defect and has maintainer-reported end-to-end validation; no introduced bug was found, but CI remains blocked. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe native iOS Files screen requests sorted directory pages through agents.workspace.list and renders deduplicated workspace entries. flowchart LR
A[Workspace directory] --> B[Gateway sorted offset pages]
B --> C[iOS Files screen]
C --> D[Pagination progress]
D --> E[Append unique entries]
D --> F[Reload on detected drift]
F --> B
Technical reviewBest possible solution: Retain the focused client pagination repair and land it once the existing CI gates are satisfied. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the overlapping-page failure, and obviyus independently reports reproducing insertion and deletion failures through the native app and a real Gateway; this review executed no target code. Is this the best way to solve the issue? The smallest complete fix keeps pagination progress separate from deduplicated rows in the existing screen and reuses reload for detected drift, without adding a server protocol or competing owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against cf376b0d000a. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +63, Tests +102. Total +165 across 2 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)Reviewed November 8, 2026, 5:04 AM ET / 10:04 UTC (Revision 4). |
…e test The SwiftFormat (lint) build phase (pinned 0.63.1) failed the iOS test build: wrap the braces of multiline statements and prefer comma over && in the drift condition. Remove the repeated stalled-page test; the repaired view reloads at the first drift, so the retry path has no user-visible behavior to cover.
|
@clawsweeper findings addressed in 743b206, and the open CI-attribution question in this review is now resolved: CI root cause (previously unresolved): the iOS job failures on Low-value test: removed the Native proof (the remaining blocker): this machine has only the Command Line Tools (no full Xcode — verified via |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
I checked the reported conflict against main The combined order immediately after updating self.totalEntries = result.totalentries
self.errorText = nil
if self.pagination.consume(
requestOffset: requestOffset,
fetchedCount: result.entries.count,
totalEntries: result.totalentries,
localRowCount: self.entries.count) == .driftDetected
{
await self.reload()
}Clearing the old error before This is a source-level resolution, not a new native qualification. After integrating main on your existing branch, the relevant checks are the insertion recovery already exercised here and failed Load More → successful retry, to protect both repairs together. The earlier native evidence is an independent contributor run of the pre-integration tree. |
…ion-drift # Conflicts: # apps/ios/Sources/Design/AgentWorkspaceFilesScreen.swift
|
Integrated Merge commit: Verification run locally: On the two behaviors to protect together: the failed-Load-More → successful-retry case is covered by the One process note: the ClawSweeper re-review of the pre-merge head @clawsweeper re-review of the post-merge head |
|
🦞👀 Re-review progress:
|
|
Maintainer end-to-end check, and a small follow-up commit. Setup: an iPhone 17 simulator on iOS 27 using the real UI, paired to a real Gateway running current
Follow-up ( Known limit: if a deletion and an insertion happen between the same two pages, the total doesn't change, so this check can't see it. Pull to refresh recovers. I also merged current Tests:
Thanks @ccclucky for the fix and the clear write-up! |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…ursor (openclaw#193660) * fix(ios): restart Files pagination when the folder drifts under the cursor The workspace Files list used the deduplicated local row count as the next server offset. A file inserted before the cursor turns the final page into an overlap whose rows dedupe away, so the offset and the Load More button stall forever (openclaw#193500). Track server pagination progress in WorkspaceListPagination instead. When a consumed page reaches the reported end while local rows are still short, reload the directory once so the inserted rows appear. * style(ios): satisfy pinned swiftformat and drop redundant stalled-page test The SwiftFormat (lint) build phase (pinned 0.63.1) failed the iOS test build: wrap the braces of multiline statements and prefer comma over && in the drift condition. Remove the repeated stalled-page test; the repaired view reloads at the first drift, so the retry path has no user-visible behavior to cover. * fix(ios): reload Files listing when a deletion shifts rows under the cursor --------- Co-authored-by: Ayaan Zaidi <[email protected]>







Closes #193500
What Problem This Solves
Fixes: the iOS Files "Load More" button keeps requesting the same final page without ever completing, when a file is created in the workspace between page loads.
User Impact
User impact: files that land before the current pagination position now show up — one reload recovers the listing, and Load More finishes or disappears instead of looping on a page that contains only already-listed entries.
Why This Change Was Made
AgentWorkspaceDirectoryList.loadMoreused the deduplicated local row count (entries.count) as the next server offset. A file inserted before the cursor makes the following page overlap the local list; its rows dedupe away, the local count stops growing, andentries.count < totalEntriesstays true, so every tap re-requests the same final entry.The fix tracks server-side pagination progress separately in
WorkspaceListPagination. When a consumed page reaches the reported end of the directory while local rows are still short, the view reloads the folder once so the inserted rows appear. Failed pages keep the cursor unchanged, so retry after a failed page still works, and.refreshable/.task(id:)already reset the cursor throughreload().Evidence
Root cause verified against current
mainsource: the offset request atapps/ios/Sources/Design/AgentWorkspaceFilesScreen.swift:180(offsetentries.count, deduplicated append, button condition at line 71) matches the issue report.The pagination state machine is a standalone type; its logic was compiled and executed against the issue's exact scenario (251-entry folder, insertion before the cursor, offset 250 returning
Note 250.md+Note 251.md, then repeated offset-251 requests) plus static-folder completion and reload-recovery cases — all pass:Regression tests added in
apps/ios/Tests/AgentWorkspaceFilesPaginationTests.swift: static folder completion, insertion-before-cursor drift, and reload recovery.swiftc -parsepasses on both changed files.CI note: the first CI run failed the iOS
SwiftFormat (lint)build phase becauseAgentWorkspaceFilesScreen.swiftviolated the pinned swiftformat 0.63.1 rules (wrapMultilineStatementBraces×2,andOperator); fixed in743b206a814by running the pinned binary with this repo's config, verified lint-green locally, and the redundant stalled-page test flagged by review was removed.Native behavior proof (independent contributor run by @ellibbe, comment): on iPhone 17 Simulator / iOS 27.0 (Xcode 27.2, Light mode), a loopback WebSocket fixture serves a real synthetic 251-file directory and inserts
A new note.mdafter the first response, exercising the realAgentWorkspaceDirectoryList.loadMoreand its automatic reload. Basea54bdb3c608ffails the automatic-reload assertion (stuck at 251 of 252, RPC offsets[0, 250]); this head passes — the inserted file appears and Load More disappears after completion (offsets[0, 250, 0, 250]; the final passing run also scrolled to the visible end and confirmed Load More is absent). This covers the native behavior proof requested in review; no snapshot-lane expansion is needed for this contribution. Scope caveats from that run: the fixture does not execute the complete Gateway handler, and the app-hosted unit runner compiled but did not start (bounded retry after a simulator restart timed out), so no iOS-hosted unit-test pass is claimed. The run qualified the pre-integration tree (743b206a814); it is an independent contributor run, not a maintainer qualification.Integration with
main: mergedmain@6b959f4ca63in43003185d63, resolving theloadMoreconflict with fix(ios): clear stale folder errors after Load More succeeds #193504 so its stale-error clearing (errorText = nil) runs beforeconsume/reload— a failed reload keeps its own new error visible. Verified locally: pinned swiftformat 0.63.1 lint 0/1,swiftc -parseclean, standaloneWorkspaceListPaginationassertions ALL PASS; the failed-Load-More → successful-retry path is covered by theAgentWorkspacePaginationUITestsfixture fix(ios): clear stale folder errors after Load More succeeds #193504 adds, now on this branch via the merge for CI.Validation boundary: this machine has only the Command Line Tools (no full Xcode), so the SwiftUI target build and the XCTest run are left to CI; the standalone logic run above covers the state machine itself. The new Swift test file is not counted by the test-lines ratchet (it tracks
*.test.ts/mts/jspatterns only), so no allocation is needed.