Skip to content

Add remote git skill sources#29

Merged
gjkim42 merged 1 commit into
mainfrom
kanon-task-21
Jun 4, 2026
Merged

Add remote git skill sources#29
gjkim42 merged 1 commit into
mainfrom
kanon-task-21

Conversation

@kelos-bot
Copy link
Copy Markdown

@kelos-bot kelos-bot Bot commented Jun 3, 2026

What type of PR is this?

/kind api

What this PR does / why we need it:

Adds optional git-backed remote sources for skills. Missing remote skill caches are materialized automatically during render paths, remote source shape is validated, symlinked remote skill content is rejected, root-level clone metadata is stripped before caching, expanded source URL details are redacted from fetch output, concurrent cache winners are reused, and remote materialization failures are surfaced by status.

Which issue(s) this PR is related to:

Fixes #21

Special notes for your reviewer:

Remote plugins are intentionally out of scope for this neutral schema change. Remote skill sources are treated as trusted content, but symlinks are rejected during materialization so render paths do not follow remote-controlled links outside the materialized source. Root-level remote skill caches remove .git before install so expanded clone URLs are not retained in .git/config. Concurrent materialization reuses an existing valid cache instead of replacing it, and cache install errors include the skill name for multi-skill configs.

Does this PR introduce a user-facing change?

Skills can now declare pinned git-backed remote sources that Kanon materializes automatically when rendering.

@kelos-bot
Copy link
Copy Markdown
Author

kelos-bot Bot commented Jun 3, 2026

/kelos review

@kelos-bot kelos-bot Bot mentioned this pull request Jun 3, 2026
@gjkim42
Copy link
Copy Markdown
Contributor

gjkim42 commented Jun 3, 2026

/kelos review

@kelos-bot
Copy link
Copy Markdown
Author

kelos-bot Bot commented Jun 3, 2026

🤖 Kelos Task Status

Task kanon-reviewer-issue-comment-61c55e019660 has succeeded. ✅

Copy link
Copy Markdown
Author

@kelos-bot kelos-bot Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Kelos Reviewer Agent @gjkim42

Review Summary

Verdict: COMMENT
Overall correctness: patch is incorrect
Scope: Adds git-backed remote skill sources, automatic cache materialization during render paths, validation, tests, and README documentation.

Findings Overview

Priority Count File:Line Summary
P0 0 none
P1 1 internal/core/fetch.go:68 Remote skill symlinks can make render read files outside the cloned source
P2 0 none
P3 0 none

Findings

Security

  • [P1] internal/core/fetch.go:68 — Remote skill materialization accepts cloned repositories without rejecting symlinked subdirectories or files. renderSkills later walks the cache and uses os.ReadFile, which follows symlinks, so a remote skill can include a symlink such as notes.txt -> /home/user/.ssh/id_rsa or make the configured subdir a symlink and cause kanon render, diff, status, or apply to read and potentially print or write local files outside the cloned repository. Reject symlinks during materialization, or otherwise verify every rendered path resolves inside the materialized skill directory before reading it.

Key takeaways

  • The schema and documentation direction match the issue scope, but remote sources need a stronger boundary before this is safe to ship.
  • I did not run local validation commands, per the review instructions.

Comment thread internal/core/fetch.go Outdated
@gjkim42
Copy link
Copy Markdown
Contributor

gjkim42 commented Jun 3, 2026

/kelos pick-up

@kelos-bot
Copy link
Copy Markdown
Author

kelos-bot Bot commented Jun 3, 2026

🤖 Kelos Task Status

Task kanon-pr-responder-issue-comment-2f181d81ff08 has succeeded. ✅

@kelos-bot
Copy link
Copy Markdown
Author

kelos-bot Bot commented Jun 3, 2026

/kelos review

@kelos-bot
Copy link
Copy Markdown
Author

kelos-bot Bot commented Jun 3, 2026

🤖 Kelos Agent @gjkim42

Addressed the reviewer finding by rejecting symlinked remote skill roots/files during materialization and validating existing caches before reuse. Added regression tests for symlinked subdirs and files.

Local make verify and make test passed, and current PR checks are passing. Ready for re-review.

@gjkim42
Copy link
Copy Markdown
Contributor

gjkim42 commented Jun 3, 2026

/kelos review

@gjkim42
Copy link
Copy Markdown
Contributor

gjkim42 commented Jun 3, 2026

/kelos pick-up

@kelos-bot
Copy link
Copy Markdown
Author

kelos-bot Bot commented Jun 3, 2026

🤖 Kelos Task Status

Task kanon-pr-responder-issue-comment-df0b969d3ff5 has succeeded. ✅

@kelos-bot
Copy link
Copy Markdown
Author

kelos-bot Bot commented Jun 3, 2026

/kelos review

@kelos-bot
Copy link
Copy Markdown
Author

kelos-bot Bot commented Jun 3, 2026

🤖 Kelos Agent @gjkim42

Addressed the latest review feedback: fetch errors no longer include expanded source URLs, and remote skill cache installation reuses an existing valid cache instead of deleting or replacing it. Added regression tests for query-token redaction and concurrent cache winners.

Local make verify and make test passed. PR checks are green. I also posted /kelos review, but no new automated review task appeared from the bot-authored command; ready for maintainer re-review.

@gjkim42
Copy link
Copy Markdown
Contributor

gjkim42 commented Jun 3, 2026

/kelos review

@kelos-bot
Copy link
Copy Markdown
Author

kelos-bot Bot commented Jun 3, 2026

🤖 Kelos Task Status

Task kanon-reviewer-issue-comment-aaec42ae8d15 has succeeded. ✅

Copy link
Copy Markdown
Author

@kelos-bot kelos-bot Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Kelos Reviewer Agent @gjkim42

Review Summary

Verdict: COMMENT
Overall correctness: patch is incorrect
Scope: Adds git-backed remote skill sources, lazy cache materialization during render paths, validation, symlink rejection, tests, and README documentation.

Findings Overview

Priority Count File:Line Summary
P0 0 none
P1 1 internal/core/fetch.go:115 Remote materialization not-found errors are swallowed by status
P2 2 internal/core/fetch.go:79 Remote cache install errors omit the skill name
P2 2 internal/core/render_test.go:253 Git redaction tests do not exercise output redaction
P3 0 none

Findings

Correctness

  • [P1] internal/core/fetch.go:115 — Remote source validation wraps missing materialized files with %w, so a repo/ref/subdir that checks out but lacks the configured subdir or SKILL.md returns an error matching os.ErrNotExist. The status command currently ignores any opts.plan error where errors.Is(err, os.ErrNotExist) is true (internal/cli/root.go:179), so kanon status can exit successfully after only printing source git status and never report that the remote skill could not render. That hides invalid source state for one of the render paths documented in this PR. Narrow the status ignore case to the missing Kanon config/home case, or return non-os.ErrNotExist materialization validation errors and add a status regression test.

Conventions

  • [P2] internal/core/fetch.go:79 — materializeRemoteSkill returns installMaterializedSkill errors directly. On mkdir/rename/cache failures, installMaterializedSkill returns raw filesystem errors with only temp/cache paths and a hash, not the skill name; in configs with multiple remote skills, CLI output does not identify which skill failed. Wrap install failures with skill %q source or make the install helper include the skill name on every returned error.

Tests

  • [P2] internal/core/render_test.go:253 — The redaction tests call git not-a-real-git-command, which never uses or echoes the repo argument, so they pass even if redactSourceGitOutput returns output unchanged. Add a direct test with output containing the expanded URL/userinfo/query, or use a failing git command that actually echoes the URL, so the fetch-output redaction path is covered.

Key takeaways

  • The earlier symlink rejection and concurrent-cache replacement concerns appear addressed in the current code.
  • I could not submit a REQUEST_CHANGES review because GitHub reports the authenticated account is the PR author, so this is submitted as COMMENT with overall correctness marked incorrect.
  • I did not run make verify or make test, per the review instructions.

@gjkim42
Copy link
Copy Markdown
Contributor

gjkim42 commented Jun 3, 2026

/kelos pick-up

@kelos-bot
Copy link
Copy Markdown
Author

kelos-bot Bot commented Jun 3, 2026

🤖 Kelos Task Status

Task kanon-pr-responder-issue-comment-2bd295bdcdd0 has succeeded. ✅

@kelos-bot
Copy link
Copy Markdown
Author

kelos-bot Bot commented Jun 3, 2026

🤖 Kelos Agent @gjkim42

Addressed the latest reviewer findings: status now reports remote materialization errors instead of swallowing missing remote files, remote cache install/prep errors include the skill name, and redaction tests now exercise actual echoed output. I also tightened userinfo redaction so usernames are not left behind when passwords are redacted.

Local make verify and make test passed, and PR checks are green. I could not run a separate automated /kelos review tool from this environment; ready for maintainer re-review.

@gjkim42
Copy link
Copy Markdown
Contributor

gjkim42 commented Jun 4, 2026

/kelos review

@kelos-bot
Copy link
Copy Markdown
Author

kelos-bot Bot commented Jun 4, 2026

🤖 Kelos Task Status

Task kanon-reviewer-issue-comment-97cefae44e55 has succeeded. ✅

Copy link
Copy Markdown
Author

@kelos-bot kelos-bot Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Kelos Reviewer Agent @gjkim42

Review Summary

Verdict: COMMENT
Overall correctness: patch is incorrect
Scope: Adds git-backed remote skill sources, automatic cache materialization during render paths, validation, symlink rejection, tests, and README documentation.

Findings Overview

Priority Count File:Line Summary
P0 0 none
P1 1 internal/core/fetch.go:79 Root remote skill caches can persist expanded URL credentials in .git/config
P2 0 none
P3 0 none

Findings

Security

  • [P1] internal/core/fetch.go:79 — When subdir is omitted, sourcePath is the cloned repo root and installMaterializedSkill moves the whole clone into .kanon/cache/sources. Git stores the supplied HTTPS remote URL in .git/config, so a config using source.url: https://user:${TOKEN}@host/repo.git writes the expanded token to disk even though fetch output is redacted. Strip .git or copy only working-tree contents before installing root-level remote skills.

Key takeaways

  • The earlier symlink, output-redaction, concurrent-cache, and status-surfacing findings appear addressed in the current diff.
  • I did not run make verify or make test, per the review instructions.
  • I am submitting this as COMMENT because the authenticated GitHub App appears to be the PR author and cannot request changes on its own PR.

Comment thread internal/core/fetch.go
@gjkim42
Copy link
Copy Markdown
Contributor

gjkim42 commented Jun 4, 2026

/kelos pick-up

@kelos-bot
Copy link
Copy Markdown
Author

kelos-bot Bot commented Jun 4, 2026

🤖 Kelos Task Status

Task kanon-pr-responder-issue-comment-300ac605e485 has succeeded. ✅

@kelos-bot
Copy link
Copy Markdown
Author

kelos-bot Bot commented Jun 4, 2026

🤖 Kelos Agent @gjkim42

/kelos review

@kelos-bot
Copy link
Copy Markdown
Author

kelos-bot Bot commented Jun 4, 2026

🤖 Kelos Agent @gjkim42

Addressed the latest reviewer finding by stripping .git metadata before installing root-level remote skill caches, so expanded clone URLs are not retained in cached .git/config. Added a regression test that verifies root remote skill caches keep SKILL.md but not .git/config.

Local make verify and make test passed, and PR checks are green. I posted /kelos review after CI passed, but no new automated review task appeared from the bot-authored command; ready for maintainer re-review.

@gjkim42
Copy link
Copy Markdown
Contributor

gjkim42 commented Jun 4, 2026

/kelos review

@kelos-bot
Copy link
Copy Markdown
Author

kelos-bot Bot commented Jun 4, 2026

🤖 Kelos Task Status

Task kanon-reviewer-issue-comment-583169272806 has succeeded. ✅

Copy link
Copy Markdown
Author

@kelos-bot kelos-bot Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Kelos Reviewer Agent @gjkim42

Review Summary

Verdict: COMMENT
Overall correctness: patch is correct
Scope: Adds optional git-backed remote skill sources, automatic cache materialization on render paths, validation, cache hardening, tests, and README docs.

Findings Overview

Priority Count File:Line Summary
P0 0 none
P1 0 none
P2 0 none
P3 0 none

Findings

None.

Key takeaways

  • The current diff addresses the earlier symlink, redaction, concurrent cache, status-surfacing, install-error, and root .git metadata findings.
  • I resolved the stale .git/config review thread after verifying root clone metadata is stripped before cache install.
  • I did not run make verify or make test, per the review instructions.
  • I am submitting this as COMMENT because the authenticated GitHub App appears to be the PR author and cannot self-approve.

@gjkim42
Copy link
Copy Markdown
Contributor

gjkim42 commented Jun 4, 2026

/kelos squash-commits

@kelos-bot
Copy link
Copy Markdown
Author

kelos-bot Bot commented Jun 4, 2026

🤖 Kelos Task Status

Task kanon-squash-commits-issue-comment-d7024f47cc04 has succeeded. ✅

@kelos-bot kelos-bot Bot force-pushed the kanon-task-21 branch from ea2bdaf to 853b7d3 Compare June 4, 2026 14:43
@kelos-bot
Copy link
Copy Markdown
Author

kelos-bot Bot commented Jun 4, 2026

Squash complete.

Rebased onto origin/main and squashed the PR branch into a single commit.

@gjkim42 gjkim42 enabled auto-merge June 4, 2026 14:43
@gjkim42 gjkim42 added this pull request to the merge queue Jun 4, 2026
Merged via the queue into main with commit 6f8e188 Jun 4, 2026
6 checks passed
@gjkim42 gjkim42 deleted the kanon-task-21 branch June 4, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support remote plugins

1 participant