Skip to content

fix(install): restore well-known sources from resolved state #8

Closed

Description

@showxu

Summary

A well-known source can be installed with skill add and recorded in skills.resolved, but skill install cannot restore it.

Code evidence at b742a9978519431ad06678047039d5:

  • Sources/Core/ProcessRunner.swift:358–369 fetches and materializes well-known sources.
  • Sources/Core/Installer.swift:31–46 records source kind "wellKnown".
  • Sources/Core/RuntimeService.swift:1278–1333 restores only localFileSystem and remoteSourceControl; all other kinds throw "cannot restore source kind ".
  • Sources/Core/RuntimeService.swift:609–610 uses the same helper for ordinary update.

Impact: a supported source type has no restore path. One such pin also interrupts the install loop, potentially preventing later pins from being restored.

Reproduction

Proposed steps; not executed for this report.

  1. Create temporary site and project directories.

  2. Put this file at site/SKILL.md:

    ---
    name: demo
    description: Well-known restore fixture
    ---
    # Demo
  3. Serve only the temporary site directory on an unused loopback port, for example in a separate terminal:

    python3 -m http.server 8765 --bind 127.0.0.1 --directory <temporary-site>
  4. From the temporary project directory:

    skill add http://127.0.0.1:8765/SKILL.md \
      --scope project --agent codex --mode copy
    cat .agent/skills.resolved
  5. Confirm the pin has kind "wellKnown".

  6. Move .agents/skills/demo to a backup directory within the temporary root, retaining the source cache.

  7. Run:

    skill install --scope project

The direct SKILL.md URL follows the well-known provider path. Indexed and archive well-known sources produce the same source kind.

Expected Behavior

install restores the recorded well-known skill and verifies the recorded content/digest. It must not silently replace a pinned artifact with changed upstream content.

Completion checks:

  • Restore with a retained cache and with a cold cache.
  • Cover direct SKILL.md, supported index formats, and digest-verified archives.
  • Changed or unavailable pinned content produces an actionable error.
  • An otherwise valid well-known pin is not rejected merely because of its source kind.
  • Run swift test.

Actual Behavior

The restore switch throws:

cannot restore source kind wellKnown

The failure occurs even when the materialized source remains in the cache. Ordinary update reaches the same unsupported branch.

No duplicate issue or fixing PR was found. Issue #4 is unrelated.

Environment

  • skill version: 0.2.1.
  • Source inspected: b742a99; affected source matches v0.2.1.
  • Swift version: not obtained in the read-only sandbox.
  • OS: macOS 27.0.1 (26A434).
  • Architecture: arm64.
  • Validation: static inspection only; reproduction not executed.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions