Conversation
xsh310
added this pull request to stack #576
September 12, 2026 18:01
xsh310
commented
Sep 12, 2026
xsh310
commented
Sep 12, 2026
xsh310
force-pushed
the
skills-download-attribution
branch
from
September 12, 2026 18:21
8a9dc5e to
edc3e41
Compare
xsh310
marked this pull request as ready for review
September 12, 2026 19:25
xsh310
force-pushed
the
skills-download-attribution
branch
from
September 13, 2026 00:22
edc3e41 to
909f2e0
Compare
xsh310
marked this pull request as draft
September 13, 2026 00:23
xsh310
force-pushed
the
skills-download-attribution
branch
2 times, most recently
from
September 13, 2026 01:04
537a36c to
4753d1c
Compare
xsh310
marked this pull request as ready for review
September 13, 2026 01:10
xsh310
force-pushed
the
skills-download-attribution
branch
from
September 14, 2026 03:08
4753d1c to
5321bb1
Compare
xsh310
force-pushed
the
skills-download-attribution
branch
from
September 14, 2026 20:09
5321bb1 to
5c975fd
Compare
| return kept | ||
|
|
||
|
|
||
| def record_downloads(installs: list[SkillInstall]) -> None: |
Collaborator
There was a problem hiding this comment.
P2: the manifest is a read-modify-write (_load → mutate → _save) with no locking. Two concurrent ucode invocations (e.g. a download in one shell, a remove in another) can interleave so the second clobbers the first's update — a just-recorded skill silently vanishes from attribution. atomic_write_json keeps the file well-formed but doesn't prevent the lost update. Rare in practice; worth a file lock or a re-read-before-write if concurrent runs are plausible.
xsh310
force-pushed
the
skills-download-attribution
branch
from
September 14, 2026 22:32
5c975fd to
91e6254
Compare
xsh310
force-pushed
the
skills-download-attribution
branch
from
September 14, 2026 23:20
91e6254 to
41caa3f
Compare
xsh310
force-pushed
the
skills-download-attribution
branch
from
September 15, 2026 00:53
41caa3f to
e16350f
Compare
xsh310
force-pushed
the
skills-download-attribution
branch
from
September 15, 2026 01:17
e16350f to
4eff582
Compare
xsh310
force-pushed
the
skills-download-attribution
branch
from
September 15, 2026 01:41
4eff582 to
10176dd
Compare
xsh310
force-pushed
the
skills-download-attribution
branch
from
September 15, 2026 03:30
10176dd to
196a594
Compare
xsh310
force-pushed
the
skills-download-attribution
branch
from
September 15, 2026 03:40
196a594 to
ad4c659
Compare
xsh310
force-pushed
the
skills-download-attribution
branch
from
September 15, 2026 04:42
ad4c659 to
e89c0ed
Compare
Track which on-disk skill directories came from Unity Catalog, so ucode can tell a downloaded skill from a user-authored one and, later, remove downloads by their UC schema. A new skills_state module owns the manifest and its read/write/query/reconcile logic; the download flows record each skill after it reaches disk. SkillRef now also carries the metastore id, skill id, and UC update time, all read from the ListSkills/GetSkill response it already fetches. The manifest is written atomically (temp file + os.replace, via a new config_io.atomic_write_json), so a crash or concurrent writer can't truncate it. An unparseable manifest is quarantined (renamed aside) and warned rather than read as empty, so one bad byte can't let the next write silently erase every tracked skill. The file carries a schema version; cross-version handling beyond ignoring an unrecognized one is deferred until the schema first changes. Kept separate from state.json so a state-version change and ug revert leave it untouched. No user-facing command yet; ug skill remove wiring follows. Co-authored-by: Isaac <no-reply@databricks.com>
xsh310
force-pushed
the
skills-download-attribution
branch
from
September 15, 2026 14:43
e89c0ed to
d8c9073
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Track which on-disk skill directories ucode downloaded from Unity Catalog, in a
single manifest at
~/.ucode/skills.json, so ucode can tell a downloaded skillfrom a user-authored one and (in a later PR) remove downloads by their UC schema.
Skill attribution design doc:
https://doc-center-6051921418418893.staging.aws.databricksapps.com/d/hbzhsbid
Why
The download path kept no record of what it wrote or where it came from, so there
is no safe way to remove a downloaded skill without risking a same-named skill the
user authored themselves. This is the foundation (PR 1 of the attribution work): it
populates the manifest but adds no user-facing command yet.
Changes
skills_state.pyowns the manifest and its read/write/query/reconcile logic.Records are keyed by
(metastore_id, fqn, base); query helpers arelist_downloaded,attribution_for_dir,records_for_schema, andforget.record_downloadsreconciles superseded records on write: it drops the stalerecord for a directory just overwritten (keeping the freshly written files) and
deletes the orphaned old directory when the same skill's bundle name changed.
SkillRefnow also carriesmetastore_id,skill_id, anduc_update_time,read for free from the
ListSkills/GetSkillresponse ucode already fetches.download record each skill after it reaches disk.
Kept separate from
state.jsonso a state-version change andug revertleave ituntouched.
Testing
uv run ruff check,ruff format --check,ty check src, anduv run pytestallpass (the pre-existing
test_e2e_user_agent/test_claude_smart_routing_v2failures also fail on the base). New
tests/test_skills_state.pycovers the manifestround-trip, corrupt/version handling, the queries, and all three reconciliation
cases;
tests/test_skills_download.pygains coverage that a download recordsattribution and that
SkillRefcaptures the UC metadata.Stack
Part of gh stack #576, on top of #583 (
skills-picker-skills-fqn).This pull request and its description were written by Isaac.