Skip to content

fix(mountsync): prune nested runtime trees before traversal#356

Merged
khaliqgant merged 5 commits into
mainfrom
fix/mount-runtime-tree-prune
Jul 18, 2026
Merged

fix(mountsync): prune nested runtime trees before traversal#356
khaliqgant merged 5 commits into
mainfrom
fix/mount-runtime-tree-prune

Conversation

@khaliqgant

@khaliqgant khaliqgant commented Jul 17, 2026

Copy link
Copy Markdown
Member

Problem

Cold Relayfile mounts still paid for one depth=200 ListTree enumeration before the client filtered nested mount runtime artifacts. Production Slack message trees can contain hundreds of .relay/outbox/acked/mountcmd_* leaves, so the traversal hit the runtime cap even though those files were never user content.

Change

  • Add one structured full-tree traversal summary with list calls, entries/files/directories/bytes seen, runtime entries, pruned roots, completion/failure, and duration.
  • Replace the single depth=200 request with a resumable depth-3 frontier. A nested .relay root is visible and pruned before descendant mountcmd_* leaves can be enumerated.
  • Canonicalize and remove only reserved .relay and exact mount state artifacts. Preserve real similarly named content such as .relay-notes, outbox/acked/mountcmd_real.json, and mount state backup files.
  • Protect the active mount root runtime directory while removing stale nested runtime trees and tracked state.
  • Persist directory plus cursor resume state. Resumed traversals skip authoritative deletion, and legacy deep-list cursors restart safely at root.

Measured regression

The RED fixture against the old depth=200 path returned 414 entries before filtering.

The representative bounded fixture contains 200 Slack message directories and 400 nested runtime mountcmd artifacts. It now completes in exactly 3 ListTree calls, returns zero runtime mountcmd leaves, prunes 200 canonical .relay roots, and remains under the simulated request-latency budget. Real similarly named content is still mirrored.

Validation

  • Focused runtime predicate, active-root protection, prune, resume, bootstrap-cursor, and delete-safety regressions pass uncached.
  • go test -p 1 ./... passes at head; internal/mountsync completed in 112.804s.
  • git diff --check passes and the worktree is clean.

Release and Cloud adoption

This PR must publish a new relayfile-mount release tag after merge. Cloud adoption is a separate PR that bumps RELAYFILE_MOUNT_VERSION in rebuild-snapshot.yml to that released tag and rebuilds the Daytona snapshot. No SDK package bump is involved.

Review in cubic

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@cursor

cursor Bot commented Jul 17, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@khaliqgant, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 47 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 743df356-2890-423a-bf31-b018dab675fb

📥 Commits

Reviewing files that changed from the base of the PR and between 79685bd and 9d482e3.

📒 Files selected for processing (3)
  • internal/mountsync/http_client_test.go
  • internal/mountsync/syncer.go
  • internal/mountsync/syncer_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/mount-runtime-tree-prune

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

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

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown

Relayfile Eval Review

Run: .relayfile/evals/runs/2026-07-18T00-36-52-630Z-HEAD-provider
Mode: provider
Git SHA: 6f8775b

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 force-pushed the fix/mount-runtime-tree-prune branch from 564e746 to 71782a9 Compare July 17, 2026 23:50
@khaliqgant
khaliqgant force-pushed the fix/mount-runtime-tree-prune branch from 71782a9 to b40b234 Compare July 17, 2026 23:55
@khaliqgant

Copy link
Copy Markdown
Member Author

Composition update: head moved to 9d482e31649da6cf0f078fdb39d9c3fa7afe9fed. Relayfile Cloud #128 adds the explicit GET/POST excludeMountRuntime capability and enforces the exact mount-runtime predicate in SQL before cursor/order/limit. This Go client now requests that capability on every mount ListTree call, with request-composition coverage. #356 remains HOLD until #128 is SHA-reviewed, merged, and deployed; only then should the client be re-reviewed/merged/tagged and adopted through the Cloud snapshot pin. Full affected go test ./internal/mountsync -count=1 passes in 110.885s.

@khaliqgant

Copy link
Copy Markdown
Member Author

SHA-bound composition review PASS at 9d482e3. The new client delta opts every mount-originated ListTree request into the server pre-pagination exclusion and proves the exact query shape; exact-head Go/build/E2E/contract/eval/typecheck checks are green. The previously retracted client-only premise is repaired only when paired with relayfile-cloud PR 128. Mandatory gate: PR 128 must merge, deploy, and pass a read-only production opt-in proof before this PR merges or tags. Afterward, pin the new mount binary in Cloud and require a fresh cold fire to reach runner.started.

@khaliqgant
khaliqgant merged commit 3e5f674 into main Jul 18, 2026
10 checks passed
@khaliqgant
khaliqgant deleted the fix/mount-runtime-tree-prune branch July 18, 2026 10:19
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