Skip to content

fix(cli): read evals.json files from the Skill root - #372

Merged
zpzjzj merged 4 commits into
alibaba:mainfrom
karanb192:fix/import-context-files
Nov 5, 2026
Merged

zpzjzj merged 4 commits into
alibaba:mainfrom
karanb192:fix/import-context-files

Conversation

@karanb192

@karanb192 karanb192 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

skill-up import and skill-up run --auto convert Anthropic evals.json entries into cases. For each entry in files, the converter stored the path as the file's content (the code comment said "placeholder"). So the agent got a workspace file whose only content was its own path, and the case was graded against that input with no warning.

Anthropic's skill-creator schema defines evals[].files as "Optional list of input file paths (relative to skill root)". This PR reads each listed file from the Skill root and puts its bytes at the same relative path in the case workspace.

Related issues

None found. Direct bug-fix PR.

Changes

  • internal/cli/import.go:
    • The Skill root is the nearest directory with SKILL.md above evals.json, or the parent of the directory holding evals.json (the same lookup config.FindSkillDir does elsewhere).
    • Files are read through os.Root, so a path or symlink that leads outside the Skill root fails. Absolute paths and paths that lexically escape the root fail before any read. A missing file fails with the eval ID and the path.
    • import converts every case, files included, before it writes anything, so a file-read failure leaves earlier output untouched.
  • internal/cli/run.go: run --auto reads files only for the cases the --include-case-name and --exclude-case-name filters select. A missing file in a filtered-out case does not fail the run, in line with how filtered-out invalid cases are already treated. The filtered-out cases are still listed, so the "no cases matched the filter" message works as before.
  • Tests in internal/cli/import_test.go and internal/cli/run_test.go:
    • import of a skill with a text file and a binary file: both arrive in the case unchanged, after a YAML round trip;
    • run --auto reads a listed file from the Skill root;
    • a missing file, an absolute path, a .. path, and symlinks to a file and a directory outside the Skill root all fail (the symlink cases in a subtest that skips where symlinks are unavailable);
    • a filtered-out case with a missing file does not fail, and its files are not read;
    • a failed import writes no case files.
  • docs/guide/migration.md and docs/zh/guide/migration.md: the files row of the mapping table says the files are read from the Skill root.
  • The two E2E import tests use a fixture with SKILL.md and a real listed input file. The CLI test checks that the imported case contains that file's text.
  • CHANGELOG.md: one line under Unreleased, Fixed.

Test plan

The lint, full test, and E2E runs below passed on b8ca901, rebased onto 2405922.

  • make test passes
  • make verify passes with zero findings on the rebased head.
  • go test -tags e2e ./e2e passes on the rebased head, with agent CLIs absent from PATH.
  • The end-to-end import and run --auto tests fail when the old placeholder line is restored. The symlink and filter tests fail when a plain os.ReadFile or reading files for every case is restored.
  • Manual: a toy Skill with evals/files/data.csv listed in evals.json, imported and run on environment.type: none with a custom engine that prints that file from its workspace and a rule judge that looks for the CSV rows. On main the imported case holds evals/files/data.csv: evals/files/data.csv and the run fails; with this PR the case holds the CSV rows and the run passes.
  • npm run docs:build: not run; the doc change is one table cell per language.

Notes for reviewers

  • Binary files survive byte for byte through the written case YAML; the import test covers a file with non-UTF-8 bytes.
  • Large input files end up inline in the case YAML, because context.files holds file content. That matches how context.files works today.
  • The judge's file assertions check paths only by their text before reading (internal/judge/judge.go). That is the same class as the symlink case fixed here, but outside this change, so I left it alone.

@chatgpt-codex-connector

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

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T10:13:53.116917Z 80441e0 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.

@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: 80441e0cdf

ℹ️ 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/cli/import.go Resolved
@karanb192
karanb192 force-pushed the fix/import-context-files branch from 5779062 to da5b412 Compare November 3, 2026 06:13
Anthropic's evals.json lists input files as paths relative to the Skill
root. convertEvalToCase stored each path as the file's content (the code
said "placeholder"), so `skill-up import` and `skill-up run --auto` gave
the agent a file whose only content was its own path, and judges graded
the run against that input without any warning.

Read each listed file from the Skill root and place its bytes at the
same relative path in the case workspace. A missing file, or a path that
is absolute or leaves the Skill root, now fails the import or run with a
clear error instead of producing a broken case.
Read listed files through os.Root so a symlink cannot reach outside the
Skill root. In run --auto, read files only for the cases the case-name
filters select, so a missing file in a filtered-out case does not fail
the run. In import, convert every case before writing any file, so a
missing file leaves earlier output untouched.
The shared evals.json fixture listed file1.txt, which never existed;
import used to store the path as content, so nothing noticed. Now that
listed files are read from the Skill root, move the fixture into a small
Skill (SKILL.md, evals/evals.json, evals/files/input.txt), point both
import e2e tests at it, and check that the case carries the file's text.
@karanb192
karanb192 force-pushed the fix/import-context-files branch from da5b412 to b8ca901 Compare November 3, 2026 10:46

@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 enabled auto-merge November 4, 2026 01:56
@zpzjzj
zpzjzj added this pull request to the merge queue Nov 5, 2026
Merged via the queue into alibaba:main with commit ca276f5 Nov 5, 2026
16 checks passed
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.

2 participants