Skip to content

Fix packaged lookup for managed agent skills - #90

Merged
andrei-hasna merged 2 commits into
mainfrom
fix/ope2-00280-agent-skill-sync
Aug 9, 2026
Merged

Fix packaged lookup for managed agent skills#90
andrei-hasna merged 2 commits into
mainfrom
fix/ope2-00280-agent-skill-sync

Conversation

@andrei-hasna

@andrei-hasna andrei-hasna commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix the managed-distribution follow-up tracked by OPE2-00280 (ca7fb4e7-466a-441d-89e8-39928370f116) after fix(agent-skill): use executable fleet rollout route #89.
  • Resolve named skills sync requests from both the public skills/ catalog and repository-managed agent-skills/, while preserving executable-pointer behavior and traversal rejection.
  • Ship the full agent-skills/ tree in @hasna/skills@0.1.61 and make the release guard reject any omitted repository-managed agent-skill file.
  • Replace one literal fleet hostname that became package-visible when agent-skills/ entered the tarball.

Exact candidate

  • Base: 5244c8e8013f78b4d2755a01c3aa307f56f11fda
  • Head: 063229cb54bfab180ed2d3b5fde5f08402c2222b

Validation

  • Regression first: 30 pass / 3 fail across lookup, packlist, and release-guard omission.
  • Affected lanes after the fix: 33 pass / 0 fail.
  • Typecheck: rc=0.
  • Build: rc=0.
  • Full suite: rc=0; memory and SQLite ran, while PostgreSQL explicitly skipped because HASNA_SKILLS_TEST_DATABASE_URL was unset.
  • Release-guard remediation lanes: 22 pass / 0 fail.
  • Final release guard: rc=0; 565 package-visible files (281 code) scanned and certified.
  • Exact source positive control: fleet-package-rollout returned rc=0 with five create/update actions.
  • Exact source negative control: missing-managed-agent-skill returned rc=1 with five not found in this machine's corpus skips.
  • Packed 0.1.61 assertion: literal true; extracted packed positive returned rc=0, and the missing-name negative returned rc=1.
  • Staged gitleaks scan: no leaks found.
  • Range gitleaks scan: 1 commits scanned and no leaks found.

Release boundary

The npm registry still reports latest 0.1.60; @hasna/skills@0.1.61 returns E404. A patch release of 0.1.61 is required after review and merge before managed distribution can use this fix.

No live agent home was written, and this PR does not merge, publish, install, or perform a live sync.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Resolve named sync requests from both skills/ and agent-skills/, ship the managed agent-skill tree in 0.1.61, and fail the release guard if any repository-managed agent-skill file is omitted.

Agent: cossus
@andrei-hasna

Copy link
Copy Markdown
Contributor Author

[REVIEW] NO_GO — #90 @ 063229c — lens: correctness+security+gates, reviewer Hostus (1 of 1)

Scope read:

  • git log --oneline origin/main..HEAD at base 5244c8e8013f78b4d2755a01c3aa307f56f11fda: one commit, 063229c fix(sync): package repository-managed agent skills.
  • Full diff and surrounding source for all eight changed files: CHANGELOG.md, agent-skills/skill-goal-execute/SKILL.md, package.json, scripts/release-guard.ts, src/lib/agent-sync.ts, and the three changed test files.
  • Because package.json#files newly publishes the complete agent-skills/ tree, I also reviewed that tree's workflow docs and resource references, the sync source-selection/write path, request-name validation, package-boundary guard, and relevant caller/tests.

Commands and measured results:

  • bun install — exit 0; setup only, 179 packages installed.
  • bun run typecheck — exit 0; 0 TypeScript diagnostics.
  • bun run test — exit 0; 1080 pass, 1 skip, 0 fail, 6655 expectations across 1081 tests / 85 files.
  • Focused fresh-home reproduction via syncSkillsToAgents({ names: ["inbox"], agents: ["codewith"] }) — exit 0; action reported create, installed SKILL.md: true, installed scripts/inbox: false.
  • git diff --check origin/main...HEAD — exit 0.

Blocking P0/P1 findings:

  1. P1 — named sync creates incomplete repository-managed skills whose required sibling resources are absent. findBundledSkillSource now exposes every directory under agent-skills/ (src/lib/agent-sync.ts:331-340), but writeManagedSkillDir writes only SKILL.md and .hasna-skills.json (src/lib/agent-sync.ts:292-299). This is reachable on a fresh home: syncing inbox reports success while omitting scripts/inbox; the installed SKILL.md immediately instructs install -m 0755 scripts/inbox ... (agent-skills/inbox/SKILL.md:9-14). The same break affects inbox-monitor and merge-pr, which require sibling scripts/references. The added test uses resource-free fleet-package-rollout, so it cannot detect the defect. Remedy: install the complete managed skill directory for bundled repository skills, preserve the non-clobber/marker contract, and add a fresh-home regression proving required scripts/references are copied and updated safely.

Security findings:

  • No separate concrete, currently reachable P0/P1 security defect found in the changed trust boundaries. The release guard now scans and packlist-checks the newly public tree; the incomplete sync above is the blocking correctness issue.

Non-blocking follow-ups:

  • agent-skills/README.md:13-14 still says this directory is excluded from the npm package, which is now false. Documentation-only; update with the fix or separately.

@andrei-hasna

Copy link
Copy Markdown
Contributor Author

[REVIEW] GO — #90 @ 34b3fed — lens: correctness+security+gates, reviewer Hostus (1 of 1)

Focused re-review of the one named P1 and its direct regressions:

  • 34b3fed fix(sync): copy bundled skill resources passes the bundled source directory through the existing managed/non-clobber writer, copies sibling resources before writing the per-agent-adapted SKILL.md, and leaves corpus/executable-pointer behavior unchanged.
  • The regression now uses the resource-bearing inbox skill, proves scripts/inbox exists in a fresh Codewith home, proves its bytes match the bundled helper, and proves non-Claude frontmatter adaptation still applies.
  • agent-skills/README.md now matches the package and named-sync distribution behavior.

Commands and measured results after the fix:

  • Fresh-home named inbox sync reproduction — exit 0; action create, skillMd: true, script: true.
  • bun run typecheck — exit 0; 0 TypeScript diagnostics.
  • bun run test — exit 0; 1080 pass, 1 skip, 0 fail, 6656 expectations across 1081 tests / 85 files.
  • Staged secret scan before commit — exit 0; STAGED_SECRET_FINDINGS=0.
  • Push-diff secret scan before push — exit 0; PUSH_SECRET_FINDINGS=0.
  • git push origin HEAD:fix/ope2-00280-agent-skill-sync — exit 0.
  • GitHub readback — exit 0; PR head 34b3fed9d9c073bdf892e9a293c2cca67eaa8883, open, non-draft, mergeable.

Blocking P0/P1 findings: none remain. The prior P1 was fixed and the affected shared-writer lanes are green.

Non-blocking follow-ups: none from the focused remediation scope.

@andrei-hasna
andrei-hasna merged commit d1ad827 into main Aug 9, 2026
2 checks passed
@andrei-hasna
andrei-hasna deleted the fix/ope2-00280-agent-skill-sync branch August 9, 2026 10:35
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