Skip to content

fix(mount): fall back when GitHub tree cursor stalls - #512

Merged
khaliqgant merged 1 commit into
mainfrom
fix/github-snapshot-cursor-stall
Sep 19, 2026
Merged

khaliqgant merged 1 commit into
mainfrom
fix/github-snapshot-cursor-stall

Conversation

@khaliqgant

@khaliqgant khaliqgant commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Reject a non-advancing or cyclic cursor in the GitHub working-tree verification snapshot.
  • Reuse the existing typed malformed-pagination error instead of spinning until the reconcile deadline.
  • Fall back to the bounded resumable directory traversal, which completes repository bootstrap when the recursive snapshot feed stalls.

Production diagnosis

The failed Agent37 zero-config mount authenticated successfully: all 34 Relayfile responses in the mount window were HTTP 200. The GitHub contents tree then received the same non-empty cursor three times before the one-shot mount exited. The snapshot loop was the only mount pagination loop without a repeated-cursor guard.

Validation

  • go test ./internal/mountsync -count=1
  • Focused regression proves the snapshot stops after two requests, bounded tree fallback runs, bootstrap completes, and the repository file is materialized.
  • git diff --check

No API contract, server route, dependency, credential, or provider mutation changes.


Note

Medium Risk
Changes GitHub bootstrap pagination behavior; incorrect guards could block mounts or skip tar seed when the server is healthy.

Overview
GitHub working-tree snapshot pagination now fails closed when ListTree returns a non-empty next cursor that does not advance or repeats a cursor already seen, using the existing MalformedPaginationError / ErrMalformedPagination path (feed label github working-tree). That stops the verification snapshot from spinning until reconcile expires—the gap other paginated feeds already guarded against.

When the tar-seed path hits this error, bootstrap continues via the existing bounded resumable tree pull instead of starting tar export after a broken snapshot.

Comments are generalized from “events” to any paginated feed. Tests cover direct snapshot rejection after two identical cursors and a full Reconcile that completes bootstrap and materializes files without calling tar export.

Reviewed by Cursor Bugbot for commit 49fd1c2. Bugbot is set up for automated code reviews on this repo. Configure here.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-19T17:31:42.450438Z 49fd1c2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: d8405920-7d42-49a0-b988-0a79d865d8b5

📥 Commits

Reviewing files that changed from the base of the PR and between 66a80c8 and 49fd1c2.

📒 Files selected for processing (2)
  • internal/mountsync/syncer.go
  • internal/mountsync/syncer_test.go

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The GitHub working-tree snapshot now detects repeated pagination cursors and returns a malformed-pagination error. Tests verify the error details and confirm that reconciliation falls back to bounded tree traversal.

Changes

GitHub pagination validation

Layer / File(s) Summary
Cursor repeat validation
internal/mountsync/syncer.go
githubWorkingTreeSnapshot records page-start cursors and rejects repeated or self-referencing NextCursor values with MalformedPaginationError. Error comments now use general pagination wording.
Pagination failure tests
internal/mountsync/syncer_test.go
Tests verify repeated-cursor error fields, requested cursors, and reconciliation fallback to bounded tree traversal without tar export.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: miyaontherelay

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: fallback behavior when the GitHub tree cursor stalls.
Description check ✅ Passed The description directly explains the cursor validation, malformed-pagination error, fallback traversal, production diagnosis, and validation performed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks each cursor’s trail
No looping hop can now prevail
The snapshot stops with errors clear
Bounded trees bring bootstrap near
README blooms where paths appear

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@github-actions

Copy link
Copy Markdown

Relayfile Eval Review

Run: .relayfile/evals/runs/2026-09-19T17-32-27-988Z-HEAD-provider
Mode: provider
Git SHA: 5c83354

Passed: 4 | Needs human: 0 | Reviewable: 0 | Missing output: 0 | Failed: 0 | Skipped: 0

Human Review Cases

No reviewable human-review cases captured Relayfile output.

@khaliqgant
khaliqgant merged commit 2aa77f7 into main Sep 19, 2026
13 checks passed
@khaliqgant
khaliqgant deleted the fix/github-snapshot-cursor-stall branch September 19, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant