Repository navigation
Conversation
Agents pass every skill they loaded to --skills-invoked, not only Databricks ones, so third-party and customer-written skill names were reaching our usage logs. Drop any name that is not on an allowlist of every skill Databricks has published (current and retired names from databricks-agent-skills, plus databricks-quickstart). A prefix check isn't enough: customers name their own skills databricks-<something> too. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
There was a problem hiding this comment.
Automated review at b204236. Each finding was verified against the code.
No blocking issues found. 2 non-blocking comment(s) below.
This PR limits the experimental skill/<name> user agent pairs to a hand-kept list of published Databricks skill names, so names of third-party or customer skills are dropped instead of sent. The filtering does what it says, and flag precedence, dedup, the byte budget and the telemetry opt-out still work. Two smaller things remain. The invalid-entry branch still writes the raw name to the debug log, which goes against the "not logged" intent. And because the pattern and length checks now run only for test-injected names, the tests for them pass even with those checks removed.
| @@ -63,6 +64,9 @@ func parseSkills(ctx context.Context, raw string) []string { | |||
| case name == "": | |||
| case len(name) > maxSkillLength || !skillNamePattern().MatchString(name): | |||
| log.Debugf(ctx, "dropping invalid skill entry %q", entry) | |||
There was a problem hiding this comment.
[nice to have] The pattern/length check runs before isKnownSkill, and this branch still logs the raw entry with %q. So a customer skill like DATABRICKS_SKILLS_INVOKED='Acme Payroll Reconciler' (spaces) or acme:payroll-agent ends up verbatim in --log-level debug / --log-file output, which is what the new comment on line 68 says must not happen. Every known name already passes the pattern (TestKnownSkillsAreValid checks this), so can we check !isKnownSkill(name) first, or drop entry from this message?
| // 64-, 64-, 64- and 22-byte pairs make 214 bytes, so " skill/abcd" (11) | ||
| // lands exactly on 225 and nothing more fits. | ||
| exact := []string{strings.Repeat("a", 57), strings.Repeat("b", 57), strings.Repeat("c", 57), "databricks-core", "abcd"} | ||
| root.AllowSkillsForTest(t, slices.Concat(sixTooMany, exact, |
There was a problem hiding this comment.
[nice to have] With the allowlist in place, the cases "drops disallowed skill-name characters" (bad name, a:b, ...), "drops leading punctuation" (-a, .b, _c) and "drops entry longer than 64 bytes" use names that aren't on the allowlist. They would still pass if maxSkillLength or skillNamePattern were removed. In production, those checks only decide which debug message an unknown name gets. Could you add those exact names to AllowSkillsForTest so the pattern and length checks are what drop them? Or, if the allowlist alone is meant to decide, drop the runtime checks and rely on TestKnownSkillsAreValid.
Regression test report ✅Commit: Selected 1 changed tests (limit=20, 0 not selected) 1 tests: regression=1 unreleased=0 coverage=0 failing=0
TestAccept/cmd/skills-invoked: branch ✅ | main (901da84) ❌ | latest (v1.28.0) ❌main (901da84): latest (v1.28.0): |
✅ Integration test reportCommit: c6157ac
Top 6 slowest tests (at least 2 minutes):
|
simonfaltum
left a comment
There was a problem hiding this comment.
🤖 Automated review from simonfaltum's review agent (pr-review skill) at b204236. Each finding was verified against the code; simonfaltum may follow up.
No blocking issues found, approving.
This PR limits the experimental skill/ user agent pairs to a fixed list of Databricks-published skill names, so third-party and customer skill names are no longer sent. The list covers every skill currently in databricks-agent-skills, and the filtering, flag precedence, dedup and byte budget all behave correctly. CI is green. Only the two non-blocking points already raised in open threads remain: the raw entry in the invalid-entry debug log, and pattern/length tests that the allowlist now short-circuits.
Accepted answers
- Hand-kept list drifts from published skills
Agreeing with existing threads
- [nice to have] Invalid-entry debug log still prints the raw skill name: #8118 (comment)
- [nice to have] Pattern and length tests no longer exercise those checks: #8118 (comment)
A name that is not in the static list is checked against the skills release compiled into the binary, so new skills are reported without editing the list. The lookup starts only when a name misses the static list, runs once per process, and a parseSkills call waits at most 5ms for it in total. A name that has no match by then is dropped. Only the bundled snapshot is read: no network call, and not DATABRICKS_SKILLS_DIR, which can point at a customer's own skills. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
simonfaltum
left a comment
There was a problem hiding this comment.
🤖 Automated review from simonfaltum's review agent (pr-review skill) at c6157ac. Each finding was verified against the code; simonfaltum may follow up.
No blocking issues found, approving. 5 non-blocking comment(s) and 1 question(s) below.
This PR limits the experimental skill/ user agent pairs to published Databricks skill names: a static list, plus the names in the bundled skills snapshot behind a 5ms deadline. Rejected names are no longer logged. The filtering is correct, the static list covers every skill currently in databricks-agent-skills, and CI is green. What's left is non-blocking: one open question about whether the async released-skills lookup should wait for #8075 or become a synchronous read, a comment that overstates what the lookup does today, and a few test and style nits.
Questions
- The released-skills lookup (goroutine, done channel, shared 5ms deadline, skipLookup, timeout test hook) can't match anything until #8075 fills the bundled snapshot, and #8075 is still open. Once the snapshot is filled, the lookup only parses an embedded manifest, with no I/O. With a fixed 5ms deadline, a skill that is only in the release gets reported on some runs and dropped on others when the machine is loaded. Could this part move into #8075? Or could the snapshot be read synchronously once per process (for example
sync.OnceValues(loadBundledSkillNames))? That would be deterministic and still lazy. (non-blocking)
Comments outside the changed lines
- [nit]
.github/PULL_REQUEST_TEMPLATE.md:.agents/skills/pr-checklist/SKILL.mdasks for the template sections## Changes,## Why,## Testsin that order, and for the agent disclosure as a single italicized last line. The description puts## Whybefore## Changes, and the disclosure line is not italicized. Reorder the sections and italicize the disclosure.
Agreeing with existing threads
- [nice to have] Pattern and length test cases pass without the pattern and length checks: #8118 (comment)
| // A skill that is not listed here is still reported when it is in the skills | ||
| // release bundled with the binary (see releasedSkills), so new skills need no |
There was a problem hiding this comment.
[nice to have] This comment says a skill missing from knownSkills is still reported through the bundled release, "so new skills need no edit here". The loadBundledSkillNames comment also says the release build fills the snapshot. Today libs/skills/snapshot/manifest.json is {"skills": {}} and #8075 is still open. So the lookup always returns ErrSourceUnreachable, and every binary drops a skill published after this list. A maintainer who trusts this comment won't add the new name. Could you say that this depends on the release build filling the snapshot (#8075), and that new skills must be added here until then?
| // Static matches still go through; the slow lookup only drops the rest. | ||
| assert.Equal(t, []string{"databricks-core"}, got) | ||
| // Both unmatched names share one deadline, so the wait is not doubled. | ||
| assert.Less(t, elapsed, 500*time.Millisecond) |
There was a problem hiding this comment.
[nit] The comment says both unmatched names share one deadline, so the wait is not doubled. But with a 5ms timeout and elapsed < 500ms, a per-name deadline (10ms total) still passes. Use a longer timeout, such as 100ms, and assert below twice that value, such as < 190ms, so the test fails if each name gets its own deadline.
| log.Debugf(ctx, "dropping invalid skill entry %q", entry) | ||
| // Don't log the entry: it may be a customer's own skill name. | ||
| log.Debugf(ctx, "dropping invalid skill entry") | ||
| case !matcher.isKnown(ctx, name): |
There was a problem hiding this comment.
[nit] !matcher.isKnown runs before slices.Contains(skills, name) and the size check. If the 225-byte budget is already full, a later unknown name still starts the released-skills lookup and can wait up to releasedSkillsTimeout, even though it could never be added. Only known names are ever appended, so moving the dedup and budget cases above isKnown gives the same result without the wait.
| // newSkillMatcher returns a matcher for one parseSkills call. The deadline | ||
| // starts at the first name that is not in knownSkills and is shared by every | ||
| // later name, so a slow lookup costs at most releasedSkillsTimeout in total. | ||
| func newSkillMatcher() *skillMatcher { |
There was a problem hiding this comment.
[nit] newSkillMatcher only returns &skillMatcher{}, but its doc comment describes the deadline behaviour, which isKnown implements. Use &skillMatcher{} directly, or keep the constructor, and move the deadline comment onto isKnown, where a reader will look for it.
Why
The experimental
skill/<name>user agent pairs (#7730, #7783) report whatever the agent passes to--skills-invoked/DATABRICKS_SKILLS_INVOKED. Agents pass every skill they loaded, not only Databricks ones, so the CLI can end up sending the names of third-party or user-written skills. We only want to report Databricks skills.A
databricks-prefix check isn't enough, because users name their own skills that way too.Changes
A name is reported only if it matches one of two lists. Anything else is dropped, and the dropped name isn't logged.
knownSkills). Every skill name in the history ofdatabricks/databricks-agent-skills, including renamed and retired names (databricks→databricks-core,databricks-bundles→databricks-dabs, ...), plusdatabricks-quickstart. The retired names have to stay here, because no current release lists them.libs/skillsNewBundledSource). Once Fill the bundled skills snapshot when release binaries are built #8075 fills the snapshot at release build time, new skills are reported with no edit to the static list.The bundled lookup:
parseSkillscall waits at most 5ms for it in total, shared across all names. A name with no match by then is dropped silently. With a filled snapshot, the read takes about 0.2ms.DATABRICKS_SKILLS_DIReither, because that can point at a folder of the user's own skills.Development builds have an empty snapshot, so they fall back to the static list alone.
Possible follow-up: once the disk cache in #8076 lands, its newest catalog could be added as a third source. That would cover skills released between CLI releases for users who have run a
databricks skillscommand. The cache is already disabled whenDATABRICKS_SKILLS_REForDATABRICKS_SKILLS_BASE_URLis set, so it only ever holds official releases.Tests
databricks-prefix. Every static name survives. A name only in the released skills is reported. A slow lookup drops the unmatched names within the deadline while static matches still go through. Static matches never start the lookup. All run with-race.acceptance/cmd/skills-invoked, and moved the existing flag-vs-env case to real skill names.This pull request and its description were written by Isaac.