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:
James Peter
2025-09-12 23:57:18 +10:00
parent 1ddedb8b48
commit acfaeb7dd5
6 changed files with 13 additions and 8 deletions
+1 -1
View File
@@ -174,7 +174,7 @@ jobs:
exit 1
fi
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
for i in {1..30}; do if nc -z 127.0.0.1 5057; then break; else sleep 0.2; fi; done || true
+1 -1
View File
@@ -235,7 +235,7 @@ jobs:
run: |
set -euo pipefail
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
+1 -1
View File
@@ -389,7 +389,7 @@ jobs:
run: |
set -euo pipefail
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
- name: Download all artifacts
+1 -1
View File
@@ -333,7 +333,7 @@ jobs:
exit 1
fi
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"
# 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
+8 -3
View File
@@ -180,7 +180,8 @@ impl ModelClient {
.as_ref()
.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 mut tools_json = create_tools_json_for_responses_api(&prompt.tools)?;
@@ -239,6 +240,7 @@ impl ModelClient {
store,
stream: true,
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()),
};
@@ -278,10 +280,13 @@ impl ModelClient {
.await?;
req_builder = req_builder
.header("OpenAI-Beta", "responses=experimental")
.header("session_id", self.session_id.to_string())
.header("OpenAI-Beta", "responses=v1")
.header(reqwest::header::ACCEPT, "text/event-stream")
.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.
if let Some(auth) = auth.as_ref() {
+1 -1
View File
@@ -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_BYTES = Number(process.env.LOG_ERROR_BODY_BYTES || 2048);
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) {
if (LOG_DEST === 'stderr') process.stderr.write(s + '\n');