Skip to content

Commit 9e13103

Browse files
Send the run's own provider with merge risk, as with the guide
A run that brings its own model key now sends the same provider headers on the merge-risk request as on the guide's, so the service decides and reviews merge risk on that model and skips the classifier only CodeBoarding's key can reach: the run's code goes to its own provider and nowhere else. Headers that cannot be built fail merge risk rather than fall back to CodeBoarding's models. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent e679f2c commit 9e13103

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ no analysis: only the pull request's title, description and changed files with t
197197
GitHub lists them. The service counts size and tests itself, asks a fixed nine-question checklist
198198
about the diff (sign-in and access, billing, stored data, releases, dependency and platform versions,
199199
public interfaces, calls to other services), has a model decide each answer and a second pass drop
200-
the false alarms, with a sentence and the changed line behind each risk it keeps. With
200+
the false alarms, with a sentence and the changed line behind each risk it keeps. With your own
201+
provider key it sends the same provider headers as the guide: your model makes the decision and the
202+
review, and the checklist's classifier, which only CodeBoarding's key can reach, is skipped. With
201203
`closed_features_source: false` it sends neither patches nor the description, only each file's
202204
path, additions and deletions; a diff too large to send with its patches goes the same way. Without patches the
203205
checklist cannot run: the answer comes back `partial` with size and tests only, the run logs a

‎scripts/remote_features.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,9 @@ def run_merge_risk(service_url: str, ctx: dict, headers: dict, env: dict, artifa
813813
title, description, files = merge_risk_files(ctx)
814814
# With source off the description stays on the runner too: it can quote code.
815815
data = merge_risk_request(ctx, title, description if source_allowed(env) else "", files, source_allowed(env))
816-
answer = _post(f"{service_url.rstrip('/')}/v1/merge-risk", data, headers, timeout=120)
816+
# The run's own provider, as for the guide: its model decides, and its code reaches no other
817+
# model. Headers that cannot be built fail merge risk rather than fall back to ours.
818+
answer = _post(f"{service_url.rstrip('/')}/v1/merge-risk", data, {**headers, **model_headers(env)}, timeout=120)
817819
if not isinstance(answer, dict) or not isinstance(answer.get("facts"), dict):
818820
raise ValueError("the service returned no merge-risk facts")
819821
checklist = answer.get("checklist")

‎tests/test_remote_features.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,19 @@ def test_sends_the_file_list_and_keeps_the_answer_with_the_head_it_describes(sel
663663
self.assertEqual(_read(self.env, "review_guide.json"), GUIDE)
664664
self.assertEqual(_read(self.env, "closed/architecture.json"), ENVELOPE)
665665

666+
def test_merge_risk_carries_the_runs_own_provider_as_the_guide_does(self):
667+
self.env.update({"LLM": "openai", "OPENAI_API_KEY": "sk-their", "AGENT_MODEL": "gpt-5.5"})
668+
service = self.run_service(_answer)
669+
[request] = [sent for sent in service.requests if sent["path"] == "/v1/merge-risk"]
670+
sent = {name.lower(): value for name, value in request["headers"].items()}
671+
self.assertEqual(
672+
(sent.get("x-llm-provider"), sent.get("x-llm-api-key"), sent.get("x-llm-model")),
673+
("openai", "sk-their", "gpt-5.5"),
674+
)
675+
self.env["LLM"] = "hosted"
676+
[request] = [sent for sent in self.run_service(_answer).requests if sent["path"] == "/v1/merge-risk"]
677+
self.assertNotIn("x-llm-provider", {name.lower() for name in request["headers"]})
678+
666679
def test_a_failed_merge_risk_writes_nothing_and_leaves_the_others_alone(self):
667680
self.run_service(lambda path, body: (500, {}) if path == "/v1/merge-risk" else _answer(path, body))
668681
self.assertIsNone(self.result())

0 commit comments

Comments
 (0)