Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cb4cddbd33
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| candidate = Path("/tmp/gitplant-data") | ||
|
|
||
| try: | ||
| candidate.relative_to(REPO_ROOT) |
There was a problem hiding this comment.
Normalize DATA_DIR before enforcing repo-root fallback
The repo-root guard uses candidate.relative_to(REPO_ROOT) on the raw path, so DATA_DIR values containing traversal segments (for example /tmp/../var/task/.data or ../var/task/.data) are treated as outside the repo even when they resolve to /var/task/.... In that case _default_data_dir() returns a path under the read-only Vercel tree and DEFAULT_DATA_DIR.mkdir(...) can still fail at import time, which defeats the fix this commit is trying to provide. Resolve/canonicalize candidate before the relative_to check so equivalent paths inside REPO_ROOT are consistently redirected to /tmp.
Useful? React with 👍 / 👎.
Motivation
.dataunder the repo causedOSError: [Errno 30] Read-only file systemon Vercel because/var/taskis read-only, so the data directory must be moved to a writable location.Description
DEFAULT_DATA_DIRresolution to prefer theDATA_DIRenvironment variable and otherwise fall back to/tmp/gitplant-dataso serverless functions can write to a writable path.REPO_ROOT), the code falls back to/tmp/gitplant-datato avoid writes under/var/task.DEFAULT_DATA_DIR.mkdir(parents=True, exist_ok=True)so existing directories are fine and no extra behavior is changed./tmpto explain the rationale.Testing
python -m py_compile backend/app/config.pyand it completed successfully.Codex Task