Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ runs:

# After the artifact holds the analysis and before it is uploaded: each feature is one more
# file in it. Uses production by default; an empty URL disables it. It never fails the run.
- name: Run remote features
- name: Generate review journeys and run architecture and merge-risk checks

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also wondering about cost: on private repos the customer pays runner minutes while we wait on our Lambda, now up to ~15 min per review. Not for this PR, but maybe worth a ticket to make the guide async (the Lambda stores it, the platform picks it up) instead of holding the job open?

id: remote_features
if: steps.guard.outputs.skip != 'true' && steps.guard.outputs.mode == 'review' && inputs.review_guide_url != ''
continue-on-error: true
Expand Down Expand Up @@ -781,7 +781,7 @@ runs:
REQUESTY_BASE_URL: ${{ inputs.requesty_base_url }}
VERCEL_API_KEY: ${{ inputs.vercel_api_key }}
VERCEL_BASE_URL: ${{ inputs.vercel_base_url }}
run: python3 "$GITHUB_ACTION_PATH/scripts/remote_features.py"
run: python3 -u "$GITHUB_ACTION_PATH/scripts/remote_features.py"

- name: Upload review artifact
id: upload_review_artifact_dotcom
Expand Down
8 changes: 7 additions & 1 deletion scripts/remote_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,11 +723,16 @@ def run_review_guide(service_url: str, data: bytes, headers: dict, artifact: Pat
if "x-llm-provider" in headers and "x-llm-api-key" not in headers:
raise Skip("the service cannot call this run's provider")
keep_bundle(artifact, data)
answer = _post(f"{service_url.rstrip('/')}/v1/review-guide", data, headers)
# Allow the 20-minute journey Lambda to finish and return its response.
print("Journey analysis: sending /v1/review-guide request; waiting for the service response.")
answer = _post(f"{service_url.rstrip('/')}/v1/review-guide", data, headers, timeout=21 * 60)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blocker-ish: Lambda maxes out at 15 min, and I think #84's Duration.minutes(20) won't deploy, so waiting 21 min doesn't buy anything. Could we go with 15 min plus a small margin, as a named constant next to the other timeouts? 21 * 60 is a bit of a magic number here, and the comment above it would need updating too.

guide = answer.get("guide")
if not isinstance(guide, dict):
raise ValueError("the service returned no guide")
(artifact / "review_guide.json").write_text(json.dumps(guide, ensure_ascii=False, indent=1))
journeys = guide.get("journeys")
count = f" ({len(journeys)} journeys)" if isinstance(journeys, list) else ""
print(f"Journey analysis: saved review_guide.json{count}.")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the new lines say "Journey analysis:" but the notice below still says "review-guide failed". Same prefix for both would make grepping the logs easier.

except Exception as error:
print(f"::notice::review-guide {'skipped' if isinstance(error, Skip) else 'failed'}: {error}")

Expand Down Expand Up @@ -846,6 +851,7 @@ def _guide_and_architecture(pool, service_url: str, ctx: dict, bearer: dict, env
architecture's envelope, which records why when neither request went out."""
try:
headers = {**bearer, **model_headers(env)}
print("Journey analysis: preparing the analysis bundle.")
guide_request, architecture_request = _requests(ctx, collect(env), env)
except TooLarge as error:
print(f"::notice::review-guide skipped: {error}")
Expand Down
Loading