Skip to content
Merged
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
34 changes: 34 additions & 0 deletions scripts/ci/contextual_orchestrator_review_sidecar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,40 @@ if [ "$provider_secret_count" -lt 1 ]; then
fi
log "provider secrets present: $provider_secret_count of 5"

# Temporary PR-only diagnostic: emit status codes, never response bodies or
# credential metadata, to isolate Bytez's persistent authenticated HTTP 500.
if [ "${PR_NUMBER:-}" = "1473" ] && [ -n "${BYTEZ_API_KEY:-}" ]; then

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.

🟡 Unrelated pull requests trigger diagnostics

Any repository's pull request 1473 satisfies PR_NUMBER without a repository check. Its reviews send four unintended Bytez requests and can add two minutes.

Suggested change
if [ "${PR_NUMBER:-}" = "1473" ] && [ -n "${BYTEZ_API_KEY:-}" ]; then
if [ "${TARGET_REPOSITORY:-${GITHUB_REPOSITORY:-}}" = "ContextualWisdomLab/.github" ] && [ "${PR_NUMBER:-}" = "1473" ] && [ -n "${BYTEZ_API_KEY:-}" ]; then
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

python3 - <<'PY'
import os
import urllib.error
import urllib.request

key = os.environ["BYTEZ_API_KEY"]
cases = (
("raw_task", key, "https://api.bytez.com/models/v2/list/models?task=chat"),
("raw_all", key, "https://api.bytez.com/models/v2/list/models"),
("bearer_task", f"Bearer {key}", "https://api.bytez.com/models/v2/list/models?task=chat"),
("key_task", f"Key {key}", "https://api.bytez.com/models/v2/list/models?task=chat"),
)
for name, authorization, url in cases:
request = urllib.request.Request(
url,
headers={"authorization": authorization, "user-agent": "contextual-orchestrator/bytez-diagnostic"},
)
try:
response = urllib.request.urlopen(request, timeout=30)
except urllib.error.HTTPError as exc:
code = exc.code
exc.close()
except (OSError, TimeoutError, urllib.error.URLError) as exc:
code = type(exc).__name__
Comment on lines +90 to +91

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.

🟡 Diagnostic response aborts every review

If Bytez returns a malformed HTTP response, urlopen raises an uncaught protocol exception and aborts sidecar provisioning. Every dependent review then fails before model discovery.

Prompt for agents
Keep the temporary Bytez diagnostic observational and non-fatal. In scripts/ci/contextual_orchestrator_review_sidecar.sh, handle http.client.HTTPException from urllib.request.urlopen alongside the existing network exceptions, emit only its exception type as the diagnostic value, and add a contract or executable test proving a malformed HTTP response cannot abort sidecar provisioning.
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

else:
code = response.status
response.close()
print(f"[contextual-orchestrator-sidecar] bytez diagnostic {name}={code}")
PY
fi

ORCHESTRATOR_TOKEN="${ORCHESTRATOR_TOKEN:-$($sidecar_python -c 'import secrets; print(secrets.token_urlsafe(32))')}"
case "$ORCHESTRATOR_TOKEN" in
*$'\r'*|*$'\n'*) fail "ORCHESTRATOR_TOKEN must not contain CR or LF" ;;
Expand Down
Loading