Skip to content

fix(harness): resolve shared skill cache paths#2183

Open
guslegend0510 wants to merge 1 commit into
agentscope-ai:mainfrom
guslegend0510:fix/2181-public-skill-cache-path
Open

fix(harness): resolve shared skill cache paths#2183
guslegend0510 wants to merge 1 commit into
agentscope-ai:mainfrom
guslegend0510:fix/2181-public-skill-cache-path

Conversation

@guslegend0510

@guslegend0510 guslegend0510 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

AgentScope-Java Version

2.0.1-SNAPSHOT

Description

Fixes #2181.

Marketplace skill resources are staged in the shared workspace cache:

/workspace/.skills-cache/<source>/<skill>/

With IsolationScope.USER, WorkspacePathNormalizer previously converted this into a relative path. LocalFilesystem then applied the user namespace and incorrectly resolved it as:

/workspace/<userId>/.skills-cache/<source>/<skill>/

This caused auxiliary marketplace skill files, such as docx-js.md, to be inaccessible through filesystem tools.

This PR keeps .skills-cache as a virtual workspace-absolute path so it remains in the shared workspace root. Other paths, including skills/..., continue to use the existing user namespace behavior.

Tests

Added regression coverage for:

  • shared marketplace skill resources under IsolationScope.USER
  • regular user-scoped workspace path normalization
  • the complete FilesystemToolWorkspacePathNormalizerLocalFilesystem path

Related test suites passed:

  • WorkspacePathNormalizerTest
  • FilesystemToolTest
  • LocalFilesystemModeTest
  • MarketplaceStagerExecBitTest
  • SandboxLifecycleMiddlewareCallbackTest

Result: 33 tests passed with no failures or errors.

Checklist

  • Code passes Spotless formatting checks
  • Relevant tests are passing
  • Javadoc and comments follow project conventions
  • No documentation update is required because no public API changed
  • Code is ready for review

@guslegend0510 guslegend0510 requested a review from a team July 14, 2026 01:58
@jujn

jujn commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

你好,有联系方式吗?可以发我主页邮箱

@guslegend0510

Copy link
Copy Markdown
Contributor Author

你好,有联系方式吗?可以发我主页邮箱

发送给您了

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...rness/agent/workspace/WorkspacePathNormalizer.java 66.66% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

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

Summary

Fixes shared skill cache path resolution for remote filesystems. Ensures cache paths are resolved relative to the workspace root.

Findings

  • [Info] Minimal change — adds path resolution logic. No obvious issues.

Verdict

LGTM.


Automated review by github-manager

@AgentScopeJavaBot AgentScopeJavaBot added bug Something isn't working area/harness agentscope-harness (test/runtime support) labels Jul 14, 2026

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

🤖 AI Review

Clean, targeted fix for issue #2181. The root cause was correctly identified: WorkspacePathNormalizer was stripping .skills-cache paths to relative form, causing LocalFilesystem.applyNamespacePrefix to inject a user namespace prefix and resolve to the wrong location. The fix preserves .skills-cache as a workspace-absolute path, skipping namespace injection.

One minor concern: the string ".skills-cache" is now defined as constants in both WorkspacePathNormalizer and MarketplaceStager. If one is modified without the other, it would cause a silent regression. Consider having WorkspacePathNormalizer reference MarketplaceStager.CACHE_DIR, or extract to a shared constants class if module dependency direction prevents it.

The end-to-end path resolution flow was verified correct, and the test coverage (unit + integration) is thorough with 33 tests passing.

*/
public final class WorkspacePathNormalizer {

private static final String SHARED_SKILL_CACHE = ".skills-cache";

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.

[minor] The string ".skills-cache" is also defined as MarketplaceStager.CACHE_DIR. If one changes without the other, the normalizer will silently stop recognizing cache paths. Consider referencing MarketplaceStager.CACHE_DIR directly, or extracting to a shared constants class to eliminate the duplication risk.

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

🤖 AI Review

Clean, targeted fix for issue #2181. The root cause was correctly identified: WorkspacePathNormalizer was stripping .skills-cache paths to relative form, causing LocalFilesystem.applyNamespacePrefix to inject a user namespace prefix and resolve to the wrong location. The fix preserves .skills-cache as a workspace-absolute path, skipping namespace injection.

One minor concern: the string ".skills-cache" is now defined as constants in both WorkspacePathNormalizer and MarketplaceStager. If one is modified without the other, it would cause a silent regression. Consider having WorkspacePathNormalizer reference MarketplaceStager.CACHE_DIR, or extract to a shared constants class if module dependency direction prevents it.

The end-to-end path resolution flow was verified correct, and the test coverage (unit + integration) is thorough with 33 tests passing.

*/
public final class WorkspacePathNormalizer {

private static final String SHARED_SKILL_CACHE = ".skills-cache";

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.

[minor] The string ".skills-cache" is also defined as MarketplaceStager.CACHE_DIR. If one changes without the other, the normalizer will silently stop recognizing cache paths. Consider referencing MarketplaceStager.CACHE_DIR directly, or extracting to a shared constants class to eliminate the duplication risk.

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

Labels

area/harness agentscope-harness (test/runtime support) bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]:MarketplaceStager filesystem 抽象层 工作区下公共技能无法使用

4 participants