Skip to content

Commit 0f18756

Browse files
Ask for the review guide when the service cannot call the run's provider
The service now answers a run it has no model for with the guide's structure, marked `words: {"status": "missing", "reason": "no_model"}`, instead of a 409. Skipping the request on the runner kept those runs from ever getting it. Only the provider's name is sent, never its key, so the service still makes no model call and never falls back to the hosted model. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent a589358 commit 0f18756

3 files changed

Lines changed: 25 additions & 14 deletions

File tree

‎README.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ model call, and the run never falls back to CodeBoarding's model.
185185
The action independently calls `POST /v1/review-guide` and `POST /v1/architecture` on the
186186
same `review_guide_url` base URL. There is no discovery request. Both receive the same
187187
required analysis inputs. The guide endpoint returns `{guide, usage, timingsMs}`; the action
188-
saves the bare guide as `review_guide.json`. Architecture returns `{envelope, usage}`; its
188+
saves the bare guide as `review_guide.json`. When the service has no model for the run, or the
189+
model step fails or runs out of time, the guide still carries its structure and says what is
190+
missing in `words` (`{"status": "missing" | "partial", "reason": ...}`). Architecture returns `{envelope, usage}`; its
189191
envelope is saved unchanged as `closed/architecture.json`, including partial, skipped and
190192
failed results. Failure of either request does not prevent the other or fail the review.
191193
The guide's request body, the same xz-compressed bytes the service receives, is saved as
@@ -213,7 +215,7 @@ Symlinks are not read. Individual files are capped at 300 KB and source at 16 MB
213215
source exceeds the 4.3 MB compressed request limit, it is omitted with a reason; architecture
214216
still runs with the required inputs. `closed_features_source: false` also omits source, and
215217
merge risk then sends its file list without patches.
216-
An unsupported provider skips the guide, but architecture can still return measured findings.
218+
An unsupported provider still gets the guide's structure and architecture's measured findings.
217219

218220
### Providers
219221

‎scripts/remote_features.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -719,9 +719,9 @@ def keep_bundle(artifact: Path, data: bytes | None) -> None:
719719

720720

721721
def run_review_guide(service_url: str, data: bytes, headers: dict, artifact: Path) -> None:
722+
"""The guide as the service returned it. A run the service has no model for, or whose model step
723+
failed, still gets the guide's structure, marked by `words` with what is missing and why."""
722724
try:
723-
if "x-llm-provider" in headers and "x-llm-api-key" not in headers:
724-
raise Skip("the service cannot call this run's provider")
725725
keep_bundle(artifact, data)
726726
answer = _post(f"{service_url.rstrip('/')}/v1/review-guide", data, headers)
727727
guide = answer.get("guide")

‎tests/test_remote_features.py‎

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -505,14 +505,22 @@ def test_all_architecture_statuses_preserved(self):
505505
self.run_service(lambda p, b: (200, {"guide": GUIDE, "envelope": envelope}))
506506
self.assertEqual(_read(self.env, "closed/architecture.json"), envelope)
507507

508-
def test_unsupported_provider_still_gets_measured_architecture(self):
508+
def test_unsupported_provider_gets_the_guide_structure_and_measured_architecture(self):
509509
self.env.update(LLM="litellm", LITELLM_API_KEY="secret")
510-
service = self.run_service()
511-
self.assertEqual([r["path"] for r in service.requests], ["/v1/architecture"])
512-
headers = {k.lower(): v for k, v in service.requests[0]["headers"].items()}
513-
self.assertEqual(headers["x-llm-provider"], "litellm")
514-
self.assertNotIn("x-llm-api-key", headers)
515-
self.assertFalse((Path(self.env["ARTIFACT_DIR"]) / "review_guide.json").exists())
510+
structure = {**GUIDE, "words": {"status": "missing", "reason": "no_model"}}
511+
service = self.run_service(lambda p, b: (200, {"guide": structure, "envelope": ENVELOPE}))
512+
self.assertEqual(sorted(r["path"] for r in service.requests), ["/v1/architecture", "/v1/review-guide"])
513+
for request in service.requests:
514+
headers = {name.lower(): value for name, value in request["headers"].items()}
515+
self.assertEqual(headers["x-llm-provider"], "litellm")
516+
self.assertNotIn("x-llm-api-key", headers)
517+
self.assertEqual(_read(self.env, "review_guide.json"), structure)
518+
519+
def test_a_guide_without_the_models_words_is_stored_as_returned(self):
520+
for status, reason in (("missing", "model_error"), ("missing", "timeout"), ("partial", "timeout")):
521+
structure = {**GUIDE, "words": {"status": status, "reason": reason}}
522+
self.run_service(lambda p, b: (200, {"guide": structure, "envelope": ENVELOPE}))
523+
self.assertEqual(_read(self.env, "review_guide.json"), structure)
516524

517525
def test_missing_shared_input_records_failure_without_requests(self):
518526
(Path(self.env["HEAD_ANALYSIS_PATH"]).parent / "static_analysis.pkl").unlink()
@@ -860,10 +868,11 @@ def test_not_written_when_inputs_are_missing(self):
860868
self.assertEqual(self.run_service().requests, [])
861869
self.assert_not_kept()
862870

863-
def test_not_written_when_the_guide_cannot_call_the_provider(self):
871+
def test_kept_when_the_service_cannot_call_the_provider(self):
864872
self.env.update(LLM="litellm", LITELLM_API_KEY="secret")
865-
self.assertEqual([request["path"] for request in self.run_service().requests], ["/v1/architecture"])
866-
self.assert_not_kept()
873+
service = self.run_service()
874+
sent = next(request["body"] for request in service.requests if request["path"] == "/v1/review-guide")
875+
self.assertEqual(self.bundle().read_bytes(), sent)
867876

868877
def test_not_written_over_the_service_limit(self):
869878
with mock.patch.object(remote_features, "MAX_COMPRESSED_BYTES", 1):

0 commit comments

Comments
 (0)