Skip to content

fix(lock): reject unreadable resolved files before writing - #12

Merged
showxu merged 1 commit into
masterfrom
fix/issue-5-reject-unreadable-lock
Oct 17, 2026
Merged

showxu merged 1 commit into
masterfrom
fix/issue-5-reject-unreadable-lock

Conversation

@showxu

@showxu showxu commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Summary

An existing skills.resolved that could not be decoded was treated as empty state. The next successful add overwrote it and lost every previous pin, and read commands hid the problem (skill list printed "No project skills found" and exited 0).

Now:

  • Loading an existing resolved file that cannot be decoded (invalid JSON, wrong schema, version below 1) throws Invalid state: resolved file <path> could not be decoded. The file is never replaced. Legacy-schema content at the current path still decodes; when the current file exists the legacy file is not read.
  • Every mutating path validates the selected scope's resolved state before changing installed files, the resolved file or the watch ledger: add (including --watch and --watch-only), install, update --apply, update --from-watch --apply and remove.
  • skill list and skill list --all exit non-zero with the decode error. skill doctor reports resolved-file as error with ok: false and a repair hint.
  • A source's own .agent/skills.resolved, which discovery uses only to skip installed copies inside the source, is a hint: if it cannot be decoded, discovery ignores it, so skill add <source> and skill list <source> keep working for third-party repositories.

Validation

  • swift build — pass
  • swift test — 127 tests in 17 suites pass
  • xcrun swift-format lint --configuration .swift-format --recursive Package.swift Sources Tests — exit 0, no new warnings in changed files
  • git diff --check — clean
  • Manual checks with an isolated HOME: with a corrupted project resolved file, list, add, add . --watch-only, remove, install and update --apply fail, nothing is installed or removed, no watch ledger is created and the file stays byte-identical; with valid project state, add/list from a source whose own resolved file is corrupted succeed.

Resolves #5

Reject undecodable resolved files before changing installed files, preserve their contents on failure, and surface invalid state in listing and diagnostic reports while retaining supported legacy decoding and deterministic output.

Resolves #5
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T07:37:01.554702Z 5b43976 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

fix(lock): reject unreadable resolved schemas before overwriting existing pins

1 participant