Skip to content

fix(runtime): expose workspace file access for judges - #424

Merged
zpzjzj merged 12 commits into
alibaba:mainfrom
bababoom721:codex/fix-remote-expect-workspace
Nov 23, 2026
Merged

zpzjzj merged 12 commits into
alibaba:mainfrom
bababoom721:codex/fix-remote-expect-workspace

Conversation

@bababoom721

@bababoom721 bababoom721 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add Exists and ReadFile directly to runtime.Runtime and use them for expect and rule_based workspace 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_file continues to read from the local skill directory.

Related issues

Closes #420

Test plan

  • go test ./internal/...
  • make verify

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T04:07:31.398574Z a07d1c0 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@zpzjzj zpzjzj left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The runtime-accessor direction avoids downloading the whole workspace. I reproduced one regression on e9220d7 that should be addressed before merging.

Comment thread internal/judge/expect.go Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread internal/judge/expect.go Resolved
Comment thread internal/runtime/docker.go Resolved
Comment thread internal/evaluator/multi_judge.go Resolved
Comment thread internal/evaluator/evaluator.go Resolved
@bababoom721
bababoom721 force-pushed the codex/fix-remote-expect-workspace branch 3 times, most recently from 6fc91f7 to 37086e9 Compare November 17, 2026 05:07

zpzjzj commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

Two small documentation fixes after syncing main:

  • Please move this PR's runtime workspace-check entry from 0.16.0 / Fixed to Unreleased / Fixed. Version 0.16.0 has already shipped without this change.
  • Please update the PR summary: it still describes materializing the remote workspace into a temporary local directory, whereas the implementation now reads files through the runtime's Stat / ReadFile accessors.

@bababoom721
bababoom721 force-pushed the codex/fix-remote-expect-workspace branch 2 times, most recently from 37086e9 to 4753cc2 Compare November 17, 2026 10:51
@bababoom721
bababoom721 requested a review from zpzjzj November 17, 2026 11:23
@bababoom721
bababoom721 force-pushed the codex/fix-remote-expect-workspace branch 2 times, most recently from 3cc1337 to d9b0ebb Compare November 18, 2026 06:58

@zpzjzj zpzjzj left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread internal/judge/judge.go Resolved
Comment thread internal/judge/rule_based.go Resolved
Comment thread internal/runtime/docker.go Resolved
@bababoom721

Copy link
Copy Markdown
Contributor Author

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.

@bababoom721
bababoom721 force-pushed the codex/fix-remote-expect-workspace branch from bc74880 to 8989130 Compare November 18, 2026 08:16
@bababoom721
bababoom721 requested a review from zpzjzj November 18, 2026 08:50
@bababoom721 bababoom721 changed the title fix(runtime): read workspace files through runtime accessors fix(runtime): expose workspace file access for judges Nov 18, 2026
@zpzjzj

zpzjzj commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the update. Exists and ReadFile fit the judge’s needs, and the evaluator now reports an error if a runtime lacks those methods. I still see two cases where grading can incorrectly pass on 8989130.

  1. Docker can report an inaccessible file as absent. I checked the shell behavior locally as an unprivileged user. With an existing file under a non-traversable parent, stat reported permission denied and test -e returned 1. DockerRuntime.Exists maps that exit code to (false, nil), so files_not_exist can pass. The permission test mocks exit code 2 and misses this case. Could we distinguish confirmed absence from an access error and cover the exit-1 behavior with a non-root container user? Implementation · Test

  2. An invalid path can still make a failure rule pass. Both file predicates set AssertionResult.Error when Exists fails, but leave it unset when normalizeWorkspacePath fails. The failure-rule loop then records “failure rule did not match” as a passing assertion. Could both validation branches use the existing error path, with a regression test asserting that an invalid path in a failure rule yields ERROR? File predicates · Failure-rule loop

On the interface, evaluateCaseSession now requires judge.WorkspaceFiles even for output-only cases. Since that requirement is unconditional, could we declare Exists and ReadFile on runtime.Runtime and assign Files: rt directly? The judge can keep its small consumer-side interface, and a missing implementation becomes a compile-time error. Evaluator

One related detail: normalizeWorkspacePath selects host path semantics only for *runtime.NoneRuntime. judge debug supplies localWorkspaceFiles, so on POSIX a literal backslash in a filename is preserved during a normal none run but rewritten to / during debug. Both local readers should resolve the same configured path to the same file. Path normalization · Debug reader

@bababoom721
bababoom721 force-pushed the codex/fix-remote-expect-workspace branch 2 times, most recently from 94b8768 to 7673aa6 Compare November 18, 2026 10:28
@bababoom721

Copy link
Copy Markdown
Contributor Author

Thanks for the update. Exists and ReadFile fit the judge’s needs, and the evaluator now reports an error if a runtime lacks those methods. I still see two cases where grading can incorrectly pass on 8989130.

  1. Docker can report an inaccessible file as absent. I checked the shell behavior locally as an unprivileged user. With an existing file under a non-traversable parent, stat reported permission denied and test -e returned 1. DockerRuntime.Exists maps that exit code to (false, nil), so files_not_exist can pass. The permission test mocks exit code 2 and misses this case. Could we distinguish confirmed absence from an access error and cover the exit-1 behavior with a non-root container user? Implementation · Test
  2. An invalid path can still make a failure rule pass. Both file predicates set AssertionResult.Error when Exists fails, but leave it unset when normalizeWorkspacePath fails. The failure-rule loop then records “failure rule did not match” as a passing assertion. Could both validation branches use the existing error path, with a regression test asserting that an invalid path in a failure rule yields ERROR? File predicates · Failure-rule loop

On the interface, evaluateCaseSession now requires judge.WorkspaceFiles even for output-only cases. Since that requirement is unconditional, could we declare Exists and ReadFile on runtime.Runtime and assign Files: rt directly? The judge can keep its small consumer-side interface, and a missing implementation becomes a compile-time error. Evaluator

One related detail: normalizeWorkspacePath selects host path semantics only for *runtime.NoneRuntime. judge debug supplies localWorkspaceFiles, so on POSIX a literal backslash in a filename is preserved during a normal none run but rewritten to / during debug. Both local readers should resolve the same configured path to the same file. Path normalization · Debug reader

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 ^_^

@zpzjzj

zpzjzj commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

I reviewed c30e08c. The interface looks good to me now. Runtime requires Exists and ReadFile at compile time, and the evaluator passes Files: rt directly. The changes also address the earlier issues with invalid paths in failure rules and local path handling in judge debug.

I found five remaining cases where the same workspace can produce an incorrect or inconsistent grading result:

  1. Docker images without stat can still pass files_not_exist for an inaccessible file. When stat exits 127, the fallback runs test -e. If the container user cannot traverse the parent directory, that test exits 1 even when the file exists. Could the fallback return an error when it cannot confirm absence? A test covering stat exiting 127 followed by test exiting 1 would exercise this branch. Docker fallback

  2. A dangling symlink gets different grades across runtimes. On Linux, plain stat inspects the link itself and succeeds. Both NoneRuntime’s os.Stat and the Docker test -e fallback follow the link and report the missing target. As a result, even installing stat in an otherwise identical image changes the grade. Please follow links consistently and cover a dangling link in the existence checks. Docker Exists

  3. A filename can change how Docker classifies an error. dockerFileNotFound searches all of stderr, including the path printed by the command. A permission error mentioning a file named not found.txt therefore matches the missing-file check and can make files_not_exist pass. This helper also affects ReadFile. Please classify the diagnostic independently of the filename and preserve unrecognized errors. Error classification

  4. A multi-judge run can report both ERROR and FAIL for one case. An expect access error sets the case status to ERROR. The multi-judge branch then unconditionally sets Grading.Status to FAIL. Could the aggregate preserve the pre-check status? A regression test with a reader returning an access error should assert both fields. Pre-check · Multi-judge result

  5. judge debug reports an inconclusive expect check as FAIL. For example, pointing file_contains at a directory produces a read error. A normal run reports ERROR, while debug checks only Passed and returns an ordinary assertion failure. Please handle ExpectResult.Error in debug as well, and align the local reader’s missing-file error with the runtime contract so a genuinely missing file still produces the expected assertion failure. Debug pre-check · Local reader

The race tests passed for internal/cli, internal/judge, internal/runtime, and internal/evaluator. The Docker findings are from source inspection. The Docker CLI was unavailable for a live container run.

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.
@bababoom721
bababoom721 force-pushed the codex/fix-remote-expect-workspace branch from c30e08c to 58dbaf5 Compare November 19, 2026 05:45
@bababoom721

Copy link
Copy Markdown
Contributor Author

I reviewed c30e08c. The interface looks good to me now. Runtime requires Exists and ReadFile at compile time, and the evaluator passes Files: rt directly. The changes also address the earlier issues with invalid paths in failure rules and local path handling in judge debug.

I found five remaining cases where the same workspace can produce an incorrect or inconsistent grading result:

  1. Docker images without stat can still pass files_not_exist for an inaccessible file. When stat exits 127, the fallback runs test -e. If the container user cannot traverse the parent directory, that test exits 1 even when the file exists. Could the fallback return an error when it cannot confirm absence? A test covering stat exiting 127 followed by test exiting 1 would exercise this branch. Docker fallback
  2. A dangling symlink gets different grades across runtimes. On Linux, plain stat inspects the link itself and succeeds. Both NoneRuntime’s os.Stat and the Docker test -e fallback follow the link and report the missing target. As a result, even installing stat in an otherwise identical image changes the grade. Please follow links consistently and cover a dangling link in the existence checks. Docker Exists
  3. A filename can change how Docker classifies an error. dockerFileNotFound searches all of stderr, including the path printed by the command. A permission error mentioning a file named not found.txt therefore matches the missing-file check and can make files_not_exist pass. This helper also affects ReadFile. Please classify the diagnostic independently of the filename and preserve unrecognized errors. Error classification
  4. A multi-judge run can report both ERROR and FAIL for one case. An expect access error sets the case status to ERROR. The multi-judge branch then unconditionally sets Grading.Status to FAIL. Could the aggregate preserve the pre-check status? A regression test with a reader returning an access error should assert both fields. Pre-check · Multi-judge result
  5. judge debug reports an inconclusive expect check as FAIL. For example, pointing file_contains at a directory produces a read error. A normal run reports ERROR, while debug checks only Passed and returns an ordinary assertion failure. Please handle ExpectResult.Error in debug as well, and align the local reader’s missing-file error with the runtime contract so a genuinely missing file still produces the expected assertion failure. Debug pre-check · Local reader

The race tests passed for internal/cli, internal/judge, internal/runtime, and internal/evaluator. The Docker findings are from source inspection. The Docker CLI was unavailable for a live container run.

@zpzjzj Done, had those boundry cases covered. Any further inspections, just give me a shot ^_^.

@zpzjzj

zpzjzj commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the update. I reviewed 58dbaf5. Multi-judge grading and judge debug now preserve the error from an inconclusive expect check. Docker also no longer treats exit code 1 alone as proof that a file is missing. All current checks have passed, including Docker E2E, Windows E2E, and CLA. PR checks

I’d hold approval until two Docker cases are addressed and covered by regression tests:

  1. A dangling symlink still gets different grades depending on the image. The main path uses stat -L, which follows the link and reports a missing target. When stat is unavailable, the fallback uses ls -d, which succeeds on the link itself. Could the fallback follow the same semantics? A regression test should check the same dangling link through both paths and expect Exists to return false, nil in each case. Docker existence check

  2. A filename can still turn a permission error into a passing absence check. The earlier example not found.txt is fixed. The classifier still searches the entire diagnostic for no such file or directory, including the path printed by the command. If an inaccessible path contains that phrase, Exists can return false, nil and files_not_exist can pass. Could we classify the error independently of the filename and add a test that expects an error for a permission-denied diagnostic containing that path? Error classification

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.
@bababoom721

Copy link
Copy Markdown
Contributor Author

Thanks for fixing the dangling symlink fallback and adding coverage for both lookup paths. All checks on a89c916 have passed, including Docker E2E and CLA.

One case remains in dockerFileNotFound. Suppose /workspace/permission denied.txt is missing and Docker returns cat: /workspace/permission denied.txt: No such file or directory. The guard matches permission denied in the filename and returns before checking the diagnostic suffix. As a result, Exists reports an error for a confirmed absence, and ReadFile loses the expected ErrFileNotFound. Docker error classifier

Could we remove the whole-message permission check and classify absence from the trailing diagnostic alone? The suffix check already handles the existing permission-denied test. I’d add the reverse regression for a missing permission denied.txt, asserting that Exists returns (false, nil) and errors.Is(err, ErrFileNotFound) holds for ReadFile. I’d hold approval until that case is covered.

@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).

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zizmor found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@bababoom721
bababoom721 force-pushed the codex/fix-remote-expect-workspace branch from 83e44af to 51aab35 Compare November 20, 2026 01:37
@zpzjzj

zpzjzj commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the Docker follow-up. I checked 51aab35: the filename/error-classification fix and regression tests are in place. There is a separate OpenSandbox issue to fix before merging. Exists uses SearchFiles as a literal existence check, but the upstream handler skips directories and treats the basename as a glob. An existing directory can therefore satisfy files_not_exist, and a valid filename containing glob characters can be missed. A missing parent directory also returns an API error rather than a confirmed absence. Please use a literal metadata lookup, preserve genuine access errors, and cover all three cases. This is a source review, not a live OpenSandbox run.

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.
@bababoom721

Copy link
Copy Markdown
Contributor Author

Thanks for the Docker follow-up. I checked 51aab35: the filename/error-classification fix and regression tests are in place. There is a separate OpenSandbox issue to fix before merging. Exists uses SearchFiles as a literal existence check, but the upstream handler skips directories and treats the basename as a glob. An existing directory can therefore satisfy files_not_exist, and a valid filename containing glob characters can be missed. A missing parent directory also returns an API error rather than a confirmed absence. Please use a literal metadata lookup, preserve genuine access errors, and cover all three cases. This is a source review, not a live OpenSandbox run.

@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.

@zpzjzj

zpzjzj commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

The Docker issue from my last review is fixed in 74dd0da. The regression test covers both calls on a missing permission denied.txt: Exists returns false, nil, and errors.Is(err, ErrFileNotFound) holds for ReadFile. Regression test

One OpenSandbox case remains. ReadFile calls Exists before DownloadFile. If the file disappears between those requests, the download endpoint returns HTTP 404 with code FILE_NOT_FOUND. Wrapping that response as a generic download error causes expect.file_contains to report an evaluation error for a confirmed missing file. ReadFile implementation · Upstream download handler

Could ReadFile call DownloadFile directly and use the existing isOpenSandboxFileNotFound helper on its error? That would remove a round trip and classify the outcome of the read itself. A regression test could return 404 / FILE_NOT_FOUND from the download call and assert errors.Is(err, ErrFileNotFound), with a permission or transport error still propagated.

The race tests passed locally for internal/runtime, internal/judge, internal/evaluator, and internal/cli. All PR checks passed. I verified the OpenSandbox behavior against the source; I did not run a live sandbox.

Download directly instead of pre-checking with Exists, and map a FILE_NOT_FOUND download response to ErrFileNotFound while preserving other download errors.
@bababoom721

Copy link
Copy Markdown
Contributor Author

The Docker issue from my last review is fixed in 74dd0da. The regression test covers both calls on a missing permission denied.txt: Exists returns false, nil, and errors.Is(err, ErrFileNotFound) holds for ReadFile. Regression test

One OpenSandbox case remains. ReadFile calls Exists before DownloadFile. If the file disappears between those requests, the download endpoint returns HTTP 404 with code FILE_NOT_FOUND. Wrapping that response as a generic download error causes expect.file_contains to report an evaluation error for a confirmed missing file. ReadFile implementation · Upstream download handler

Could ReadFile call DownloadFile directly and use the existing isOpenSandboxFileNotFound helper on its error? That would remove a round trip and classify the outcome of the read itself. A regression test could return 404 / FILE_NOT_FOUND from the download call and assert errors.Is(err, ErrFileNotFound), with a permission or transport error still propagated.

The race tests passed locally for internal/runtime, internal/judge, internal/evaluator, and internal/cli. All PR checks passed. I verified the OpenSandbox behavior against the source; I did not run a live sandbox.

@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.

@zpzjzj

zpzjzj commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the follow-up. I reviewed 25d9601 and confirmed from the source that ReadFile now downloads directly, maps 404 / FILE_NOT_FOUND to ErrFileNotFound, and preserves other errors. The new unit tests cover both missing and permission-denied responses. I’d still hold off on approval for three reasons:

  1. [P1] OpenSandbox can look up a different path from the one the judge validated. Both the metadata and download endpoints expand environment variables on the server. A literal filename such as report-$VERSION.txt can resolve to a different file or fail if the variable is unset. Could Exists and ReadFile use the same literal, workspace-scoped lookup, with the boundary enforced where the file is actually accessed? A regression test should exercise the server’s path handling, not just a mocked response.
  2. [P2] OpenSandbox still counts a dangling symlink as present. Its metadata endpoint uses Lstat, while Docker, none, and OpenSandbox’s download path follow the target. That can give the same files_not_exist rule opposite grades across runtimes. Could we align Exists across backends and cover both a valid link and a dangling link?
  3. [P2] Docker’s missing-file detection assumes English stderr. The classifier matches : no such file or directory, but stat, the ls fallback, and cat inherit the container locale. Could we set LC_ALL=C for all three probes and keep regression coverage that distinguishes confirmed absence from permission errors?

One small docs follow-up: the changelog still says Stat; the required runtime methods are now Exists and ReadFile.

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.
@bababoom721

Copy link
Copy Markdown
Contributor Author

Thanks for the follow-up. I reviewed 25d9601 and confirmed from the source that ReadFile now downloads directly, maps 404 / FILE_NOT_FOUND to ErrFileNotFound, and preserves other errors. The new unit tests cover both missing and permission-denied responses. I’d still hold off on approval for three reasons:

  1. [P1] OpenSandbox can look up a different path from the one the judge validated. Both the metadata and download endpoints expand environment variables on the server. A literal filename such as report-$VERSION.txt can resolve to a different file or fail if the variable is unset. Could Exists and ReadFile use the same literal, workspace-scoped lookup, with the boundary enforced where the file is actually accessed? A regression test should exercise the server’s path handling, not just a mocked response.
  2. [P2] OpenSandbox still counts a dangling symlink as present. Its metadata endpoint uses Lstat, while Docker, none, and OpenSandbox’s download path follow the target. That can give the same files_not_exist rule opposite grades across runtimes. Could we align Exists across backends and cover both a valid link and a dangling link?
  3. [P2] Docker’s missing-file detection assumes English stderr. The classifier matches : no such file or directory, but stat, the ls fallback, and cat inherit the container locale. Could we set LC_ALL=C for all three probes and keep regression coverage that distinguishes confirmed absence from permission errors?

One small docs follow-up: the changelog still says Stat; the required runtime methods are now Exists and ReadFile.

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.

@zpzjzj Pushed d417f5b with the tractable items:

  • Docker locale: stat -L, the ls -dL fallback, and cat now run with LC_ALL=C, with regression coverage asserting --env LC_ALL=C on all three probes.
  • Docs: changelog now names Exists instead of Stat.
  • OpenSandbox P1 (mitigation): Exists and ReadFile now reject paths containing $ (fail-closed), so a literal report-$VERSION.txt can no longer be silently resolved to a different file. A regression case covers it.
    Two things I could not honestly claim as fully fixed from the skill-up side:
  • OpenSandbox env expansion (full fix): my guard prevents wrong grading, but a truly literal lookup requires the server to expose a non-expanding file-access endpoint or an opt-out flag. The guard is the safe client-side boundary.
  • OpenSandbox dangling symlink: GetFileInfo on the server uses os.Lstat, so a dangling link still reports as present. Aligning Exists with Docker/none/download requires changing the server to os.Stat (follow links). That is an OpenSandbox-side change, not something the skill-up client can compute from link metadata alone. I can prepare that OpenSandbox PR next if you want.

@zpzjzj

zpzjzj commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the update and for calling out what the client-side guard can and can’t fix. I reviewed d417f5b: stat -L, the ls -dL fallback, and cat now all run with LC_ALL=C, with regression coverage for all three, and the changelog now names Exists correctly. The GitHub checks for this commit are green.

I’d still hold off on approval for three reasons:

  1. Literal paths on OpenSandbox: Rejecting $ is a useful fail-closed mitigation; it prevents the server from silently looking up a different file. It still makes a valid literal name such as report-$VERSION.txt return an error. Please use a non-expanding, workspace-scoped lookup for both Exists and ReadFile, and cover it through the server’s actual path handling. The new test only covers rejection through Exists.
  2. Dangling symlinks on OpenSandbox: Exists still uses metadata backed by Lstat, while Docker, none, and OpenSandbox downloads follow the target. The same files_not_exist rule can pass on Docker and fail on OpenSandbox. Please align the behavior and test both a valid link and a dangling link. If both OpenSandbox changes need an upstream API change, I’d prefer to track that dependency explicitly before merging.
  3. Changelog regression: The edit removes the existing Unreleased / Added note for skill-up validate --skill and converts the whole file from LF to CRLF. Please restore the note and LF endings, retaining the corrected Exists/ReadFile entry.

This is a source review; I didn’t independently run a live OpenSandbox test.

@bababoom721

bababoom721 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for the update and for calling out what the client-side guard can and can’t fix. I reviewed d417f5b: stat -L, the ls -dL fallback, and cat now all run with LC_ALL=C, with regression coverage for all three, and the changelog now names Exists correctly. The GitHub checks for this commit are green.

I’d still hold off on approval for three reasons:

  1. Literal paths on OpenSandbox: Rejecting $ is a useful fail-closed mitigation; it prevents the server from silently looking up a different file. It still makes a valid literal name such as report-$VERSION.txt return an error. Please use a non-expanding, workspace-scoped lookup for both Exists and ReadFile, and cover it through the server’s actual path handling. The new test only covers rejection through Exists.
  2. Dangling symlinks on OpenSandbox: Exists still uses metadata backed by Lstat, while Docker, none, and OpenSandbox downloads follow the target. The same files_not_exist rule can pass on Docker and fail on OpenSandbox. Please align the behavior and test both a valid link and a dangling link. If both OpenSandbox changes need an upstream API change, I’d prefer to track that dependency explicitly before merging.
  3. Changelog regression: The edit removes the existing Unreleased / Added note for skill-up validate --skill and converts the whole file from LF to CRLF. Please restore the note and LF endings, retaining the corrected Exists/ReadFile entry.

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.

@zpzjzj

zpzjzj commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the follow-up. I re-reviewed 8ab3cc9 and confirmed that the validate --skill release note is restored, the changelog is back to LF, and the Exists/ReadFile wording is retained. All reported checks on this head are green.

This commit only changes the changelog, so I’d still hold off on approval for the two OpenSandbox cases:

  • Literal paths: Rejecting $ prevents a silent lookup of the wrong file, but a valid literal name such as report-$VERSION.txt still returns an error. Both Exists and ReadFile need a non-expanding, workspace-scoped lookup.
  • Dangling symlinks: OpenSandbox Exists still checks the link itself, while Docker and none check the target. The same files_not_exist assertion can therefore pass on Docker and fail on OpenSandbox.

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.

@bababoom721

Copy link
Copy Markdown
Contributor Author

Tracking the OpenSandbox upstream dependency in opensandbox-group/OpenSandbox#2960 (literal path lookup and symlink-following for file metadata/download). @zpzjzj

@bababoom721 bababoom721 reopened this Nov 20, 2026
@zpzjzj

zpzjzj commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Thanks for opening opensandbox-group/OpenSandbox#2960. I reran the review on 8ab3cc9; the diff is unchanged and the checks on this head are green.

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 none check whether its target exists.

The remaining merge concern is literal paths containing $. Rejecting them is a sensible safeguard against silently checking the wrong file, but it also means valid names such as report-$VERSION.txt return an error on OpenSandbox. If we’re comfortable shipping with that temporary limitation, could you document that it affects both Exists and ReadFile and link the upstream issue from the PR description or user docs? That would address my remaining concern without waiting for the upstream fix. Otherwise, I’d wait for literal lookup support before merging.

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.

@zpzjzj zpzjzj left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zpzjzj
zpzjzj added this pull request to the merge queue Nov 23, 2026
Merged via the queue into alibaba:main with commit 2fb04c7 Nov 23, 2026
19 checks passed
BiBoyang added a commit to BiBoyang/skill-up that referenced this pull request Nov 23, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenSandbox runtime: expect.files_exist and file_contains fail because WorkspacePath is remote

3 participants