Skip to content

Commit 79ab147

Browse files
Enhance compliance JSON parsing error handling with debug logging in orchestrator.py; add model availability check in quota_check_params.sh
1 parent 2d8c134 commit 79ab147

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

content-gen/infra/script/quota_check_params.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ for REGION in "${REGIONS[@]}"; do
156156
continue
157157
fi
158158

159+
IMAGE_MODEL_AVAILABLE=false
159160
AT_LEAST_ONE_MODEL_AVAILABLE=false
160161
TEMP_TABLE_ROWS=()
161162

@@ -199,6 +200,9 @@ for REGION in "${REGIONS[@]}"; do
199200

200201
if [ "$AVAILABLE" -ge "$REQUIRED_CAPACITY" ]; then
201202
FOUND=true
203+
if [ "$MODEL_NAME" = "gpt-image-1" ]; then
204+
IMAGE_MODEL_AVAILABLE=true
205+
fi
202206
AT_LEAST_ONE_MODEL_AVAILABLE=true
203207
TEMP_TABLE_ROWS+=("$(printf "| %-4s | %-20s | %-43s | %-10s | %-10s | %-10s |" "$INDEX" "$REGION" "$MODEL_TYPE" "$LIMIT" "$CURRENT_VALUE" "$AVAILABLE")")
204208
else
@@ -215,8 +219,7 @@ for REGION in "${REGIONS[@]}"; do
215219
done
216220
done
217221

218-
# For content-gen, we only need GPT-5.1, so check if at least one model is available
219-
if [ "$AT_LEAST_ONE_MODEL_AVAILABLE" = true ] && [ "$INSUFFICIENT_QUOTA" = false ] && [ "$FOUND" = true ]; then
222+
if { [ "$IS_USER_PROVIDED_PAIRS" = true ] && [ "$INSUFFICIENT_QUOTA" = false ] && [ "$FOUND" = true ]; } || { [ "$IMAGE_MODEL_AVAILABLE" = true ] && { [ "$APPLY_OR_CONDITION" != true ] || [ "$AT_LEAST_ONE_MODEL_AVAILABLE" = true ]; }; }; then
220223
VALID_REGIONS+=("$REGION")
221224
TABLE_ROWS+=("${TEMP_TABLE_ROWS[@]}")
222225
INDEX=$((INDEX + 1))

content-gen/src/backend/orchestrator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1580,7 +1580,8 @@ async def generate_content(
15801580
for v in results["violations"]
15811581
)
15821582
except (json.JSONDecodeError, KeyError):
1583-
pass
1583+
# Failed to parse compliance response JSON; violations will remain empty
1584+
logger.debug("Could not parse compliance violations from response", exc_info=True)
15841585

15851586
except Exception as e:
15861587
logger.exception(f"Error generating content: {e}")

0 commit comments

Comments
 (0)