Skip to content

fix(skills): resolve home URI aliases when reading SKILL.md during extraction - #7741

Open
fxia0018 wants to merge 1 commit into
volcengine:mainfrom
fxia0018:fix/skill-read-home-alias
Open

fxia0018 wants to merge 1 commit into
volcengine:mainfrom
fxia0018:fix/skill-read-home-alias

Conversation

@fxia0018

Copy link
Copy Markdown

Description

Follow-up to #7417 for the skill-extraction path.

SessionSkillContextProvider.execute_tool handles read calls for SKILL.md itself and passes the raw URI straight to viking_fs.read_file. The read tool it exposes documents the viking://~/... form, and #7417 made MemoryReadTool resolve that alias. This override never goes through MemoryReadTool, though, so the alias is never expanded on this path.

Example, for user alice during session skill extraction:

  • Before: read(uri="viking://~/skills/code-review/SKILL.md") reaches the filesystem unresolved and is rejected, so the existing skill can't be read and the extractor works without it.
  • After: the URI is expanded to viking://user/alice/skills/code-review/SKILL.md, then read and authorized as before.

Human Involvement

  • A human participated in the implementation or review loop
  • This PR was generated entirely by AI agents without human participation in the loop

Related Issue

Follow-up to #7417 (same alias resolution, for the SKILL.md read override).

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

  • SessionSkillContextProvider.execute_tool runs the URI through the existing validate_request_viking_uri before reading SKILL.md. The read and the read_file_contents cache key use the canonical URI, matching MemoryReadTool. Filesystem authorization is unchanged.
  • Invalid URIs come back as a tool error through the existing except Exception branch, as other read failures already do.
  • New test test_session_skill_context_provider_read_resolves_home_alias: an alias read is served from the canonical user path and cached under it.

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

The new test fails without the fix: read_file is awaited with viking://~/skills/... instead of the user path.

tests/session/memory + tests/session/test_commit_skill_inference.py:

  • With this change: 1147 passed, 9 failed.
  • On main: 1146 passed, the same 9 failed.

The extra pass is the new test. The 9 failures are not touched by this change (e.g. the compile-cancel cancelling/cancelled assertion also noted in #7417, and test_skill_operation_updater_sanitizes_existing_skill_updates expecting no preserve_fields). ruff check passes on the changed files.

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

…traction

SessionSkillContextProvider.execute_tool handles read calls for SKILL.md
itself and passed the raw URI straight to viking_fs.read_file. The read
tool it advertises documents the viking://~/... form, and volcengine#7417 made
MemoryReadTool resolve that alias, but this override never went through
MemoryReadTool, so viking://~/skills/<name>/SKILL.md was rejected by the
filesystem and the existing skill could not be read during extraction.

Resolve the URI with validate_request_viking_uri before reading, so the
read and the read_file_contents cache use the canonical user URI, as
MemoryReadTool does.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant