@@ -33,17 +33,18 @@ const (
3333// It is a package-level var so tests can replace it with a mock.
3434var fetchFileFn = fetchSkillFile
3535
36- // GetSkillsRef returns the skills repo ref to use.
36+ // GetSkillsRef returns the skills repo ref to use and whether it was explicitly
37+ // set via DATABRICKS_SKILLS_REF (as opposed to auto-resolved from the manifest).
3738// Resolution order: DATABRICKS_SKILLS_REF env var → compatibility manifest → error.
38- func GetSkillsRef (ctx context.Context ) (string , error ) {
39+ func GetSkillsRef (ctx context.Context ) (ref string , explicit bool , err error ) {
3940 if ref := env .Get (ctx , "DATABRICKS_SKILLS_REF" ); ref != "" {
40- return ref , nil
41+ return ref , true , nil
4142 }
4243 v , err := clicompat .ResolveAgentSkillsVersion (ctx )
4344 if err != nil {
44- return "" , fmt .Errorf ("could not resolve skills version: %w" , err )
45+ return "" , false , fmt .Errorf ("could not resolve skills version: %w" , err )
4546 }
46- return "v" + v , nil
47+ return "v" + v , false , nil
4748}
4849
4950// Manifest describes the skills manifest fetched from the skills repo.
@@ -97,10 +98,10 @@ func fetchSkillFile(ctx context.Context, ref, skillName, filePath string) ([]byt
9798// If the ref points to a non-existent tag (not-found error), it falls back to
9899// the embedded manifest's skills version. Returns the manifest, the (possibly
99100// updated) ref, and any error.
100- func FetchSkillsManifestWithFallback (ctx context.Context , src ManifestSource , ref string ) (* Manifest , string , error ) {
101+ func FetchSkillsManifestWithFallback (ctx context.Context , src ManifestSource , ref string , allowFallback bool ) (* Manifest , string , error ) {
101102 tag := strings .TrimPrefix (ref , "v" )
102103 manifest , err := src .FetchManifest (ctx , ref )
103- if err != nil && clicompat .IsNotFoundError (err ) {
104+ if err != nil && allowFallback && clicompat .IsNotFoundError (err ) {
104105 fallbackVersion , fbErr := clicompat .ResolveEmbeddedAgentSkillsVersion ()
105106 if fbErr == nil && fallbackVersion != "" && fallbackVersion != tag {
106107 log .Warnf (ctx , "Skills version %s not found, falling back to embedded version %s" , tag , fallbackVersion )
@@ -117,12 +118,12 @@ func FetchSkillsManifestWithFallback(ctx context.Context, src ManifestSource, re
117118// This is the core installation function. Callers are responsible for agent detection,
118119// prompting, and printing the "Installing..." header.
119120func InstallSkillsForAgents (ctx context.Context , src ManifestSource , targetAgents []* agents.Agent , opts InstallOptions ) error {
120- ref , err := GetSkillsRef (ctx )
121+ ref , explicit , err := GetSkillsRef (ctx )
121122 if err != nil {
122123 return err
123124 }
124125 cmdio .LogString (ctx , "Using skills version " + strings .TrimPrefix (ref , "v" ))
125- manifest , ref , err := FetchSkillsManifestWithFallback (ctx , src , ref )
126+ manifest , ref , err := FetchSkillsManifestWithFallback (ctx , src , ref , ! explicit )
126127 if err != nil {
127128 return err
128129 }
0 commit comments