Skip to content

fix(skill-tree): harvest diffs via githubkit, not the gh CLI#463

Merged
hadamrd merged 1 commit into
trunkfrom
fix/skill-harvest-githubkit
Jun 27, 2026
Merged

fix(skill-tree): harvest diffs via githubkit, not the gh CLI#463
hadamrd merged 1 commit into
trunkfrom
fix/skill-harvest-githubkit

Conversation

@hadamrd

@hadamrd hadamrd commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Follow-up to #462. Makes harvest actually work on a live loop.

Problem (green tests, dead feature): the post-merge harvest fetched the PR diff with gh pr diff (subprocess). forge-loop deliberately does not use the gh CLI, and the loop exports a GH_TOKEN that breaks it — so on the real loop harvest would silently no-op and the tree would never populate.

Fix: fetch via gh_issues.pr_diff(pr_url, repo) (forge-loop's githubkit client), keyed off the PR URL the merged outcome already carries (not the issue number). Provenance becomes pr:<url> (the PullRequest shape carries no merge SHA). Recipe freshness is held by skill-key supersession; commit-SHA-based age/expiry of harvested cards is a noted follow-up.

42 skill tests green, lint clean.

The harvest hook fetched the merged PR diff with `gh pr diff` (subprocess), but
forge-loop deliberately does NOT use the gh CLI and the loop exports a GH_TOKEN
that breaks it — so harvest would silently no-op in production (green tests, dead
feature). Switch to `gh_issues.pr_diff(pr_url, repo)` (githubkit), keyed off the
PR URL the merged outcome already carries rather than the issue number.

- harvest_skills_from_merge: fetch_diff is now Callable[[str], str] (pr_url ->
  diff); skips outcomes without a PR URL; idempotent per PR URL.
- provenance is `pr:<url>` (PullRequest carries no merge SHA); HarvestedSkill
  and SkillHarvestedEvent carry `pr_url`/`pr` instead of `sha`. Recipe freshness
  is held by skill-key supersession; SHA/age expiry of harvested cards is a
  noted follow-up.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@hadamrd hadamrd merged commit 6fc30ae into trunk Jun 27, 2026
1 check passed
@hadamrd hadamrd deleted the fix/skill-harvest-githubkit branch June 27, 2026 19:39
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.

1 participant