Skip to content

Commit 23b1409

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 3a6b234 commit 23b1409

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

211213
### Providers
212214

‎scripts/remote_features.py‎

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

705705

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

‎tests/test_remote_features.py‎

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

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

516524
def test_missing_shared_input_records_failure_without_requests(self):
517525
(Path(self.env["HEAD_ANALYSIS_PATH"]).parent / "static_analysis.pkl").unlink()
@@ -751,10 +759,11 @@ def test_not_written_when_inputs_are_missing(self):
751759
self.assertEqual(self.run_service().requests, [])
752760
self.assert_not_kept()
753761

754-
def test_not_written_when_the_guide_cannot_call_the_provider(self):
762+
def test_kept_when_the_service_cannot_call_the_provider(self):
755763
self.env.update(LLM="litellm", LITELLM_API_KEY="secret")
756-
self.assertEqual([request["path"] for request in self.run_service().requests], ["/v1/architecture"])
757-
self.assert_not_kept()
764+
service = self.run_service()
765+
sent = next(request["body"] for request in service.requests if request["path"] == "/v1/review-guide")
766+
self.assertEqual(self.bundle().read_bytes(), sent)
758767

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

0 commit comments

Comments
 (0)