Skip to content

Commit 8cd734e

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 1765d81 commit 8cd734e

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
@@ -198,7 +200,7 @@ dependency/build directories, docs/public/fixtures, minified JS and TypeScript d
198200
Symlinks are not read. Individual files are capped at 300 KB and source at 16 MB. If adding
199201
source exceeds the 4.3 MB compressed request limit, it is omitted with a reason; architecture
200202
still runs with the required inputs. `closed_features_source: false` also omits source.
201-
An unsupported provider skips the guide, but architecture can still return measured findings.
203+
An unsupported provider still gets the guide's structure and architecture's measured findings.
202204

203205
### Providers
204206

‎scripts/remote_features.py‎

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

696696

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

‎tests/test_remote_features.py‎

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

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

513521
def test_missing_shared_input_records_failure_without_requests(self):
514522
(Path(self.env["HEAD_ANALYSIS_PATH"]).parent / "static_analysis.pkl").unlink()
@@ -614,10 +622,11 @@ def test_not_written_when_inputs_are_missing(self):
614622
self.assertEqual(self.run_service().requests, [])
615623
self.assert_not_kept()
616624

617-
def test_not_written_when_the_guide_cannot_call_the_provider(self):
625+
def test_kept_when_the_service_cannot_call_the_provider(self):
618626
self.env.update(LLM="litellm", LITELLM_API_KEY="secret")
619-
self.assertEqual([request["path"] for request in self.run_service().requests], ["/v1/architecture"])
620-
self.assert_not_kept()
627+
service = self.run_service()
628+
sent = next(request["body"] for request in service.requests if request["path"] == "/v1/review-guide")
629+
self.assertEqual(self.bundle().read_bytes(), sent)
621630

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

0 commit comments

Comments
 (0)