Repository navigation
fix(llm): refuse a base URL that belongs to another provider's API - #235
Merged
Merged
Conversation
This was referenced Sep 23, 2026
goldbarth
added a commit
that referenced
this pull request
Oct 1, 2026
…rd decided, recorded and amended (#318) Follows #264, which moved the ADRs to `docs/development/adr/`, and #317, which ruled out the claim that the audiences "cannot disagree". - **Why:** the ADRs had one `Date` line that mixed when a decision was taken with what changed later ("2026-07-16 (#45), extended by #96"), no record of when each file was written, and no list of their own; CONTRIBUTING kept the only list. ADR 0003 did not mention #235, which added a refusal to the decision it records, and ADR 0002's title named the tools rather than the decision. - **`docs/development/adr/README.md`** holds the index, when to write an ADR, and a template with separate fields: **Decided** (when it took effect in the code, which can precede the record), **Recorded** (when the file was written), and **Amended** (every later change to the decision or to a fact in it, each dated with its pull request). A moved file, a fixed link or a reworded sentence is not an amendment, so the list stays a record of meaning. - **0001** gives the date and pull request of each part: facts first on 2026-07-16 (#45), and the structure of a rendering on 2026-09-16 (#129, for #96), which the Decision now marks as its own paragraph with the reason #96 found. Amended here: "so they cannot disagree on what happened" becomes what a shared fact base actually gives, the same changes, categories and breaking status, and says why texts can still disagree. - **0002** is retitled to its decision, "Dependencies that keep a native-AOT build reachable", and the file renamed to match; the Decision opens on the rule the bullets implement. #268's correction of the platform count is listed as its amendment. - **0003** records #235: a model endpoint on the API host of the other provider is refused before any request, with the reason (a key sent there must be rotated) and why the list of hosts stays short. Dated 2026-09-23, the day of #235, and marked as recorded here. - **CONTRIBUTING** links the index instead of listing the ADRs, and the README's "Contribute" table gains a row for it, so the list exists in one place. **Verified:** - Every date and number was taken from GitHub: the merge dates of #42, #43, #45, #129, #166, #216, #235 and #268, and the issues each closes (#3, #4, #6, #96, #158, #184, #233). - What #268 changed in 0002 was read from its diff: the platform count, nothing else. #264, #270 and #316 only moved the files or changed a link, so they are not amendments. - The rule 0003 now states was checked against `ProviderHost.cs` and #235's description. - Every relative link and anchor in all Markdown files of the repository resolves (script, with a negative test); the renamed 0002 had no inbound link besides CONTRIBUTING's list. Tests: none, documentation only.
goldbarth
added a commit
that referenced
this pull request
Oct 1, 2026
…320) Follows #319 (ADR 0004); this branch builds on it for the index row and is rebased onto `main` once #319 is merged. - **Why:** seven changes since September made Chartula stop where it used to choose silently, each with its own reasoning in its pull request, but the rule they share was written down nowhere. A contributor adding an option or a setting could not tell whether to refuse an ambiguous value or take the likelier reading, nor when refusing goes too far. - **Context** lists the seven cases in one table, each with what the silent choice did and the change that ended it: a first tag (#198 for #138, #282), a key sent to the other provider's host (#235), an unknown or misindented key (#238), a shallow clone read as a first release (#244), review mode approving unseen text (#247), two configuration files (#287 for #278), and options a command does not take (#301). Decided is #198, the first of them. - **Decision:** stop and say so instead of choosing; before anything is spent; with a message that names the cause and the fix, shown with two real messages; ask at a terminal where the answer is the user's, and stop naming the option without one; refuse only what Chartula can tell for certain (an empty list, an unknown host and an unknown model id are taken as written); refuse a setting that would have no effect. The rule is about what the user meant, not about what the release says, which is what flags are for. - **Consequences** name the cost: a run that could have produced something stops, and a CI job fails until the input says what it means. The ADR weighs that rerun against what a silent choice cost in the seven cases. For a new case, four questions in order, so a contributor can apply the rule rather than match it against the examples. - The index in `adr/README.md` lists 0005. **Verified:** - Each case was checked against its pull request's description and the issue it closes (#237, #243, #233, #278, #300, #138); the dates are the merge dates. - Both messages are the ones `docs/cli.md` and `docs/configuration.md` show from the built binary. - The counter-cases were checked in the code: `ProviderHost` accepts every host but two, `ClaudeThinkingSupport` passes an unknown model id, #289 reads an empty list as written, and #244 still runs `--since` in a shallow clone when the range holds. - Every relative link and anchor in all Markdown files of the repository resolves (script, with a negative test). Tests: none, documentation only.
goldbarth
added a commit
that referenced
this pull request
Oct 1, 2026
…d writes (#323) Follows #318, which gave ADR 0003 its record of the provider-host refusal (#235), and #306, which made `outputs.md` the home of what each file holds. - **Why:** SECURITY named the line between repository content and the operator's credentials as the part worth protecting, but did not say where that line runs or link the decision that draws it. A reporter could not tell from it what a run sends to the model provider, what it writes to GitHub, or what a published `changelog.json` holds, which is what decides whether a finding crosses the line. - **"The trust boundary"** links ADR 0003 and states its four rules in a sentence each: endpoints and credential variable names from the environment only, no credential from a file and no value in any output, `https` except on this machine, and the other provider's API host refused. A way around any of them is in scope. - **"What a run sends and writes"** gives each destination one bullet and links its home instead of restating it: the model provider (what a fact holds, how often it is sent, the `title-only` depth, the local server), GitHub (`github.md`'s table), and the disk (`changelog.json` without descriptions, the run record that keeps them locally). - **Scope** gains one line for pull request text that steers the model: a known limitation, linked to the README; it becomes in scope when it makes Chartula send a credential, run a program or publish elsewhere. **Verified:** - Each rule against the code: `ChartulaConfiguration` (what the environment is read for), `EndpointUrl` (`https` except loopback), `ProviderHost`, `EndpointNotice` and `doctor` (variables named, values never). - What reaches the model against `GroundedFactsFactory` (the statement per fact) and `ThoroughFaithfulnessChecker` (facts and rendering); what reaches GitHub against `GitHubPullRequestReader` and `GitHubReleaseNotesWriter`. - Private vulnerability reporting is enabled on the repository, so the report link works. - Every relative link and anchor in all Markdown files of the repository resolves (script, with a negative test). Tests: none, documentation only.
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.
Closes #233
Chartula__Llm__BaseUrlwhose host belongs to another provider's API stops the run before the history is read, so the key never leaves the machine. The run header already named the mismatch and nothing stopped on it; a key that went out has to be rotated.api.openai.comis refused foranthropic,api.anthropic.comforopenai-compatible. Every other host is accepted, because a proxy or a gateway lives at a host of its own. The list stays short on purpose: several hosted endpoints serve both dialects under one host, so a longer one would refuse working setups.llm.provider is not set and defaults to 'anthropic'is how the mismatch happens - the endpoint came from the environment, the provider from achartula.yamlin another repository. The key variable named is the one in force, not the default.ReadOptions), so the refusal holds wherever they are read, not only where the client is built. It lives inProviderHost, besideEndpointUrl.api.anthropic.comalso serves an OpenAI-compatible layer, whichopenai-compatiblecan no longer reach; the refusal points atllm.provider: anthropic, the adapter that speaks Anthropic's API in full.configuration.md(environment-only settings).Reproduced before the fix with the release binary, a dummy key (
ANTHROPIC_API_KEY=sk-ant-dummy) and a local GitHub stub, the way the issue was found - the dummy key went toapi.openai.com:Verified after the fix, same command, also with networking disabled (
unshare -rn), exit code 1:and the other direction:
Tests:
LlmWiringTests(provider not set, both directions, host spelled in upper case with a trailing dot, renamed key variable, gateways and matching hosts accepted),ForeignProviderHostTests(the built CLI stops before any request); full suite 742 passing, build anddotnet formatclean.