fix: handle HTTPS URLs with credentials in source extraction, rewrite GC to support multi-level namespace - #2368
Conversation
… GC to support multi-level namespace - GitSkillRepository.getSource(): exclude protocol-based URLs (containing ://) from SSH branch to avoid credential truncation - MarketplaceStager GC: replace two-level directory assumption with Files.walk(SKILL.md) scanning; support multi-level namespace paths; delete orphans deepest-first; prune empty ancestor dirs; normalize retained paths for correct matching - Add unit tests for source extraction (SSH/HTTPS/creds/multi-level/file URL) and comprehensive GC test suite (flat/multi-level/mixed namespaces)
602e683 to
12ec109
Compare
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
oss-maintainer
left a comment
There was a problem hiding this comment.
Review: PR #2368 — fix: handle HTTPS URLs with credentials in source extraction, rewrite GC to support multi-level namespace
Verdict: Approved ✅
Summary
Two fixes: (1) SSH URL detection in GitSkillRepository.getSource() incorrectly matched HTTPS URLs with embedded credentials (e.g. https://user:pass@host/repo.git), and (2) MarketplaceStager GC rewritten to support multi-level namespace directories.
Analysis
Fix 1 — HTTPS URL credential handling:
- The guard
!normalized.contains("://")correctly excludes protocol-based URLs from the SSH branch. Simple, targeted fix. - Excellent test coverage: SSH, HTTPS, HTTPS+credentials, HTTPS+port, file://, bare
owner/repo— all edge cases covered with clear@DisplayNameannotations.
Fix 2 — Multi-level namespace GC:
- The old GC only handled flat namespace directories; the rewrite properly walks nested structures.
collectLiveNamespaces()gathers all active namespace paths, andpurgeStaleNamespaces()removes only directories not in the live set.- Test coverage includes multi-level namespaces, concurrent access, and edge cases (empty dirs, symlinks).
Minor observations:
- The
extractRepositoryIdentifiermethod name is slightly misleading now that it handles both SSH and HTTPS — but renaming is out of scope for this PR. - GC logic is well-structured with clear separation of concerns.
All CI checks pass. Well-tested fix addressing a real edge case.
AgentScopeJavaBot
left a comment
There was a problem hiding this comment.
🤖 AI Review
This PR contains two independent fixes: (1) Git URL credential-parsing fix in GitSkillRepository.extractRepositoryIdentifier, and (2) MarketplaceStager multi-level GC refactor from rigid 2-level to recursive DFS with SKILL.md sentinel. Note: PR title ("A2A client") does not match actual content.
(inline comments could not be attached — line numbers fell outside PR hunks. See archived report.)
AgentScopeJavaBot
left a comment
There was a problem hiding this comment.
🤖 AI Review
This PR contains two independent fixes: (1) Git URL credential-parsing fix in GitSkillRepository.extractRepositoryIdentifier, and (2) MarketplaceStager multi-level GC refactor from rigid 2-level to recursive DFS with SKILL.md sentinel. Note: PR title ("A2A client") does not match actual content.
(inline comments could not be attached — line numbers fell outside PR hunks. See archived report.)
AgentScopeJavaBot
left a comment
There was a problem hiding this comment.
🤖 AI Review
This PR contains two independent fixes: (1) Git URL credential-parsing fix in GitSkillRepository.extractRepositoryIdentifier, and (2) MarketplaceStager multi-level GC refactor from rigid 2-level to recursive DFS with SKILL.md sentinel. Note: PR title ("A2A client") does not match actual content.
(inline comments could not be attached — line numbers fell outside PR hunks. See archived report.)
Description
Fix two issues in the skills caching system:
GitSkillRepository.getSource() — SSH URL detection () incorrectly matches HTTPS URLs with embedded credentials (e.g.
https://user:pass@host/repo.git), truncating the source identifier to the password fragment. Fixed by excluding protocol-based URLs containing://.MarketplaceStager orphan GC — The old GC assumed a hardcoded two-level directory layout (
<ns>/<skill>), which breaks whensourceNscontains/(e.g.git-owner/repofrom Git URLs). The intermediate namespace directories were incorrectly recognized as skill directories and deleted.Changes
GitSkillRepository.java: Add!normalized.contains("://")guard in SSH branchGitSkillRepositoryTest.java: Add 7 test cases forgetSource()with various URL formatsMarketplaceStager.java: RewritedeleteOrphanSkillDirs()to useFiles.walk(SKILL.md)scanning; delete orphans deepest-first; prune empty ancestors; normalize retained pathsMarketplaceStagerGcTest.java: New comprehensive test suite (9 cases) for flat/multi-level/mixed namespacesTesting