fix(core): reject writes with an oversized path segment#353
Conversation
Local relayfile mounts materialize each path segment as a real filesystem entry. Most filesystems (ext4, APFS, ...) reject names over 255 bytes with ENAMETOOLONG -- worse once a mount's own atomic-write suffix (e.g. `.tmp-<random>`) is appended to the leaf segment. A provider adapter that builds a path segment from unbounded content (a long title, etc.) could produce a canonical path no mount could ever materialize, and since nothing revisits an already-written path, that failure recurred forever on every sync cycle. Root cause of the incident this fixes: relayfile-adapters#241 capped the reddit post title slug after a 275-byte segment made the `reddit-monitor` persona's sandbox mount fail continuously. That was a point fix in one provider adapter; this adds a shared guard at both write entry points (`writeFile` and `applyWebhookEnvelope`) so no provider can reintroduce the same class of bug. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
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. |
|
Warning Review limit reached
Next review available in: 56 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Relayfile Eval ReviewRun: Passed: 4 | Needs human: 0 | Reviewable: 0 | Missing output: 0 | Failed: 0 | Skipped: 0 Human Review CasesNo reviewable human-review cases captured Relayfile output. |
Summary
ENAMETOOLONG— worse once a mount's own atomic-write suffix (.tmp-<random>) is appended to the leaf segment.relayfile-adapters#241capped the reddit post title slug after a 275-byte segment made thereddit-monitorpersona's sandbox mount fail continuously (mount sync cycle failed: ... file name too long, repeating indefinitely). That was a point fix in one provider adapter. This PR adds a shared guard at the two write entry points in@relayfile/core—writeFile(direct HTTP write API) andapplyWebhookEnvelope(Nango/webhook sync path, the one that actually created the original bad file) — so no provider adapter can reintroduce this class of bug, ever.MAX_PATH_SEGMENT_BYTES = 200(comfortably under the 255-byte filesystem limit, leaving margin for mount-side suffixes) checked against each path segment's UTF-8 byte length, not JS string length.Test plan
packages/core/src/files.test.ts(new): unit tests forhasOversizedPathSegment, including UTF-8 byte-length correctness and a reproduction of the exact real oversized r/LocalLLaMA path that broke the mount. PluswriteFileintegration tests confirming the guard rejects before touching storage and a normal path still proceeds.packages/core/src/webhooks.test.ts: new test confirmingapplyWebhookEnveloperejects an oversized-path envelope withreason: "path_too_long"and never writes it to storage.packages/coresuite: 42/42 pass (was 34 before this PR).npm run buildinpackages/core— clean.Note
This does not retroactively fix any already-written oversized-path file (e.g. the specific stuck
reddit-monitororphan) — it only prevents new ones. That cleanup is tracked separately since it touches append-only production event history inrelayfile-cloud, not this repo.