Skip to content

[skills] Record the workspace org id in downloaded-skill attribution - #586

Open
xsh310 wants to merge 1 commit into
skills-download-removefrom
skills-download-workspace-id
Open

xsh310 wants to merge 1 commit into
skills-download-removefrom
skills-download-workspace-id

Conversation

@xsh310

@xsh310 xsh310 commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator

What

Record the numeric workspace (org) id as workspace_id on each downloaded-skill
attribution record. Final PR of the attribution work, on top of #585.

Why

The record already stores the workspace URL, but a URL can change (workspace
rename / vanity host). The numeric org id is a stable, rename-proof workspace
identifier, so attribution keeps both. It costs nothing extra to capture:
Databricks stamps every authenticated response with an X-Databricks-Org-Id
header, and the download already makes those calls.

Changes

  • databricks.py: the HTTP GET helpers capture X-Databricks-Org-Id into a
    session cache keyed by hostname (mirroring the existing model-service listing
    caches); workspace_org_id(workspace) reads it back, and a cache-clear hook is
    wired into the test isolation fixture. No extra request is made.
  • skills_state.py / skills_download.py: SkillInstall carries workspace_id,
    set from workspace_org_id when a record is written. metastore_id remains the
    logical key; the field is omitted when no response has revealed the id yet.

Testing

uv run ruff check, ruff format --check, ty check src, and uv run pytest all
pass (the pre-existing test_e2e_user_agent / test_claude_smart_routing_v2
failures also fail on the base). Added coverage that the GET helper captures the
header (and tolerates its absence), and that a download records workspace_id
when the id is known and omits it when it is not.

Stack

Part of gh stack #576, on top of #585 (skills-download-remove).

This pull request and its description were written by Isaac.

@xsh310
xsh310 added this pull request to stack #576 September 12, 2026 23:38
@xsh310
xsh310 marked this pull request as ready for review September 12, 2026 23:54
@xsh310
xsh310 force-pushed the skills-download-workspace-id branch from d60d990 to 06754e9 Compare September 13, 2026 00:22
@xsh310
xsh310 marked this pull request as draft September 13, 2026 00:23
@xsh310
xsh310 force-pushed the skills-download-workspace-id branch from 06754e9 to f81ee7c Compare September 13, 2026 00:46
@xsh310
xsh310 force-pushed the skills-download-workspace-id branch from f81ee7c to 01c0c00 Compare September 13, 2026 01:04
@xsh310
xsh310 marked this pull request as ready for review September 13, 2026 01:10
@xsh310
xsh310 force-pushed the skills-download-workspace-id branch from 01c0c00 to acb868b Compare September 14, 2026 03:08
@xsh310
xsh310 force-pushed the skills-download-workspace-id branch from acb868b to b3e9c45 Compare September 14, 2026 20:09
Comment thread src/ucode/skills_state.py
base: str
dirs: tuple[str, ...]
metastore_id: str | None = None
workspace_id: str | None = None

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: workspace_id is now recorded, but the install identity key (_record_key(metastore_id, fqn, base)) doesn't include it, and the SkillInstall docstring still describes the key without it. When metastore_id is None (older/edge records), two skills with the same fqn at the same base from different workspaces collide on reconcile and one overwrites the other. Either fold workspace_id into the identity key or update the docstring to state it's descriptive-only.

@xsh310
xsh310 force-pushed the skills-download-workspace-id branch from b3e9c45 to b5dcb72 Compare September 14, 2026 22:32
@xsh310
xsh310 force-pushed the skills-download-workspace-id branch from b5dcb72 to 857e523 Compare September 14, 2026 23:20
@xsh310
xsh310 force-pushed the skills-download-workspace-id branch from 857e523 to 5166600 Compare September 15, 2026 01:41
@xsh310
xsh310 force-pushed the skills-download-workspace-id branch from 5166600 to 0ea62b1 Compare September 15, 2026 03:40
Capture the numeric workspace (org) id and store it as `workspace_id` on each
downloaded-skill record, giving attribution a rename-proof workspace identifier
alongside the workspace URL. Databricks stamps every authenticated response with
an `X-Databricks-Org-Id` header, so the download's existing API calls already
carry it; the HTTP GET helpers now capture it into a session cache (keyed by
hostname, mirroring the model-service listing caches) with no extra request. A
record omits the field when no response has revealed the id yet.

Co-authored-by: Isaac <no-reply@databricks.com>
@xsh310
xsh310 force-pushed the skills-download-workspace-id branch from 0ea62b1 to bf8e153 Compare September 15, 2026 04:42
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