Skip to content

fix(skill): emit base directory as filesystem path, not file:// URL#33580

Merged
rekram1-node merged 3 commits into
anomalyco:devfrom
shyuan:fix/skill-base-directory-url-encoding
Jun 24, 2026
Merged

fix(skill): emit base directory as filesystem path, not file:// URL#33580
rekram1-node merged 3 commits into
anomalyco:devfrom
shyuan:fix/skill-base-directory-url-encoding

Conversation

@shyuan

@shyuan shyuan commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #18370

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The skill tool emitted the skill's base directory as a file:// URL via pathToFileURL(dir).href. When the skill path contained characters that get URL-encoded — most notably # from git-tagged plugin cache dirs (e.g. ...git#v1.3.0...git%23v1.3.0) — the LLM derived a read-tool path with %23 but the filesystem has #, so read returned "File not found" and the skill's reference files appeared missing.

Emit dir directly instead. The <file> entries on the next line already use path.resolve(dir, file.path) (plain paths), so the base now matches and the LLM gets a path it can pass straight to read.

This also fixes the file:/// prefix issue reported by ACP editors in #23885.

How did you verify your code works?

  • bun test packages/opencode/test/tool/skill.test.ts — both tests pass (updated the base-directory assertion to expect a plain path).
  • Reproduced the original bug with my own plugin (writing-humanizer@git+https://...#v1.3.0): confirmed read fails on a %23 path but succeeds on the # path. After this change the base directory no longer contains %23.

Screenshots / recordings

N/A — no UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jun 24, 2026
@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jun 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

The skill tool emitted the base directory as a file:// URL via
pathToFileURL(dir).href. This broke read-tool resolution when the
path contained URL-encoded characters — most notably # from git-tagged
plugin cache dirs (e.g. ...git#v1.3.0 → ...git%23v1.3.0), where the
LLM derived a path with %23 but the filesystem has #.

Emit dir directly instead. The <file> entries already use path.resolve
(plain paths), so the base now matches. Also fixes the file:/// prefix
issue reported by ACP editors (anomalyco#23885).

Fixes anomalyco#33513
@rekram1-node rekram1-node merged commit 246d40d into anomalyco:dev Jun 24, 2026
8 checks passed
@zcutlip

zcutlip commented Jun 24, 2026

Copy link
Copy Markdown

I don't believe this addresses #18370. The origional issue auther never even had a chance to comment or confirm if their issue was addressed by this PR. Certainly I'm seeing that issue manifest in situations where no URL encoding of special characters would have been in play.

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.

File path location error in skill

3 participants