Skip to content

Skip local training and embedding disk access on Vercel - #2049

Open
groupthinking with Copilot wants to merge 3 commits into
mainfrom
copilot/skip-local-storage-writes-vercel
Open

groupthinking with Copilot wants to merge 3 commits into
mainfrom
copilot/skip-local-storage-writes-vercel

Conversation

Copilot AI commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Canonical issue

Automated issue linkage is handled separately.

Outcome

Vercel serverless executions stop attempting local training/embedding filesystem access, eliminating the ENOENT mkdir/read noise from those code paths.

Scope

  • Included:
    • Broaden the Vercel runtime guard in apps/web/src/lib/training-store.ts and apps/web/src/lib/embedding-store.ts to recognize deployed Vercel environments via VERCEL_ENV, not just VERCEL=1.
    • Add a regression test covering the serverless path by importing both stores with VERCEL_ENV=preview and asserting no fs.promises calls occur.
    • Example:
      const IS_VERCEL =
        process.env.VERCEL === '1' || Boolean(process.env.VERCEL_ENV?.trim());
  • Explicitly excluded:
    • Changes to durable Upstash-backed storage or search indexing.
    • Changes to non-Vercel local development behavior.

Risk

  • Risk level: low
  • Failure mode:
    • If VERCEL_ENV is set unexpectedly outside Vercel, local training/embedding disk persistence will be skipped for that process.
  • Rollback:
    • Revert the two guard changes and the regression test.

Verification

List exact automated and manual checks, tied to the current head SHA.

  • Focused tests — npm --workspace=apps/web run test -- src/lib/__tests__/serverless-local-store.test.ts src/app/api/v1/refinery/dataset/__tests__/route.test.ts @ 86b36e5
  • Required CI
  • Review threads resolved

Production evidence

Not applicable. This is a runtime guard adjustment for Vercel serverless filesystem behavior; no preview-only UI or infrastructure evidence was required.

Agent handoff

  • One canonical issue is linked
  • No competing PR implements the same issue
  • Acceptance criteria are satisfied
  • Required checks pass on the current head
  • Human decision is requested only for product, security, irreversible infrastructure, or production approval

@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: groupthinking/EventRelay/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: ad2a4578-34b4-4fe3-bf30-b9a4f6a61692

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@vercel

vercel Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
v0-uvai Ready Ready Preview, v0 Sep 18, 2026 11:31pm UTC

Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
Copilot AI changed the title [WIP] Avoid local storage writes for Vercel serverless runtime Skip local training and embedding disk access on Vercel Sep 18, 2026
@github-actions github-actions Bot added javascript Pull requests that update javascript code tests labels Sep 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 PR Validation

⚠️ PR title should follow conventional commits format

@github-actions

Copy link
Copy Markdown
Contributor

✅ E2E Test Results: ALL TESTS PASSED

Metric Value
Status 🟢 GREEN
Total Tests
Passed 19
Failed
Deployment https://v0-uvai-6n7q62vvr-garv1.vercel.app
Test Output
out�[2m | tests/e2e/pipeline.test.ts�[2m > �[22m�[2mEventRelay E2E — Live Deployment�[2m > �[22m�[2mSSE Pipeline Stream�[2m > �[22m�[2mSSE stream emits at least a pipeline_status:running event
�[22m�[39m[E2E] last pipeline_status: complete

 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mSSE Pipeline Stream�[2m > �[22mSSE stream emits at least a pipeline_status:running event�[33m 12234�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mSSE Pipeline Stream�[2m > �[22mSSE stream closes within 90 seconds (no 95% hang)�[33m 16350�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mSSE Pipeline Stream�[2m > �[22mSSE events fire in correct agent order�[33m 14723�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mCloudEvent Schema�[2m > �[22mSSE events contain valid timestamps�[33m 17294�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mCloudEvent Schema�[2m > �[22mterminal pipeline_status includes duration and stage progress�[33m 22712�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mError Handling�[2m > �[22mmissing URL returns 400, not a hang�[32m 281�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mError Handling�[2m > �[22minvalid URL returns error event or completes quickly, not a hang�[33m 5691�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mDashboard�[2m > �[22m/dashboard returns 200�[33m 1683�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mDashboard�[2m > �[22m/dashboard contains agent or pipeline visualization markup�[32m 226�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mAPI Health�[2m > �[22mGET /api returns a response (not 404)�[33m 1039�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mAPI Health�[2m > �[22mPOST /api/pipeline/stream with no body returns 400�[32m 196�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mStatic Assets�[2m > �[22mhomepage has proper meta tags�[32m 215�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mStatic Assets�[2m > �[22m/features page returns 200�[32m 242�[2mms�[22m�[39m

�[2m Test Files �[22m �[1m�[32m1 passed�[39m�[22m�[90m (1)�[39m
�[2m      Tests �[22m �[1m�[32m19 passed�[39m�[22m�[90m (19)�[39m
�[2m   Start at �[22m 22:36:03
�[2m   Duration �[22m 98.30s�[2m (transform 58ms, setup 0ms, import 75ms, tests 98.09s, environment 0ms)�[22m


@groupthinking
groupthinking marked this pull request as ready for review September 18, 2026 23:30
@groupthinking
groupthinking self-requested a review as a code owner September 18, 2026 23:30
Copilot AI balanced review requested due to automatic review settings September 18, 2026 23:30

Copilot AI 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.

Copilot review overview

🟢 Approved

The focused guard changes match the stated scope and are covered for both local stores.

Review effort: Balanced
Findings: None

What changed in this PR

Updates local training and embedding stores to avoid filesystem access in Vercel deployments.

Changes:

  • Detect Vercel through either VERCEL=1 or non-empty VERCEL_ENV.
  • Add regression coverage confirming both stores make no filesystem calls in preview environments.
File Description
apps/​web/​src/​lib/​training-store.ts Broadens Vercel runtime detection.
apps/​web/​src/​lib/​embedding-store.ts Broadens Vercel runtime detection.
apps/​web/​src/​lib/​__tests__/​serverless-local-store.test.ts Tests serverless filesystem bypass behavior.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

Copy link
Copy Markdown
Contributor

✅ E2E Test Results: ALL TESTS PASSED

Metric Value
Status 🟢 GREEN
Total Tests
Passed 19
Failed
Deployment https://v0-uvai-in8p1bre4-garv1.vercel.app
Test Output
t�[2m | tests/e2e/pipeline.test.ts�[2m > �[22m�[2mEventRelay E2E — Live Deployment�[2m > �[22m�[2mSSE Pipeline Stream�[2m > �[22m�[2mSSE stream emits at least a pipeline_status:running event
�[22m�[39m[E2E] last pipeline_status: complete

 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mSSE Pipeline Stream�[2m > �[22mSSE stream emits at least a pipeline_status:running event�[33m 17395�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mSSE Pipeline Stream�[2m > �[22mSSE stream closes within 90 seconds (no 95% hang)�[33m 18074�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mSSE Pipeline Stream�[2m > �[22mSSE events fire in correct agent order�[33m 16801�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mCloudEvent Schema�[2m > �[22mSSE events contain valid timestamps�[33m 21197�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mCloudEvent Schema�[2m > �[22mterminal pipeline_status includes duration and stage progress�[33m 14125�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mError Handling�[2m > �[22mmissing URL returns 400, not a hang�[32m 172�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mError Handling�[2m > �[22minvalid URL returns error event or completes quickly, not a hang�[33m 12105�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mDashboard�[2m > �[22m/dashboard returns 200�[33m 363�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mDashboard�[2m > �[22m/dashboard contains agent or pipeline visualization markup�[33m 1504�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mAPI Health�[2m > �[22mGET /api returns a response (not 404)�[32m 291�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mAPI Health�[2m > �[22mPOST /api/pipeline/stream with no body returns 400�[32m 116�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mStatic Assets�[2m > �[22mhomepage has proper meta tags�[32m 118�[2mms�[22m�[39m
 �[32m✓�[39m tests/e2e/pipeline.test.ts�[2m > �[22mEventRelay E2E — Live Deployment�[2m > �[22mStatic Assets�[2m > �[22m/features page returns 200�[33m 467�[2mms�[22m�[39m

�[2m Test Files �[22m �[1m�[32m1 passed�[39m�[22m�[90m (1)�[39m
�[2m      Tests �[22m �[1m�[32m19 passed�[39m�[22m�[90m (19)�[39m
�[2m   Start at �[22m 23:32:04
�[2m   Duration �[22m 105.54s�[2m (transform 43ms, setup 0ms, import 54ms, tests 105.40s, environment 0ms)�[22m


@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review Summary

The full dependency review summary was too large to display here (13153KB, limit is 1024KB).

Please download the artifact named "dependency-review-summary" to view the complete report.

View full job summary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Pull requests that update javascript code tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Skip local storage writes for Vercel serverless runtime

3 participants