Repository navigation
fix(runtime): expose workspace file access for judges - #424
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: a07d1c04b8
ℹ️ 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".
6fc91f7 to
37086e9
Compare
|
Two small documentation fixes after syncing main:
|
37086e9 to
4753cc2
Compare
3cc1337 to
d9b0ebb
Compare
zpzjzj
left a comment
There was a problem hiding this comment.
I’d simplify the workspace file API before merging. Every judge call site discards the metadata from Stat. The rules only need to know whether a path exists and what a file contains.
Could we put Exists(ctx, relPath) (bool, error) and ReadFile(ctx, relPath) ([]byte, error) directly on Runtime and drop FileInfo and the optional FileAccessor assertion? Directories should continue to count as existing paths. A confirmed absence should return false, nil, and an inconclusive check should return an error.
My main concern is the fallback. If a runtime lacks FileAccessor, the judge silently checks the host filesystem using the runtime’s workspace path. That can produce a valid-looking grade for the wrong workspace. The evaluator already knows which runtime owns the workspace, and judge debug can select its local reader explicitly. If we want to limit what the judge can call, a small interface in the judge package would be enough.
Harbor exposes path predicates directly on the environment. Its verifier also checks whether results are mounted or need downloading before reading them locally. That explicit choice of filesystem would work well here. Harbor environment · Harbor verifier
The race tests for internal/judge, internal/runtime, and internal/evaluator passed on this commit. The inline findings come from code inspection.
@zpzjzj Ye, those r meaningful suggestions with lower fs risk and make the API lighter. Let me restructure it. |
bc74880 to
8989130
Compare
|
Thanks for the update.
On the interface, One related detail: |
94b8768 to
7673aa6
Compare
Sure, added those 2 in runtime interface and make up mock test implementations done. So did the missed/mis-passed cases and some path compatible fixes ^_^ |
|
I reviewed I found five remaining cases where the same workspace can produce an incorrect or inconsistent grading result:
The race tests passed for |
Add optional Runtime.Stat and Runtime.ReadFile accessors and use them for expect and rule_based workspace file checks. This keeps judging on the host without downloading the whole workspace, while golden_file continues to read from the local skill directory. Closes alibaba#420.
c30e08c to
58dbaf5
Compare
@zpzjzj Done, had those boundry cases covered. Any further inspections, just give me a shot ^_^. |
|
Thanks for the update. I reviewed I’d hold approval until two Docker cases are addressed and covered by regression tests:
I checked these two cases against the source. I haven’t run them in a local container. |
Dereference symlinks in the ls fallback so dangling links are absent on both paths, and only treat a trailing missing-file diagnostic as absence so permission errors with misleading paths stay errors.
@zpzjzj Fixed. Removed the whole-message permission denied guard from dockerFileNotFound, so absence is now classified solely by the trailing : no such file or directory suffix; a missing file literally named permission denied.txt now yields Exists → (false, nil) and ReadFile → ErrFileNotFound, with regression tests for both. Unit tests, make verify (0 issues), and Docker integration tests pass, and the change is pushed to the PR branch (2df6509). |
There was a problem hiding this comment.
zizmor found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
83e44af to
51aab35
Compare
|
Thanks for the Docker follow-up. I checked |
Replace SearchFiles with GetFileInfo so directories and filenames containing glob characters are checked literally, map FILE_NOT_FOUND to confirmed absence, and preserve other access errors.
@zpzjzj Exists now uses the literal GetFileInfo metadata lookup instead of SearchFiles, so an existing directory resolves to true, a filename containing glob characters ([abc]*.txt) is checked literally, and a FILE_NOT_FOUND (404) response maps to (false, nil) while all other access errors are preserved. Added regression tests for all three cases, plus an access-error case. |
|
The Docker issue from my last review is fixed in One OpenSandbox case remains. Could The race tests passed locally for |
Download directly instead of pre-checking with Exists, and map a FILE_NOT_FOUND download response to ErrFileNotFound while preserving other download errors.
@zpzjzj Fixed and pushed (25d9601). OpenSandboxRuntime.ReadFile now calls DownloadFile directly instead of pre-checking with Exists, and reuses isOpenSandboxFileNotFound on the download error so a 404 / FILE_NOT_FOUND response maps to ErrFileNotFound. Other download errors (permission, transport) still propagate unchanged. Added a regression test covering both the not-found mapping and the preserved error path. |
|
Thanks for the follow-up. I reviewed
One small docs follow-up: the changelog still says The pinned GitHub checks are green. These findings are based on source inspection; I didn’t independently run a live OpenSandbox or localized Docker test. |
Force LC_ALL=C for Docker stat/ls/cat probes, reject OpenSandbox paths with environment-expansion syntax, and update the changelog to name Exists instead of Stat.
@zpzjzj Pushed d417f5b with the tractable items:
|
|
Thanks for the update and for calling out what the client-side guard can and can’t fix. I reviewed I’d still hold off on approval for three reasons:
This is a source review; I didn’t independently run a live OpenSandbox test. |
@zpzjzj Changelog regression is fixed and pushed (8ab3cc9): the validate --skill note is restored, the file is back to LF, and only the Stat → Exists correction remains. The other 2 related to OpenSandBox retreated, I'll let ya check and decide what's going on next. Any progress, just let me know. |
|
Thanks for the follow-up. I re-reviewed This commit only changes the changelog, so I’d still hold off on approval for the two OpenSandbox cases:
If these need an upstream API change, could you open the upstream issue or PR and link it here? Before approving, I’d like to see both behaviors verified against a real OpenSandbox server. I haven’t run that integration test myself. |
|
Tracking the OpenSandbox upstream dependency in opensandbox-group/OpenSandbox#2960 (literal path lookup and symlink-following for file metadata/download). @zpzjzj |
|
Thanks for opening opensandbox-group/OpenSandbox#2960. I reran the review on I’d treat the dangling-symlink inconsistency as a follow-up rather than a merge blocker on its own. Please note that OpenSandbox currently counts a dangling link as present, while Docker and The remaining merge concern is literal paths containing I verified this from the source and CI results; I haven’t independently tested these cases on a live OpenSandbox server. |
Record that Exists and ReadFile reject $ in workspace paths until the upstream literal lookup lands, and link opensandbox-group/OpenSandbox#2960.
Bring in alibaba#429, alibaba#414 and alibaba#424 from main. The only textual conflict was in CHANGELOG.md, where this branch and alibaba#414 each added an entry at the top of Unreleased / Added; both entries are kept.
Summary
Add
ExistsandReadFiledirectly toruntime.Runtimeand use them forexpectandrule_basedworkspace file checks.Exists(ctx, relPath) (bool, error)ReadFile(ctx, relPath) ([]byte, error)Docker and OpenSandbox cases now grade the actual sandbox workspace without downloading it.
golden_filecontinues to read from the local skill directory.Related issues
Closes #420
Test plan
go test ./internal/...make verify