Skip to content

Make the config file static with a defined, versioned API contract #144

Open

Description

@solidDoWant

Right now the config file structure is pretty loosely defined, as is the behavior around how the application interacts with it. Technically it has a "version": "1.0" field, but this never gets updated and there have been several breaking changes (some that I have introduced) that make config files from one OpenArc patch incompatible with config files from other OpenArc patches. Right now, the CLI is the closest thing to a versioned API contract that OpenArc has. This makes it very difficult to both know ahead of time that something is going to break, and makes it hard to declaratively configure OpenArc.

Here's how I propose OpenArc handle the config file going forward:

  • The config file should adopt a very strict versioning policy:
    • Config versions not necessarily match the OpenArc version itself, and would instead be versioned separately.
    • The config file should replace the "version" field with "schema_version" (e.g. "schema_version": "<major>") as a top-level field. This makes it clear to users what the "version" here is referring to.
    • All configuration file fields should use snake_case names.
    • Any backwards-incompatible changes should increment the major version.
    • Any OpenArc version that can read major version N should explicitly fail at startup when reading any other major version (newer or older, N+1 or N-1).
  • OpenArc must not write to the config file outside of openarc add. The file should not, for example, write the server address/port to the file upon startup.
  • OpenArc should use the following priority (lowest to highest) when interpreting administrator-instructed behavior: default values, config file, environment variable, CLI args, where applicable (e.g. server address/port).
  • The tool should support loading a JSON or YAML config file. YAML is designed to be a superset of JSON, and it is trivial for most libraries to treat parsed YAML as JSON. This has the advantage of making files easier for humans to read and write.
  • A complete JSON schema for the file should be published alongside other release artifacts. This would allow users use existing tools to validate their config as they write it (using tools like RedHat's YAML extension for VSCode.
  • CLI commands that use config files should have a command argument (e.g. --config) and environment variable (e.g. $OPENARC_CONFIG_FILE) that point to the configuration file.

As a user is what I'm trying to accomplish with all this:

  • I want to be able to declaratively configure OpenArc. Currently I need to use openarc add and similar commands to manage the config file, because the CLI is where the API contract lives. In other words, today when OpenArc updates I can usually trust that the CLI won't break, but the config file may.
  • I want to know when my configuration is going to break, or is broken. When a field gets renamed (or worse, when it keeps the same name but functionality changes), I want to know about it before a downstream consumer of OpenArcstarts reporting API request failures.
  • I want to be able to make configuration changes without loading OpenArcitself into my local environment. I'm typically not running OpenArc locally, so doing openarc add locally adds a lot of overhead for me.
  • I want to be able to more easily integrate with hosting platforms/container orchestration systems like Kubernetes.

If this issue is accepted, here is what I would open PRs for specifically:

  • Move all config logic into a separate module. Right now it's spread out pretty heavily between multiple packages, making it hard to tell what does and does not impact the config file. This is primarily parsing and validation logic.
  • Add version-specific parsing and validation. This includes a new CLI command for validating config files without starting the actual server.
  • Add new "configuration" classes for each model, and remove the more generic "dict lookup buried in business logic" that is in a lot of the model modules.
  • Add YAML parsing support.
  • Add tests for all of the above.
  • Add a release-time output that produces a full JSON schema for the config file.
  • Mark the openarc add command as deprecated - users should manage the config file directly. This simplifies how users manage settings (single path vs multiple), as well as simplifies the application. OpenArc v3 should remove it entirely IMO.

Proposed future work (not something that I plan on prioritizing):

  • Add an "openarc migrate" command for migrating config files where possible. Some cases, like simple field renames such as file_path -> file-path, would be trivial to do in an automated manner.

Activity

  1. SearchSavior commented on Jun 26, 2026

    @SearchSavior
    Owner

    I think this all sounds great, better control over versioning

    Mark the openarc add command as deprecated - users should manage the config file directly. This simplifies how users manage settings (single path vs multiple), as well as simplifies the application. OpenArc v3 should remove it entirely IMO.

    I think this is a good idea. openarc add might be an artifact leftover from when I was getting better at using cli tools... so it's overly explicit and annoying to use.

    As a user is what I'm trying to accomplish with all this

    These are great. When using openarc I find myself editing the config file directly anyway so these are great changes

  2. SearchSavior commented on Jun 26, 2026

    @SearchSavior
    Owner

    @mrelmida @droans any input? These proposed changed seem great.

    I know i usually edit the config directly, so does @meatposes

  3. mrelmida commented on Jun 30, 2026

    @mrelmida
    Collaborator

    Seems good. I think we will never need the minor number. so major should be enough.

    Migration can be hardcoded and automatically applied when reading configs (v1 detected -> migrate to v2 via function x).

    We could do a simple check: no version? -> assume its the latest version and we write a typecheck script that just looks if all variables are correct etc.
    if not, throw a error what is wrong
    and if its correct, we could add the schema version to the top of the file.

  4. droans commented on Jun 30, 2026

    @droans
    Contributor

    Here are my thoughts.

    I don't see any reason why we should ever have a backwards-incompatible change like you're envisioning. While there may be new fields in the future, I can't imagine why we wouldn't be able to handle it programmatically. Any information we might need should already be present in the OpenArc config file or the model's config files. Anything which isn't should be able to be assigned a default value that the user can later adjust if they so choose.

    Either we should encourage or openly support editable config files or we should discourage it. If the former, I believe we should prefer YAML as it is easier to read. We should also not perform any migrations or schema versioning. To me, that would be magic that should be discouraged. If the user is intended to edit the config file, they should expect that the config file they open is the same as the config file they previously saved. The promise we would be giving is that we will read the config file, not that we will correct it. If we discourage manual config editing, though, then schema versioning and migration would make more sense.

    Migration is tricky. I think we would need to research how other projects handle it. However, my thoughts would be to have a migrate.py file. The file would have individual migration functions for going from one version to the next - ie, migrate_schema_v1_to_v2, migrate_schema_v2_to_v3, migrate_schema_v6_to_v7, etc. When migrating, each function should be called in order. Each function would test if migration is necessary and return if it isn't. We then should use Pydantic to create the config models to improve migration. However, we would need to create and maintain a model for every schema version in order for it to properly work.

    To address specific items:

    • All configuration file fields should use snake_case names. I'm open to other options here if reviewers would prefer camelCase or something else.

    All config options are already snake case. It should stay that way as it's the preferred casing for Python and YAML.

    • Any backwards-compatible changes should increment the minor version.
    • Any backwards-incompatible changes should increment the major version.

    I don't like the idea of using major.minor for config schemas. Parsing the schema version would be very annoying. I believe it should only be a single number.

    • Any OpenArc version that can read major version N should be able to read and use all minor versions (N.), though older OpenArc versions may not be able to make use of newer minor version fields. Older OpenArc versions should ignore unknown fields for a given major version.
    • Any OpenArc version that can read major version N should explicitly fail at startup when reading any other major version (newer or older, N+1 or N-1).

    With schema migration, that would be unnecessary.

    • OpenArc must not write to the config file outside of openarc add. The file should not, for example, write the server address/port to the file upon startup.

    That might be touching on a deeper topic here (internal OpenArc config vs model config). However, I think there are things to consider. Should it be written at all? If the user has not provided it in the config file, defaults should just be used but not added to the file. If the user has provided it, the user's value should be used.

    • OpenArc should use the following priority (lowest to highest) when interpreting administrator-instructed behavior: default values, config file, environment variable, CLI args, where applicable (e.g. server address/port).

    I believe it already is although I may be incorrect.

    • A complete JSON schema for the file should be published alongside other release artifacts. This would allow users use existing tools to validate their config as they write it (using tools like RedHat's YAML extension for VSCode.

    If we go with a user-configurable config file, I agree. That would be doable with a Pydantic model. I believe we would just need to add a schema endpoint that returns config_model.model_json_schema() (such as Frigate's example here and here.

    • CLI commands that use config files should have a command argument (e.g. --config) and environment variable (e.g. $OPENARC_CONFIG_FILE) that point to the configuration file.

    I disagree. There is no good reason to change the config file path. This would just add unnecessary maintenance and confusion.

    Mark the openarc add command as deprecated - users should manage the config file directly. This simplifies how users manage settings (single path vs multiple), as well as simplifies the application. OpenArc v3 should remove it entirely IMO.

    I'm not certain about removing openarc add. There needs to be some form of programmatic access to update the config schema from outside the main OpenArc service, especially with OpenArc Studio. If we're going to remove it, we would need to add an API endpoint.

  5. solidDoWant commented on Jun 30, 2026

    @solidDoWant
    ContributorAuthor

    I'd prefer to keep migrations out of the initial implementation to keep this tightly scoped. I do think some migration plan (be it fully automatic of just a changelog with a list of breaking changes) would be beneficial, but adding a system for this as a part of the initial work would increase the scope quite a bit. That said, I think there are some great ideas here around migration that should be explored in a follow-up issue.

    On principle, I don't want to automatically update config files without explicit user opt-in. This would break some deployment models, such as storing the config file on a read-only filesystem. Along those same lines I also feel pretty strongly about not assuming version number, or defaulting it. While it may seem simple to do, it adds a lot of corner cases with regards to upgrading/downgrading openarc versions.

    I think folks here are right and the minor version can probably be dropped.

    I don't see any reason why we should ever have a backwards-incompatible change like you're envisioning

    This happens in practically every application that grows enough. It's happened several times with openarc already, including a few that I've merged in the past month or two.

    Applying migrations internally works great until it doesn't. As the application grows and evolves, more and more long-lived migration code is needed, because the application always needs to be backwards compatible with deprecated config fields. This also makes it much harder for users to detect and understand failures relating to config forward compatibility, which can arise when rolling back an openarc deployment with a newer config file.

    IMO adding a version field is a very low-cost way to mitigate these issues.

    Either we should encourage or openly support editable config files or we should discourage it

    Completely agree. Once this issue is fixed/implemented, I think openarc add and related commands should be deprecated and removed in the next major openarc release.

    I disagree. There is no good reason to change the config file path. This would just add unnecessary maintenance and confusion.

    Config file path is heavily dependent on deployment model, which is why I landed a few PRs last month to make it configurable. Here are several examples where having a static config file path bites users:

    • Running multiple openarc instances under the same filesystem root (if config is an absolute path)
    • Storing the config on another filesystem mount point
    • Switching between configs (e.g. trying out new configs, or having a dev and production config in the same dir, etc)
    • Shipping a default config that ends up in a read-only directory

    I would be more inclined to agree if openarc had control over the entire filesystem root (i.e. running in a container), but today it supports multiple OSs (Windows and Linux) and multiple deployment methods (stand-alone process and container). What works with one model does not necessarily work well on the others.

    I'm not certain about removing openarc add. There needs to be some form of programmatic access to update the config schema from outside the main OpenArc service, especially with OpenArc Studio. If we're going to remove it, we would need to add an API endpoint.

    Can you talk a little more about this? Maybe this is an X/Y problem where the config file is storing info that it shouldn't be.

  6. SearchSavior commented on Jun 30, 2026

    @SearchSavior
    Owner

    I'm not certain about removing openarc add. There needs to be some form of programmatic access to update the config schema from outside the main OpenArc service, especially with OpenArc Studio. If we're going to remove it, we would need to add an API endpoint.

    Can you talk a little more about this? Maybe this is an X/Y problem where the config file is storing info that it shouldn't be.

    I wonder if part of the problem we are having with versioning configuration comes down to how the codebase is structured. Right now the cli and server communicate via http requests whose contracts are only defined in the cli but all the validation is serverside... so there is some duplication. Adding an endpoint would make the contract completely in code as part of the service, with CLI as an optional entrypoint. Then we parse the new yaml config, and manage versions programmatically.

    the first change we could test with is removal of vlm-type, which all configs in the wild probably have. where @droans migrate.py concept comes in, to store all this migration business.

    For me, I usually edit the config directly when I need to make changes.

    Config file path is heavily dependent on deployment model,

    I agree with that

    I don't see any reason why we should ever have a backwards-incompatible change like you're envisioning

    This happens in practically every application that grows enough.

    For me, I see zero problem with a v3 release breaking existing configs- we can make a one time migration script from the old format and wire it into the click application to be deprecated on the following release. We can notify everyone on discord... my feeling is, tightening configuration is our biggest weakness right now, so a few eggs can break assuming we make the right fix.

    other concerns I have, now that I'm thinking about it.

    • a problem with introducing an endpoint to handle configuration parsing is that the server needs to be running; a solution might be to have a cli arg that pulls in the same logic the endpoint would hit to validate the schema.

    Moving to yaml + proposed changes introduce an oppurtunity to harden currently annoying to configure options that do not play nicely with other applications, particularly for qwen-tts

    Let's get an example going:

    # I just used a clanker to make a mockup, there might be more yaml flavored biz to make this more readable or  # apply better headings.
    models:
      - openarc:
          model_name: "lfm25-8ba1"
          model_path: "/path/to/models/LFM2.5-8B-A1B-int4_sym-awq-ov"
          model_type: "llm"
          engine: "ovgenai"
    
        openvino:
          device: "GPU.0"
          runtime_config:
            ATTENTION_BACKEND: "PA"
    
        vlm_type: null
    
        samplers:
          temperature: null
          max_tokens: null
          stop: null
          top_p: null
          top_k: null
          repetition_penalty: null
          do_sample: null
          num_return_sequences: null
          seed: null
          frequency_penalty: null
          presence_penalty: null
          chat_template_kwargs: {}
    
      - openarc:
          model_name: "llama3-8b-instruct"
          model_path: "/path/to/models/Llama-3-8B-Instruct-int4_sym-awq-ov"
          model_type: "llm"
          engine: "ovgenai"
    
        openvino:
          device: "GPU.1"
          runtime_config:
            ATTENTION_BACKEND: "PA"
    
        vlm_type: null
    
        samplers:
          temperature: null
          max_tokens: null
          stop: null
          top_p: null
          top_k: null
          repetition_penalty: null
          do_sample: null
          num_return_sequences: null
          seed: null
          frequency_penalty: null
          presence_penalty: null
          chat_template_kwargs: {}

    In this setup, if a parameter is defined here, it gets used as default but could be overridden at request time if the client sends the right parameter; otherwise each setting inherits defaults from serverside behavior.

    for now these are just llm and vlm case, but this change benefits models with more distinct requirements. Right now, it is annoying to lock in any of the settings for qwen-tts. In that case you could narrow down what needs to be used by a downstream application, since most programs do not support openai extra_body. I think it makes sense to work out these issues in one go.

    For me annoying configuration has been a major failure point in OpenArc.

    @solidDoWant @droans LMK if there is something else for me to address from above, I may have missed some things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions