Skip to content

config,server: add defaultProfile to select a profile at startup - #993

Open
sousekd wants to merge 1 commit into
mostlygeek:mainfrom
sousekd:open-pr/default-profile
Open

config,server: add defaultProfile to select a profile at startup#993
sousekd wants to merge 1 commit into
mostlygeek:mainfrom
sousekd:open-pr/default-profile

Conversation

@sousekd

@sousekd sousekd commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Closes #992

Profiles can only be activated at runtime through the UI or the API, so a restart or a configuration reload always lands on "no profile". Deployments that run unattended have no way to express which profile they want.

This adds an optional top-level defaultProfile naming a key under profiles:. It seeds the active profile when the server is built, so it applies on startup and on every configuration reload.

profiles:
  coding:
    pins:
      llm-code: "gpt-oss-120b"

defaultProfile: "coding"

Changes:

  • validate defaultProfile against the configured profiles at load time, as the last step of validateProfiles
  • seed Server.activeProfile from the config in New(), so the profile is active for the very first request and /v1/models reflects its pins
  • document the setting in config-schema.json, config.example.yaml, and docs/configuration.md
  • tests for the load path and for the seeded server

Behaviour notes:

  • omitting the setting or leaving it empty keeps the current behaviour, so existing configurations are unaffected
  • an unknown name fails the load with defaultProfile references unknown profile "..."
  • the runtime selection is still not persisted; switching in the UI lasts until the next restart or reload, and "None" remains selectable

The diff in server.go is one added struct field plus gofmt realignment.

AI disclosure: implemented by Opus.

Profiles can only be activated at runtime through the UI or the API, so a
restart or a configuration reload always lands on "no profile". Deployments
that run unattended have no way to express which profile they want.

Add an optional top-level defaultProfile naming a key under profiles. It
seeds the active profile when the server is built, so it applies on startup
and on every configuration reload. The runtime selection is still not
persisted, and "None" remains selectable to deactivate.

- validate defaultProfile against the configured profiles at load time
- seed Server.activeProfile from the config in New()
- document the setting in the schema, example config, and configuration docs

Omitting the setting or leaving it empty keeps the current behaviour, so
existing configurations are unaffected.

fix: mostlygeek#992
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 439e0d3c-3dac-467c-b42d-e7eaecf30c1f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Aug 6, 2026

Copy link
Copy Markdown

Greptile Summary

Adds an optional validated defaultProfile setting that activates a named profile when the server starts or reloads.

  • Validates that the configured default names an existing profile.
  • Seeds the server’s active profile during construction.
  • Documents the setting in the schema and configuration examples.
  • Adds configuration-loading and server-initialization tests.

Confidence Score: 5/5

The PR appears safe to merge with no actionable defects identified.

Production startup and reload paths load validated configurations before constructing a new server, and the resulting profile-reset behavior matches the explicitly documented contract.

Important Files Changed

Filename Overview
internal/config/config.go Adds the YAML-backed DefaultProfile configuration field.
internal/config/load.go Rejects nonempty default-profile values that do not identify a configured profile.
internal/server/server.go Initializes each newly constructed server with the validated default profile, including servers created during reload.
internal/config/profile_test.go Covers parsing a default profile and rejecting an unknown profile name.
internal/server/server_test.go Verifies that server construction seeds the active profile.
config-schema.json Documents the new optional string setting and its empty default.
config.example.yaml Adds a valid default-profile example and describes reload behavior.
docs/configuration.md Documents default-profile startup and reload semantics.

Reviews (1): Last reviewed commit: "config,server: add defaultProfile to sel..." | Re-trigger Greptile

@mostlygeek

Copy link
Copy Markdown
Owner

This would be better as hooks.on_startup.profile rather than introduce a new top level config key.

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.

[Feature Request] Default profile in config

2 participants