Repository navigation
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c7dc68ad52
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| - name: literal | ||
| in: query | ||
| required: false | ||
| description: > | ||
| Treat each path exactly as written: skip "$VAR"/"${VAR}" and "~" |
There was a problem hiding this comment.
Propagate the path modes through SDK clients
The stable filesystem facades never send either new parameter: for example, sdks/sandbox/javascript/src/services/filesystem.ts exposes no literal/follow option, FilesystemAdapter.fetchDownload and getFileInfo send only the existing fields, and Go's GetFileInfo/DownloadFileOptions do the same; even the checked-in generated Python and JavaScript clients were not regenerated. SDK users hitting the literal $VAR filename or symlink case therefore still get the old behavior unless they bypass the SDK and hand-build HTTP. Regenerate the contract outputs and thread these options through the affected adapters and facades.
AGENTS.md reference: specs/AGENTS.md:L50-L52
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 36e78d8 — the options are threaded end to end and the contract outputs regenerated. Python: get_files_info/download_file kwargs regenerated, async and sync FilesystemAdapter.get_file_info and every read_bytes*/read_file path accept literal/follow (omitted by default via UNSET), with mapping tests in tests/test_filesystem_literal_follow.py. JavaScript: src/api/execd.ts regenerated; FilesystemAdapter.getFileInfo/readBytes*/readFile and the SandboxFiles facade accept the options, covered by tests/filesystem.literal-follow.test.mjs. Go: new GetFileInfoOptions (variadic, so existing calls keep compiling), DownloadFileOptions.Literal, and the IdentityFilesystem interface updated; query-mapping tests added. C#: GetFileInfoOptions and ReadBytesOptions.Literal on the adapter and interfaces — call-out: the C# project was not compiled here (no dotnet SDK in this environment). The Kotlin SDK is untouched; its client is generated by Gradle at build time and needs a regeneration pass.
| if follow { | ||
| statFn = os.Stat |
There was a problem hiding this comment.
Preserve target birth time when following symlinks
On Linux filesystems that report STATX_BTIME, a follow=true request enters this os.Stat branch, but buildFileInfo calls getFileCreateTime(absPath, fileInfo) and syscall_linux.go always performs Statx(..., AT_SYMLINK_NOFOLLOW, ...). For a symlink, that lookup sees the link while fileInfo describes the target, so the inode check fails and created_at becomes the target's mutable ctime instead of its birth time; after a chmod, the endpoint therefore violates the documented target-metadata behavior. Pass the follow semantics into the birth-time lookup and cover this case.
AGENTS.md reference: AGENTS.md:L46-L46
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 36e78d8 — getFileCreateTime now receives the follow semantics and drops AT_SYMLINK_NOFOLLOW when following, so the statx lookup sees the target and created_at reports the target's birth time instead of falling back to its mutable change time. Covered by TestFilesystemControllerGetFilesInfoFollowCreatedAtUsesTargetBirthTime, which chmods the target to expose any ctime fallback, plus the existing dangling-link and rename tests still assert the link-own semantics for the default.
…info and files/download
The metadata and download endpoints always expand $VAR/${VAR}/~ in path
and, when a referenced variable is undefined, reject the request. A file
literally named e.g. report-$VERSION.txt therefore cannot be addressed,
even though it sits in the workspace. Add an optional literal=true query
parameter to both routes (and their /v1/filesystem/{uid}/{gid} variants,
which share the handlers): the path is used exactly as written.
/files/info also reports a symlink's own metadata (Lstat) while
/files/download opens the target (os.Open), so a dangling symlink looks
present to a metadata/existence check but a download returns 404. Add an
optional follow=true parameter that stats through the link, matching the
download's open semantics; the default keeps the link's own metadata,
which the API docs describe and existing tests assert. follow=true
reports the target's metadata and returns 404 for dangling links.
Refs opensandbox-group#2960
Docs and the OpenAPI spec document both parameters; regression tests
cover literal names with defined and undefined variables, symlink-to-file
resolution, and dangling-link 404s.
Signed-off-by: yjjnls <yjjnls@users.noreply.github.com>
…low-aware birth time Round-2 review (codex) findings: - P1: propagate the new path modes through the stable SDK facades. Regenerate the Python and JavaScript contract outputs and thread literal/follow through the handwritten layers: Python async/sync adapters (get_file_info + read_bytes* + _build_download_request), JavaScript FilesystemAdapter and SandboxFiles facade (api/execd.ts regenerated), Go GetFileInfoOptions/DownloadFileOptions.Literal and the IdentityFilesystem interface, C# GetFileInfoOptions and ReadBytesOptions.Literal. Mapping regression tests added in Python, JavaScript, and Go. - P2: follow=true must report the target's birth time. getFileCreateTime now drops AT_SYMLINK_NOFOLLOW when following, so the statx inode check matches the target instead of falling back to its mutable ctime. Covered by TestFilesystemControllerGetFilesInfoFollowCreatedAtUsesTargetBirthTime. The C# project was not compiled in this environment (no dotnet SDK); the Kotlin SDK needs a Gradle regeneration and is left untouched. Signed-off-by: yjjnls <yjjnls@users.noreply.github.com>
36e78d8 to
cae9599
Compare
|
Rebased onto main ( What changed Only the Everything else in the two commits is unchanged; the Verification
|
Summary
/files/infoand/files/downloadalways expand$VAR,${VAR}, and a leading~inpath, and reject a request whose path references an undefined variable. A workspace file literally named e.g.report-$VERSION.txtis therefore addressable only by accident of matching an environment variable — otherwise the request fails. The reporter needs a non-expanding, workspace-scoped lookup (Exists/ReadFilewhile grading file assertions).The two endpoints also disagree about symlinks:
/files/infousesLstat(a dangling link looks present), while/files/downloadopens the path withos.Open(the link is followed, so the same dangling link yields404). The same existence assertion can pass on Docker andnoneruntimes and fail on OpenSandbox.This adds two opt-in query parameters, leaving default behavior unchanged:
literal=trueonGET /files/infoandGET /files/download(and the/v1/filesystem/{uid}/{gid}variants, which share the handlers): the path is used exactly as written — no$VAR/${VAR}/~expansion, and no undefined-variable rejection.follow=trueonGET /files/info: resolve symlinks the same way/files/downloadopens them — the target's metadata is reported and a dangling link returns404 FILE_NOT_FOUND. The default keeps reporting the link itself, whichdocs/api/index.mddescribes and existing tests assert. The birth-time lookup follows the same semantics, sofollow=truereports the target'screated_atrather than falling back to its mutable change time.SDK propagation
The options are threaded through the stable SDK surfaces and the contract outputs regenerated:
get_files_info/download_fileclients regenerated; async and syncFilesystemAdapter.get_file_infoandread_file/read_bytes*acceptliteral/follow(omitted by default).src/api/execd.tsregenerated;FilesystemAdapter.getFileInfo/readBytes*/readFileand theSandboxFilesfacade accept the options.GetFileInfoOptions(variadic, existing calls unchanged),DownloadFileOptions.Literal,IdentityFilesystemupdated.GetFileInfoOptionsandReadBytesOptions.Literalon the adapter and interfaces.Call-outs (not verified here): the C# project was not compiled in this environment (no dotnet SDK); the Kotlin SDK is untouched — its client is generated by Gradle at build time and needs a regeneration pass when the options should be exposed there.
Testing
go build ./...andGOOS=windows go build ./...— both greengo vetclean; fullgo test ./pkg/...(execd suite) greenfollow=truesymlink resolution, dangling-link404,follow=truebirth time of the targetruff,pyright, fullpytestsuite green; new mapping tests (tests/test_filesystem_literal_follow.py)node --testsuite green; new mapping tests (tests/filesystem.literal-follow.test.mjs)go test ./...green; new query-mapping testsRefs #2960