Skip to content

feat(skills): pin a third-party skill with a source and a ledger that outranks the approvals file (#600) - #880

Merged
ajianaz merged 1 commit into
developfrom
feat/600-skills-pin
Nov 16, 2026
Merged

ajianaz merged 1 commit into
developfrom
feat/600-skills-pin

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

What

Slice 3a of #600: third-party skills are pinned by approved hash with a stated source, and every skill approve, revoke and draft promotion is recorded in a new append-only ledger that outranks the approvals file. tole plugin audit follows as slice 3b.

Why

A skill is followed, so the trust anchor is the owner's approval of exact bytes (skills design 4.2). The approvals file was a plain replaceable JSON with no history: a hand-edited file could bring back a skill the owner revoked, and nothing recorded where a third-party skill came from. The plugin side already has an append-only ledger that wins over the lock; this gives skills the same discipline. The MCP Registry namespace check is skipped by the owner, and the uteke registry fetch is not built (see #878): the source is recorded as data only.

Changes

  • tole skills approve takes --source-url, --registry-id and --pinned-sha (40 or 64 lowercase hex). Validated for shape, stored in the approval and the ledger, never fetched or verified.
  • New append-only skill-ledger.jsonl next to skill-approvals.json. approve, revoke and draft promotion/revoke append before the approvals file is written, so a crash leaves a skill unapproved, never approved without a record.
  • At load, an approval whose last ledger line is a revoke, or whose hash differs from the ledger's, is ignored with a note. An approval the ledger never names still loads and is reported once as unrecorded. An unreadable or over-16-MiB ledger fails startup with a remedy. A ledger torn mid-line is repaired by the next append. Ledger text in notes is flattened to one line.
  • tole skills revoke and tole skills drafts revoke are now owner-only (both added to the owner-only e2e).
  • Residual, stated in the docs: deleting the ledger makes every approval unrecorded and forgets every revoke; a process that can rewrite both files is not stopped (same as the plugin ledger). Ledger gaps are tracked in hardening(skills): skill ledger gaps — deleting the ledger forgets revokes, adopt pre-ledger approvals, embedders skip the ledger #879.
  • API note: the public tole_core::skill_approval::Approval gains a source field (external struct literals must add it). Approvals::approve is unchanged; new pub items are Source, ledger_line, read_ledger, check_against_ledger, ledger_history, LedgerCheck, LEDGER_FILE, MAX_LEDGER_BYTES and Approvals::approve_from.
  • Impact by grep: Approval is only constructed in Approvals::approve_from; SkillsAction::Approve has no other match site; draft promotion and draft revoke (skill/drafts.rs) also write approvals and would have been blocked by the ledger, so they now append ledger lines.
  • Docs: README, CHANGELOG, docs/epics.md and a new section in docs/third-party-plugins-design.md.

Testing

  • Fail-first (neuter, see fail, restore): dropping the ledger check in load_checked fails a_hand_edited_approvals_file_cannot_undo_a_ledger_revoke; disabling the torn-tail repair and the unrecorded note each fail unrecorded_approvals_are_reported_a_torn_tail_is_repaired_and_notes_stay_one_line; removing the two revoke guards fails owner_only_subcommands_refuse_under_a_session_and_write_nothing; skipping the ledger write on draft promotion fails revoke_rejects_pending_drafts_and_withdraws_what_was_promoted.
  • Real-binary e2e: a_pinned_skill_keeps_its_source_and_the_ledger_outranks_the_approvals_file approves with a source, checks the ledger has no skill text, runs with the skill, swaps SKILL.md and sees it refused, revokes, restores the approvals file by hand and sees it still refused, and checks the ledger is exactly two lines.
  • fmt, clippy -D warnings (workspace all features; core, cli and tui --no-default-features; cli shell-tools-only), cargo check -p tole-core --no-default-features --tests, and cargo test with TOLE_REQUIRE_BWRAP=1 --no-fail-fast in default, --no-default-features and shell-tools-only profiles: green. The skill:: tests were re-run in all three profiles after one last test-only fix.
  • A pre-PR independent agent review reported NO BLOCKER and ran the full tole-core and tole-cli suites, skill_approval_e2e, owner_only_e2e and cargo check -p tole-core --no-default-features --tests itself: all green. CI: all checks green and Cora Review "No issues found" on the final head; the one failure seen (no-mcp profile, delegation::delegate::tests::a_child_with_a_complete_report_settles_done_and_the_parent_sees_it_fenced, delegation code this PR does not touch) passed on re-run.
  • cora is not installed here; the CI Cora review is the gate. The attribution grep over the branch commits prints nothing.
  • Not built: fetching skills from the uteke registry (feat(skills): fetch a third-party skill from the uteke registry at a pinned SHA #878). tole plugin audit follows as slice 3b.

…nd-only ledger

tole skills approve takes --source-url, --registry-id and --pinned-sha,
recorded as data only. Skill approve, revoke and draft promotion are
appended to skill-ledger.jsonl before the approvals file; an approval the
ledger contradicts is ignored at load, unrecorded approvals are reported
once, an unreadable ledger fails startup, and a torn tail is repaired.
tole skills revoke and tole skills drafts revoke are owner-only.

Refs #600
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit ba88e7d into develop Nov 16, 2026
33 of 34 checks passed
ajianaz added a commit that referenced this pull request Nov 17, 2026
…n the shared delegate dir at exit (#702)

`delegation::delegate::tests::a_child_with_a_complete_report_settles_done_and_the_parent_sees_it_fenced` failed once on CI (PR #880, `no-mcp profile`): the stand-in child wrote `env > file` in place, a CI runner's environment is over 4 KiB so `env` wrote it in several chunks, and the test read a prefix. fake_reporter and the discussion reviewer_bin now write argv and env to a temporary name and rename them into place, as fake_tole already did (#828). The tole-cli lib tests also leave a shared-delegate-data-<pid>-<hex> directory per run; an atexit hook now removes the process's own directory (the start-up sweep stays for killed runs).

The failure could not be reproduced locally; the fix rests on the CI log and code reading. Tests only; no production code changed. #712 and #738 were not reproduced in 100 to 300 stress runs and are left alone.

Refs #702, #712, #738.
@ajianaz
ajianaz deleted the feat/600-skills-pin branch November 20, 2026 08: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.

2 participants