Skip to content

fix(skills): resolve skill file reads home-root first as documented - #1284

Open
Mohith26 wants to merge 2 commits into
vercel:mainfrom
Mohith26:fix/skill-file-resolution-order
Open

fix(skills): resolve skill file reads home-root first as documented#1284
Mohith26 wants to merge 2 commits into
vercel:mainfrom
Mohith26:fix/skill-file-resolution-order

Conversation

@Mohith26

Copy link
Copy Markdown

Fixes #1234

What

The docs and system prompt say skill files resolve from $HOME/.agents/skills/<skill>/ first with /workspace/skills/<skill>/ as fallback, and skill packages are seeded into the home root. But the model-facing read_file tool rejected the advertised $HOME/... form outright (absolute-path validation) and did no cross-root fallback, so the only literal path that ever worked was the workspace form, and reads of seeded skills hard-failed with "File not found", costing a slow model-driven retry loop (~2s per miss).

This aligns the code with the documented order: skill-path reads resolve home-root first, then fall back to the workspace root, via a shared skill-paths helper used by the read tool.

Tests

35 unit tests cover the resolution order, fallback on miss, and the previously rejected home-root form. 10 fail on main, all pass with the fix. Full unit tier: 5485 passed, 0 failures.

Credit to @pedro757 for the report in #1234.

Mohith26 added 2 commits July 28, 2026 11:44
The docs and system prompt state skill files resolve from
$HOME/.agents/skills/<skill>/ first, with /workspace/skills/<skill>/ as
the fallback, and skill packages are seeded into the home root
(RUNTIME_SANDBOX_CONTRACT_VERSION 7, vercel#554). But the model-facing
read_file tool rejected the advertised $HOME/... form (absolute-path
validation) and did no cross-root fallback, so in practice the only
usable literal path was the workspace fallback: reads of
/workspace/skills/... hard-failed with 'File not found' even though the
file existed under the home root, forcing a slow model-driven retry
loop (~2s per miss).

read_file now resolves skill-rooted paths (symbolic $HOME form,
concrete home-rooted form, or /workspace/skills form) to ordered
candidates via resolveSkillFilePathCandidates: the probed home root
first, then /workspace/skills, matching the documented order. Non-skill
paths are unchanged. The result path and read stamp use the path that
actually resolved so follow-up writes target the real file, and the
not-found error lists every checked location.

Fixes vercel#1234
Regression tests for vercel#1234:

- resolveSkillFilePathCandidates orders the probed home root before the
  /workspace/skills fallback, resolves the symbolic $HOME form,
  collapses to the fallback when $HOME is unusable, passes non-skill
  paths through without probing, and keeps a distinct concrete home
  path as a candidate.
- executeReadFileOnSandbox prefers the home copy when a skill file
  exists in both roots, falls back to /workspace/skills on a home miss,
  accepts the symbolic $HOME path the prompt advertises, lists both
  checked locations in the not-found error, and stamps the resolved
  path for read-before-write tracking.
@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

@Mohith26 is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

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.

Skills file reading fallback is the opposite as described in docs

1 participant