Skip to content
Merged
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
7 changes: 7 additions & 0 deletions backend/backend/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,17 @@
from urllib.parse import quote

import httpx
from django.core.validators import URLValidator
from dotenv import find_dotenv, load_dotenv
from utils.common_utils import CommonUtils
from utils.cors_origin import normalize_web_app_origin

# Django 5.0+ caps URLValidator at 2048 chars. S3 pre-signed URLs signed with
# temporary/STS credentials (carrying X-Amz-Security-Token) routinely exceed this,
# causing "Enter a valid URL." on the API deployment `presigned_urls` field.
# Raise the cap globally. No-op on Django 4.2.x (no such attribute is checked).
URLValidator.max_length = 8192

missing_settings = []


Expand Down
13 changes: 13 additions & 0 deletions workers/executor/executors/legacy_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,19 @@ def _failure(child_result: ExecutionResult) -> ExecutionResult:
)

output_map = structured_output.get(PSKeys.OUTPUT, {}) or {}
if not isinstance(output_map, dict):
# Single-pass can return a non-dict (e.g. a top-level JSON array) when the
# LLM emits a truncated/runaway response. Fail clearly instead of crashing
# on .values(), and keep the malformed shape from flowing downstream as a
# success.
return ExecutionResult.failure(
error=(
f"Single-pass extraction returned a {type(output_map).__name__}, "
"expected a field map; the LLM likely produced a truncated or "
"runaway response (check output-token usage)."
),
metadata={"usage_records": pipeline_records},
)
answered = sum(1 for v in output_map.values() if v not in (None, "", [], {}))
shim.stream_log(f"Pipeline completed: {answered}/{len(outputs)} prompts answered")
out_metadata = {
Expand Down
Loading