Skip to content

Make templates fully harness-agnostic: model aliases, deprecate image/auth#276

Merged
ptone merged 5 commits into
GoogleCloudPlatform:mainfrom
ptone:cleanup/templates-harness-agnostic
May 31, 2026
Merged

Make templates fully harness-agnostic: model aliases, deprecate image/auth#276
ptone merged 5 commits into
GoogleCloudPlatform:mainfrom
ptone:cleanup/templates-harness-agnostic

Conversation

@ptone
Copy link
Copy Markdown
Member

@ptone ptone commented May 31, 2026

Summary

Templates should be strictly harness-agnostic — they define the agent's role, not its execution mechanics. This PR:

  • Adds model size aliases (small, medium, large) to harness-configs, resolved to concrete model names at provision time. Templates can use model: large instead of model: opus, making them portable across Claude, Gemini, and other backends.
  • Deprecates harness-specific fields (image, auth_selectedType, concrete model names) in scion-agent.yaml with warnings, guiding users to move these to harness-config config.yaml.
  • Updates documentation (templates.md) to clarify the template/harness-config boundary and document model aliases.

Closes ptone#98. Implements the model alias portion of #42.

Changes

  • pkg/config/settings_v1.go: Add ModelAliases to HarnessConfigEntry
  • pkg/config/templates.go: Add ResolveModelAlias(), WarnDeprecatedTemplateFields(), KnownModelAliases
  • pkg/agent/provision.go: Wire alias resolution and deprecation warnings into provisioning flow
  • pkg/config/schemas/agent-v1.schema.json: Mark image, auth_selectedType as deprecated; update model description
  • pkg/config/schemas/settings-v1.schema.json: Add model_aliases property to harness config schema
  • pkg/hubclient/types.go, pkg/store/models.go: Add ModelAliases to HarnessConfigData
  • pkg/harness/*/embeds/config.yaml: Seed default model aliases for all harnesses
  • docs-site/src/content/docs/advanced-local/templates.md: Document model aliases, clarify harness-agnostic boundary

Backward Compatibility

  • Concrete model names in templates pass through unchanged
  • image and auth_selectedType still work as override values
  • No breaking changes to API types or persisted config

Test plan

  • Unit tests for ResolveModelAlias() — alias resolution, concrete passthrough, nil/empty handling
  • Unit tests for WarnDeprecatedTemplateFields() — all deprecated field combinations
  • Unit tests for KnownModelAliases — canonical alias set validation
  • Existing template and merge tests pass
  • go vet and go build pass

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request makes templates harness-agnostic by deprecating harness-specific fields (such as image, auth_selectedType, and concrete model names) in the agent configuration and introducing abstract model size aliases (small, medium, large). These aliases are mapped to concrete models within the harness configuration and resolved during agent provisioning. The feedback suggests adding a defensive nil check to WarnDeprecatedTemplateFields to prevent potential nil-pointer dereference panics.

Comment thread pkg/config/templates.go
Comment on lines +635 to +636
func WarnDeprecatedTemplateFields(cfg *api.ScionConfig) []string {
var warnings []string
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

To prevent potential nil-pointer dereference panics, add a defensive nil check at the beginning of WarnDeprecatedTemplateFields.

Suggested change
func WarnDeprecatedTemplateFields(cfg *api.ScionConfig) []string {
var warnings []string
func WarnDeprecatedTemplateFields(cfg *api.ScionConfig) []string {
if cfg == nil {
return nil
}
var warnings []string

scion-gteam Bot pushed a commit to ptone/scion that referenced this pull request May 31, 2026
Adds a defensive nil check at the start of WarnDeprecatedTemplateFields
to prevent nil-pointer dereference panics when called with a nil config.

Addresses review feedback on PR GoogleCloudPlatform#276.
ptone added 5 commits May 31, 2026 11:25
Templates should be strictly harness-agnostic. This change:

- Adds ModelAliases (small/medium/large) to HarnessConfigEntry so each
  harness-config can map abstract sizes to concrete model names
- Adds ResolveModelAlias() to resolve aliases at provision time
- Adds WarnDeprecatedTemplateFields() to warn when templates use
  image, auth_selectedType, or concrete model names
- Marks image and auth_selectedType as deprecated in agent-v1 schema
- Updates model field description to recommend size aliases
- Adds model_aliases to settings-v1 schema
- Seeds default model_aliases in all harness embeds (claude, gemini,
  opencode, codex)
- Wires alias resolution and deprecation warnings into ProvisionAgent

Concrete model names in templates still work (pass-through) for
backward compatibility. Refs #98, relates to #42.
… boundary

- Add note that image/model/auth belong in harness-config, not templates
- Add "Model Size Aliases" section explaining small/medium/large aliases
- Update harness-config customization example to show alias mapping

Refs #98
Tests cover:
- ResolveModelAlias: alias resolution, concrete passthrough, nil/empty
  handling, unmapped aliases
- WarnDeprecatedTemplateFields: clean templates, size alias models,
  deprecated image/auth/concrete-model fields
- KnownModelAliases: validates the canonical alias set

Refs #98
Adds a defensive nil check at the start of WarnDeprecatedTemplateFields
to prevent nil-pointer dereference panics when called with a nil config.

Addresses review feedback on PR GoogleCloudPlatform#276.
@ptone ptone force-pushed the cleanup/templates-harness-agnostic branch from eeba480 to 5795020 Compare May 31, 2026 18:25
@ptone ptone merged commit 0e7dbef into GoogleCloudPlatform:main May 31, 2026
@scion-gteam scion-gteam Bot deleted the cleanup/templates-harness-agnostic branch May 31, 2026 18:29
krohnjw pushed a commit to ParkWhiz/scion that referenced this pull request Jun 3, 2026
…/auth (GoogleCloudPlatform#276)

* Add model size aliases and deprecate harness-specific template fields

Templates should be strictly harness-agnostic. This change:

- Adds ModelAliases (small/medium/large) to HarnessConfigEntry so each
  harness-config can map abstract sizes to concrete model names
- Adds ResolveModelAlias() to resolve aliases at provision time
- Adds WarnDeprecatedTemplateFields() to warn when templates use
  image, auth_selectedType, or concrete model names
- Marks image and auth_selectedType as deprecated in agent-v1 schema
- Updates model field description to recommend size aliases
- Adds model_aliases to settings-v1 schema
- Seeds default model_aliases in all harness embeds (claude, gemini,
  opencode, codex)
- Wires alias resolution and deprecation warnings into ProvisionAgent

Concrete model names in templates still work (pass-through) for
backward compatibility. Refs GoogleCloudPlatform#98, relates to GoogleCloudPlatform#42.

* Update templates.md: document model aliases, clarify harness-agnostic boundary

- Add note that image/model/auth belong in harness-config, not templates
- Add "Model Size Aliases" section explaining small/medium/large aliases
- Update harness-config customization example to show alias mapping

Refs GoogleCloudPlatform#98

* Add tests for model alias resolution and deprecation warnings

Tests cover:
- ResolveModelAlias: alias resolution, concrete passthrough, nil/empty
  handling, unmapped aliases
- WarnDeprecatedTemplateFields: clean templates, size alias models,
  deprecated image/auth/concrete-model fields
- KnownModelAliases: validates the canonical alias set

Refs GoogleCloudPlatform#98

* Add project log for templates harness-agnostic cleanup

* Add nil guard to WarnDeprecatedTemplateFields

Adds a defensive nil check at the start of WarnDeprecatedTemplateFields
to prevent nil-pointer dereference panics when called with a nil config.

Addresses review feedback on PR GoogleCloudPlatform#276.
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.

Make templates fully harness-agnostic: move image/model/auth to harness-config

1 participant