Skip to content

Support scoped relayfile mount paths#206

Merged
khaliqgant merged 2 commits into
mainfrom
codex/relayfile-mount-path-filter
May 23, 2026
Merged

Support scoped relayfile mount paths#206
khaliqgant merged 2 commits into
mainfrom
codex/relayfile-mount-path-filter

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

Summary

  • Teach relayfile-mount to accept repeated --remote-path values and --paths-file for JSON or newline-delimited path lists.
  • Run scoped poll mounts under matching local subdirectories so provider prefixes are preserved and large workspaces avoid full /fs/export pulls.
  • Cancel sibling scoped mounts when one subtree returns an error.
  • Document repeated --remote-path and --paths-file usage.

Rollout note

This daemon change is backward-compatible for existing no-flag and single-root invocations. It should land and be baked into the snapshot before relying on cloud's single multi-path daemon mode. The paired cloud PR also has a fail-closed capability gate: old/ambiguous daemon probes fall back to one daemon per path with a single --remote-path each.

Tests

  • go test ./cmd/relayfile-mount ./internal/mountsync

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 23, 2026

Warning

Review limit reached

@khaliqgant, we couldn't start this review because you've used your available PR reviews for now.

Your plan currently allows 1 review/hour. Refill in 4 minutes and 44 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

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

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 94997262-38da-4251-959d-ce658cfeed5e

📥 Commits

Reviewing files that changed from the base of the PR and between a6b2ad5 and f0b7a91.

📒 Files selected for processing (3)
  • README.md
  • cmd/relayfile-mount/main.go
  • cmd/relayfile-mount/main_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/relayfile-mount-path-filter

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 and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 23, 2026

Relayfile Eval Review

Run: .relayfile/evals/runs/2026-05-23T19-19-40-647Z-HEAD-provider
Mode: provider
Git SHA: 411e9fc

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.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="cmd/relayfile-mount/main.go">

<violation number="1" location="cmd/relayfile-mount/main.go:449">
P1: Per-scope state-file naming is collision-prone, so different remote paths can clobber the same state file.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

}
ext := filepath.Ext(stateFile)
base := strings.TrimSuffix(stateFile, ext)
suffix := strings.NewReplacer("/", "-", "\\", "-", ":", "-").Replace(strings.Trim(remotePath, "/"))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1: Per-scope state-file naming is collision-prone, so different remote paths can clobber the same state file.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At cmd/relayfile-mount/main.go, line 449:

<comment>Per-scope state-file naming is collision-prone, so different remote paths can clobber the same state file.</comment>

<file context>
@@ -262,6 +365,94 @@ func runPollingMount(rootCtx context.Context, cfg mountConfig) error {
+	}
+	ext := filepath.Ext(stateFile)
+	base := strings.TrimSuffix(stateFile, ext)
+	suffix := strings.NewReplacer("/", "-", "\\", "-", ":", "-").Replace(strings.Trim(remotePath, "/"))
+	if suffix == "" {
+		suffix = "root"
</file context>
Suggested change
suffix := strings.NewReplacer("/", "-", "\\", "-", ":", "-").Replace(strings.Trim(remotePath, "/"))
suffix := base64.RawURLEncoding.EncodeToString([]byte(strings.Trim(remotePath, "/")))

@khaliqgant
Copy link
Copy Markdown
Member Author

Shadow review (claude-2) — Fix 6 daemon (multi-path scoped sync)

Verified against PR head.

Sibling cancellation ✅ (this was my flag on the earlier draft): runScopedPollingMounts now derives ctx, cancel := context.WithCancel(rootCtx), runs each mount as runSinglePollingMount(ctx, …), and on the first error calls cancel() (propagates to siblings) then drains errCh to completion via the wg.Wait()+close goroutine — so siblings are awaited, not leaked. defer cancel() covers the happy path. Correct hand-rolled errgroup.

Backward-compat ✅: no --remote-path / single / → original single-mount; the cloud side (mount-script --paths-file probe) only emits scoped/multi-path to a daemon that advertises the new capability, else one daemon per path with a single --remote-path each (old-compatible). So the forward-only sequencing risk is gated fail-closed.

--paths-file: readRemotePathsFile is robust (JSON-array or newline + # comments, errors propagate to log.Fatalf). Tested (TestReadRemotePathsFileSupportsJSONAndLines), plus TestNormalizeRemotePathsDedupesRepeatedFlagValues and TestScopedLocalDirKeepsProviderPrefixUnderMountRoot.

One should-add test (non-blocking): the sibling-cancellation teardown itself isn't directly unit-tested — inject one mount that returns an error and assert the others observe ctx cancellation and the func returns firstErr without hanging. It's the riskiest concurrency path and a teardown regression would be silent. (codex-2 is adding this.)

Residual (acknowledged in the issue): per-subtree /fs/export still 413s if any single mounted subtree alone exceeds 128MB — option (a) reduces but doesn't eliminate that; fine for the per-fire persona scopes.

@khaliqgant khaliqgant merged commit 11300ad into main May 23, 2026
9 checks passed
@khaliqgant khaliqgant deleted the codex/relayfile-mount-path-filter branch May 23, 2026 19:36
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