mirror of
https://github.com/hanzoai/dev.git
synced 2026-10-25 03:32:32 +00:00
ci(proxy): set Responses v1 and fail-fast on 5xx\n\n- scripts/openai-proxy.js default RESPONSES_BETA=responses=v1\n- Workflows (issue-code, issue-comment, release, upstream-merge): EXIT_ON_5XX=1 and RESPONSES_BETA=responses=v1\n\nFix: API-key 2nd-call 500s addressed in client; proxy now aligned with production headers
This commit is contained in:
@@ -174,7 +174,7 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
mkdir -p .github/auto
|
mkdir -p .github/auto
|
||||||
PORT=5057 LOG_DEST=stdout node scripts/openai-proxy.js > .github/auto/openai-proxy.log 2>&1 &
|
PORT=5057 LOG_DEST=stdout EXIT_ON_5XX=1 RESPONSES_BETA="responses=v1" node scripts/openai-proxy.js > .github/auto/openai-proxy.log 2>&1 &
|
||||||
# Wait briefly for readiness
|
# Wait briefly for readiness
|
||||||
for i in {1..30}; do if nc -z 127.0.0.1 5057; then break; else sleep 0.2; fi; done || true
|
for i in {1..30}; do if nc -z 127.0.0.1 5057; then break; else sleep 0.2; fi; done || true
|
||||||
|
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
mkdir -p .github/auto
|
mkdir -p .github/auto
|
||||||
PORT=5056 LOG_DEST=stdout node scripts/openai-proxy.js > .github/auto/openai-proxy.log 2>&1 &
|
PORT=5056 LOG_DEST=stdout EXIT_ON_5XX=1 RESPONSES_BETA="responses=v1" node scripts/openai-proxy.js > .github/auto/openai-proxy.log 2>&1 &
|
||||||
for i in {1..30}; do if nc -z 127.0.0.1 5056; then break; else sleep 0.2; fi; done || true
|
for i in {1..30}; do if nc -z 127.0.0.1 5056; then break; else sleep 0.2; fi; done || true
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -389,7 +389,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
mkdir -p .github/auto
|
mkdir -p .github/auto
|
||||||
PORT=5058 LOG_DEST=stdout node scripts/openai-proxy.js > .github/auto/openai-proxy.log 2>&1 &
|
PORT=5058 LOG_DEST=stdout EXIT_ON_5XX=1 RESPONSES_BETA="responses=v1" node scripts/openai-proxy.js > .github/auto/openai-proxy.log 2>&1 &
|
||||||
for i in {1..30}; do if nc -z 127.0.0.1 5058; then break; else sleep 0.2; fi; done || true
|
for i in {1..30}; do if nc -z 127.0.0.1 5058; then break; else sleep 0.2; fi; done || true
|
||||||
|
|
||||||
- name: Download all artifacts
|
- name: Download all artifacts
|
||||||
|
|||||||
@@ -333,7 +333,7 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
mkdir -p .github/auto
|
mkdir -p .github/auto
|
||||||
PORT=5055 LOG_DEST=stdout node scripts/openai-proxy.js > .github/auto/openai-proxy.log 2>&1 &
|
PORT=5055 LOG_DEST=stdout EXIT_ON_5XX=1 RESPONSES_BETA="responses=v1" node scripts/openai-proxy.js > .github/auto/openai-proxy.log 2>&1 &
|
||||||
echo "pid=$!" >> "$GITHUB_OUTPUT"
|
echo "pid=$!" >> "$GITHUB_OUTPUT"
|
||||||
# Wait briefly for readiness
|
# Wait briefly for readiness
|
||||||
for i in {1..30}; do if nc -z 127.0.0.1 5055; then break; else sleep 0.2; fi; done || true
|
for i in {1..30}; do if nc -z 127.0.0.1 5055; then break; else sleep 0.2; fi; done || true
|
||||||
|
|||||||
@@ -180,7 +180,8 @@ impl ModelClient {
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|a| a.mode);
|
.map(|a| a.mode);
|
||||||
|
|
||||||
let store = prompt.store && auth_mode != Some(AuthMode::ChatGPT);
|
// Use non-stored turns on all paths for stability.
|
||||||
|
let store = false;
|
||||||
|
|
||||||
let full_instructions = prompt.get_full_instructions(&self.config.model_family);
|
let full_instructions = prompt.get_full_instructions(&self.config.model_family);
|
||||||
let mut tools_json = create_tools_json_for_responses_api(&prompt.tools)?;
|
let mut tools_json = create_tools_json_for_responses_api(&prompt.tools)?;
|
||||||
@@ -239,6 +240,7 @@ impl ModelClient {
|
|||||||
store,
|
store,
|
||||||
stream: true,
|
stream: true,
|
||||||
include,
|
include,
|
||||||
|
// Use a stable per-process cache key (session id). With store=false this is inert.
|
||||||
prompt_cache_key: Some(self.session_id.to_string()),
|
prompt_cache_key: Some(self.session_id.to_string()),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -278,10 +280,13 @@ impl ModelClient {
|
|||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
req_builder = req_builder
|
req_builder = req_builder
|
||||||
.header("OpenAI-Beta", "responses=experimental")
|
.header("OpenAI-Beta", "responses=v1")
|
||||||
.header("session_id", self.session_id.to_string())
|
|
||||||
.header(reqwest::header::ACCEPT, "text/event-stream")
|
.header(reqwest::header::ACCEPT, "text/event-stream")
|
||||||
.json(&payload);
|
.json(&payload);
|
||||||
|
// Only include a session_id for ChatGPT auth where the backend expects it
|
||||||
|
if auth_mode == Some(AuthMode::ChatGPT) {
|
||||||
|
req_builder = req_builder.header("session_id", self.session_id.to_string());
|
||||||
|
}
|
||||||
|
|
||||||
// Avoid unstable `let` chains: expand into nested conditionals.
|
// Avoid unstable `let` chains: expand into nested conditionals.
|
||||||
if let Some(auth) = auth.as_ref() {
|
if let Some(auth) = auth.as_ref() {
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ const IDEMPOTENCY_KEY = (process.env.IDEMPOTENCY_KEY || '').toLowerCase();
|
|||||||
const LOG_ERROR_BODY = process.env.LOG_ERROR_BODY === '1' || false;
|
const LOG_ERROR_BODY = process.env.LOG_ERROR_BODY === '1' || false;
|
||||||
const LOG_ERROR_BODY_BYTES = Number(process.env.LOG_ERROR_BODY_BYTES || 2048);
|
const LOG_ERROR_BODY_BYTES = Number(process.env.LOG_ERROR_BODY_BYTES || 2048);
|
||||||
const STRICT_HEADERS = process.env.STRICT_HEADERS === '1' || false;
|
const STRICT_HEADERS = process.env.STRICT_HEADERS === '1' || false;
|
||||||
const RESPONSES_BETA = process.env.RESPONSES_BETA || 'responses=experimental';
|
const RESPONSES_BETA = process.env.RESPONSES_BETA || 'responses=v1';
|
||||||
|
|
||||||
function outWrite(s) {
|
function outWrite(s) {
|
||||||
if (LOG_DEST === 'stderr') process.stderr.write(s + '\n');
|
if (LOG_DEST === 'stderr') process.stderr.write(s + '\n');
|
||||||
|
|||||||
Reference in New Issue
Block a user