Repository navigation
fix: keep settings on upgrade and fix provider, config and proxy bugs - #618
Merged
Merged
Conversation
The validator returned nothing, so `oco config set` saved `undefined`. The environment mapping left the key out, so the shell and the repository .env file could not set it either.
The removal message says to set OCO_AI_PROVIDER=openai and OCO_API_URL. That command deleted the saved gateway key. Keep the key and the headers when the same command sets OCO_API_URL. Without a URL, they are still dropped, so the gateway key cannot go to OpenAI.
`oco config set` cut a value at its second "=". This broke keys that end in "==", URLs with a query and headers that contain "=".
`oco config set OCO_API_KEY=...` keeps the saved OCO_API_URL, so that gateway users can rotate a key. Say which URL receives the new key and how to clear it. Leave out URL credentials and the query, which can contain secrets. Print nothing for providers that never send the key to OCO_API_URL.
Migration 03 saved only the gateway URL. Without a saved OCO_MODEL, the openai default replaced the model of the gateway, which can lack it. Save the model that the provider used in 3.3.12, and name it in the removal message. A saved model stays unchanged. Migration 03 is not released yet, so edit it in place.
Every new migration made the first `oco` after an upgrade exit with code 0 and no commit. Ask for a rerun only when the global config changed. Otherwise record the migrations and continue.
A removed provider from the shell or the repository .env file led to dead ends. Migration 00 failed after migration 03, the CLI asked for a key for the removed provider, and the hook recommended a command that OpenCommit rejects. Show how to replace the provider instead.
The cache used only the provider as its key, so it showed the models of one endpoint for another. Use the provider and the base URL. Each fetch function still calls the same host. A version field lets OpenCommit ignore older files and the empty object of an interrupted refresh, which crashed `oco models`.
Migration 03 turns a removed gateway into openai with the gateway URL. A later `oco setup` with an OpenAI key kept that URL, so the new key went to the gateway. Clear OCO_API_URL and OCO_API_CUSTOM_HEADERS when the flow of the selected provider asks for no URL. An undefined change now removes the key, because ini saves undefined as text. The model list request already used the default host. A test now covers it with the gateway models in the cache.
An option that a caller passed as undefined replaced its default. For example, OCO_TOKENS_MAX_OUTPUT: undefined removed the output limit.
An HTTPS_PROXY or HTTP_PROXY such as socks5://127.0.0.1:1080 stopped every engine. Warn once and connect directly, as 3.3.12 did. Reject an unsupported OCO_PROXY with a clear error. Also block the requests outside the engines, because direct ones would bypass the proxy. The CLI does not exit at startup, so `oco config` can correct the value and the hook cannot stop a commit. NO_PROXY and no_proxy now apply to HTTPS_PROXY and HTTP_PROXY, for example for a local Ollama. They do not apply to OCO_PROXY. The check runs for each request. EnvHttpProxyAgent of undici is not used, because it prints an experimental warning on every run.
The Azure SDK used only its own environment proxy. It ignored OCO_PROXY, also when OCO_PROXY was null. Its proxy options are not enough: they also apply NO_PROXY to an explicit proxy, and they cannot disable the environment proxy. Replace the agent in a later policy instead. The library now accepts OCO_PROXY for azure.
The README documents OCO_API_KEY for ollama, but the engine never sent it. Send it as a Bearer token when it is set. A custom Authorization header still takes precedence.
OpenAI returns 429 with the code insufficient_quota when the quota is spent. OpenCommit told the user to wait, which does not help. Other 429 responses are still rate limits.
The proxy clients throw on a plain "%" in the credentials. Treat such a URL like an unsupported protocol. HTTPS_PROXY or HTTP_PROXY then gives a warning and a direct connection, as in 3.3.12, and OCO_PROXY gives a clear error.
Azure has no default endpoint, and setup now clears a saved URL that it does not ask for.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The upgrade from 3.3.12 could leave users with broken settings. Several provider and config bugs also remained. This change fixes them before the next release.
Upgrade
oco config setreplaces a removed provider withopenaiand setsOCO_API_URL, OpenCommit keeps the key..envbefore migrations and key checks. The Git hook gives the same advice.Config and setup
oco setupclears a saved URL and its custom headers when it does not ask for a URL. Azure setup now asks for its endpoint.oco config setshows which saved URL gets a new key, if the command sets no URL.oco config setsplits a value only at the first=, so headers and URLs that contain=are saved in full.OCO_OLLAMA_THINKnow works.Providers and network
undefinedoption as omitted.HTTPS_PROXYandHTTP_PROXYfollowNO_PROXY. OpenCommit warns about an unsupported value and connects directly. An unsupportedOCO_PROXYgives an error.OCO_PROXY, also in the library.Authorizationheaders take precedence.Checks
Run locally on Node 24, with no network except loopback: lint, format check, build, 396 unit tests, the smoke and core e2e suites (2 and 91 tests). The Azure proxy tests check only the connection route.
🤖 Generated with Claude Code