Skip to content

fix: sync codex responses passthrough fields - #6018

Merged
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
seefs001:fix/codex-upstream-sync
Jul 11, 2026
Merged

fix: sync codex responses passthrough fields#6018
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
seefs001:fix/codex-upstream-sync

Conversation

@seefs001

@seefs001 seefs001 commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

⚠️ 提交说明 / PR Notice

Important

  • 请提供人工撰写的简洁摘要,避免直接粘贴未经整理的 AI 输出。

📝 变更描述 / Description

(简述:做了什么?为什么这样改能生效?请基于你对代码逻辑的理解来写,避免粘贴未经整理的内容)

同步codex客户端传递的字段(request header和sse response header)
compact的字段

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix) - 请关联对应 Issue,避免将设计取舍、理解偏差或预期不一致直接归类为 bug
  • ✨ 新功能 (New feature) - 重大特性建议先通过 Issue 沟通
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 IssuesPRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

(请在此粘贴截图、关键日志或测试报告,以证明变更生效)

Summary by CodeRabbit

  • New Features
    • Added client support for passing selected upstream SSE response headers, including a new pass_sse_headers parameter override mode across the UI, templates, validation, and audit labeling.
    • Expanded Codex-compatible request/SSE metadata passthrough and Response/compaction controls (client metadata, prompt caching options, reasoning mode/context).
  • Bug Fixes
    • Preserved explicit zero/empty values and ensured header passthrough uses consistent casing.
    • Improved token usage reporting (cached creation tokens) and updated service-tier handling.
  • Tests
    • Added/expanded round-trip and pass-through coverage for Responses, compaction, and SSE header behavior.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds Codex request and SSE response-header passthrough support, expands OpenAI Responses and compaction DTO parity, preserves Codex metadata through conversion, and maps cache-write token usage details across relay handlers.

Changes

Codex and Responses integration

Layer / File(s) Summary
Responses contracts and usage parity
dto/*, relay/responses_handler.go, service/relayconvert/*, relay/channel/*, setting/ratio_setting/cache_ratio.go
Responses and compaction requests preserve additional Codex fields, service-tier zero values, client metadata, and cache-write usage details.
Backend SSE header passthrough
relay/common/*, relay/helper/*, relay/channel/api_request_test.go, service/channel_affinity_template_test.go
A pass_sse_headers override stores validated header names in RelayInfo, and streaming responses copy selected upstream headers while excluding unsupported headers.
Codex templates and editor support
setting/operation_setting/*, web/classic/src/*, web/default/src/*
Codex request/SSE allowlists, templates, editor modes, validation, labels, presets, and translations are updated for SSE header passthrough.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Codex
  participant ChannelAffinity
  participant ParamOverride
  participant UpstreamResponses
  participant StreamScanner
  participant Client
  Codex->>ChannelAffinity: send request and session headers
  ChannelAffinity->>ParamOverride: apply pass_headers and pass_sse_headers
  ParamOverride->>UpstreamResponses: forward configured request headers
  UpstreamResponses-->>StreamScanner: return SSE response and headers
  StreamScanner->>Client: stream events and selected SSE headers
Loading

Possibly related PRs

Poem

A bunny hops through headers bright,
SSE stars stream through the night.
Codex fields retain their place,
Cache-write tokens join the race.
A carrot-powered merge takes flight!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR also adds SSE pass-through, compact-request fields, UI/i18n updates, and usage mappings that are unrelated to #6016. Split the header-rename fix from the compact/SSE/UI changes, or justify those additions in separate linked issues.
Docstring Coverage ⚠️ Warning Docstring coverage is 2.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The issue’s header rename fix is implemented by updating Codex passthrough allowlists and tests for session-id/thread-id forwarding.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the main change: syncing Codex Responses passthrough fields and header handling.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seefs001
seefs001 marked this pull request as draft July 9, 2026 04:32

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2

🧹 Nitpick comments (3)
relay/common/override.go (1)

1305-1389: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Consider a deny-list for sensitive headers before allowing pass_response_headers wildcards.

shouldCopyResponseHeaderPassThrough (in relay/helper/stream_scanner.go) allows a trailing * to match any header name, so a template like "*" or "set-*" would let an admin forward every upstream header — including things like Set-Cookie or internal auth headers — straight to the end client. A small deny-list (e.g. set-cookie, authorization, www-authenticate) enforced in parseHeaderPassThroughNames or GetResponseHeaderPassThrough would guard against accidental credential/session leakage from a broad admin misconfiguration.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@relay/common/override.go` around lines 1305 - 1389, Add a deny-list guard for
sensitive response headers before accepting wildcard pass-through patterns. The
issue is in `parseHeaderPassThroughNames`/`GetResponseHeaderPassThrough`, where
broad values like `*` or `set-*` can later be matched by
`shouldCopyResponseHeaderPassThrough` and leak headers such as `Set-Cookie` or
`Authorization`. Update the parsing/validation path to reject or filter reserved
sensitive names and wildcard patterns that would match them, so only safe
headers are allowed through.
relay/common/override_test.go (1)

1394-1423: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use testify require/assert instead of t.Fatalf and reflect.DeepEqual.

Per the project's test guidelines, new Go backend tests must use require for fatal assertions and assert for non-fatal value checks. This new test uses t.Fatalf and reflect.DeepEqual instead.

♻️ Proposed refactor to use testify
 func TestApplyParamOverridePassResponseHeadersNoopsRequestBody(t *testing.T) {
 	info := &RelayInfo{
 		RequestHeaders: map[string]string{},
 		ChannelMeta: &ChannelMeta{
 			ParamOverride: map[string]interface{}{
 				"operations": []interface{}{
 					map[string]interface{}{
 						"mode":  "pass_response_headers",
 						"value": []interface{}{"OpenAI-Model", "X-Codex-*"},
 					},
 				},
 			},
 		},
 	}

 	input := []byte(`{"model":"gpt-5"}`)
 	out, err := ApplyParamOverrideWithRelayInfo(input, info)
-	if err != nil {
-		t.Fatalf("ApplyParamOverrideWithRelayInfo returned error: %v", err)
-	}
-	if string(out) != string(input) {
-		t.Fatalf("pass_response_headers should not modify request body, got %s", string(out))
-	}
+	require.NoError(t, err)
+	require.Equal(t, string(input), string(out), "pass_response_headers should not modify request body")

 	got := GetResponseHeaderPassThrough(info)
 	want := []string{"openai-model", "x-codex-*"}
-	if !reflect.DeepEqual(got, want) {
-		t.Fatalf("unexpected response header passthrough names, got %#v want %#v", got, want)
-	}
+	require.Equal(t, want, got, "unexpected response header passthrough names")
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@relay/common/override_test.go` around lines 1394 - 1423, The new test in
TestApplyParamOverridePassResponseHeadersNoopsRequestBody should follow the
project’s testify conventions instead of using t.Fatalf and reflect.DeepEqual.
Update the fatal setup/error checks in ApplyParamOverrideWithRelayInfo to use
require, and replace the value comparison for GetResponseHeaderPassThrough with
assert. Keep the test behavior the same while using testify helpers consistently
throughout the test.

Source: Coding guidelines

web/default/src/features/channels/components/dialogs/param-override-editor-dialog.tsx (1)

323-336: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider sharing Codex header constants and template builder across default-web features.

CODEX_CLI_RESPONSE_HEADER_PASSTHROUGH_HEADERS (lines 330-336) and the inline CODEX_CLI_HEADER_PASSTHROUGH_TEMPLATE (lines 360-372) duplicate the same data and logic as web/default/src/features/system-settings/general/channel-affinity/constants.ts (lines 53-59, 89-103). If either allowlist changes, both copies must be updated in sync. Consider extracting these to a shared module and importing from both feature directories.

This follows the pre-existing duplication pattern for CODEX_CLI_HEADER_PASSTHROUGH_HEADERS, so it's not a regression — but it's worth addressing to prevent drift.

Also applies to: 360-372

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@web/default/src/features/channels/components/dialogs/param-override-editor-dialog.tsx`
around lines 323 - 336, The Codex response header allowlist and header template
logic are duplicated in param-override-editor-dialog and the channel-affinity
constants, so they can drift out of sync. Extract the shared header constants
and template builder into a common module, then import and reuse them from both
the dialog code and the system-settings channel-affinity code, using the
existing symbols CODEX_CLI_RESPONSE_HEADER_PASSTHROUGH_HEADERS and
CODEX_CLI_HEADER_PASSTHROUGH_TEMPLATE as the migration targets.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@relay/common/override.go`:
- Around line 443-464: GetResponseHeaderPassThrough is currently collecting all
pass_response_headers entries by Mode without honoring Conditions, which can
leak headers from rules that should not apply. Update the header collection path
to use the same condition evaluation as applyOperations/checkConditions, ideally
by threading the evaluated context through GetResponseHeaderPassThrough or
reusing the filtered result from ApplyParamOverride so only condition-passing
names are returned.

In
`@web/default/src/features/channels/components/dialogs/param-override-editor-dialog.tsx`:
- Line 117: The new `pass_response_headers` placeholder in
`getModeValuePlaceholder()` is still hardcoded and not language-reactive. Add a
locale key for this placeholder and wrap the returned value in `t()` so the
`placeholder` prop in `ParamOverrideEditorDialog` updates with the active
language, consistent with `OPERATION_MODE_OPTIONS`, `MODE_DESCRIPTIONS`, and
`getModeValueLabel()`.

---

Nitpick comments:
In `@relay/common/override_test.go`:
- Around line 1394-1423: The new test in
TestApplyParamOverridePassResponseHeadersNoopsRequestBody should follow the
project’s testify conventions instead of using t.Fatalf and reflect.DeepEqual.
Update the fatal setup/error checks in ApplyParamOverrideWithRelayInfo to use
require, and replace the value comparison for GetResponseHeaderPassThrough with
assert. Keep the test behavior the same while using testify helpers consistently
throughout the test.

In `@relay/common/override.go`:
- Around line 1305-1389: Add a deny-list guard for sensitive response headers
before accepting wildcard pass-through patterns. The issue is in
`parseHeaderPassThroughNames`/`GetResponseHeaderPassThrough`, where broad values
like `*` or `set-*` can later be matched by
`shouldCopyResponseHeaderPassThrough` and leak headers such as `Set-Cookie` or
`Authorization`. Update the parsing/validation path to reject or filter reserved
sensitive names and wildcard patterns that would match them, so only safe
headers are allowed through.

In
`@web/default/src/features/channels/components/dialogs/param-override-editor-dialog.tsx`:
- Around line 323-336: The Codex response header allowlist and header template
logic are duplicated in param-override-editor-dialog and the channel-affinity
constants, so they can drift out of sync. Extract the shared header constants
and template builder into a common module, then import and reuse them from both
the dialog code and the system-settings channel-affinity code, using the
existing symbols CODEX_CLI_RESPONSE_HEADER_PASSTHROUGH_HEADERS and
CODEX_CLI_HEADER_PASSTHROUGH_TEMPLATE as the migration targets.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f69cd023-c4e1-4ea0-bafe-2b4bba08bc1a

📥 Commits

Reviewing files that changed from the base of the PR and between 02f7083 and 1bd2059.

📒 Files selected for processing (20)
  • relay/channel/codex/adaptor.go
  • relay/channel/gemini/relay_responses.go
  • relay/channel/openai/adaptor.go
  • relay/channel/openai/chat_via_responses.go
  • relay/channel/openai/relay_responses.go
  • relay/channel/openai/relay_responses_compact.go
  • relay/channel/openai/responses_via_chat.go
  • relay/common/override.go
  • relay/common/override_test.go
  • relay/helper/stream_scanner.go
  • relay/helper/stream_scanner_test.go
  • service/channel_affinity_template_test.go
  • setting/operation_setting/channel_affinity_setting.go
  • web/classic/src/components/table/channels/modals/ParamOverrideEditorModal.jsx
  • web/classic/src/components/table/usage-logs/modals/ParamOverrideModal.jsx
  • web/classic/src/constants/channel-affinity-template.constants.js
  • web/default/src/features/channels/components/dialogs/param-override-editor-dialog.tsx
  • web/default/src/features/system-settings/general/channel-affinity/constants.ts
  • web/default/src/features/system-settings/general/channel-affinity/rule-editor-dialog.tsx
  • web/default/src/features/usage-logs/lib/format.ts
✅ Files skipped from review due to trivial changes (1)
  • web/default/src/features/system-settings/general/channel-affinity/rule-editor-dialog.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • service/channel_affinity_template_test.go

Comment thread relay/common/override.go Outdated
{ label: 'Return Custom Error', value: 'return_error' },
{ label: 'Prune Object Items', value: 'prune_objects' },
{ label: 'Pass Through Headers', value: 'pass_headers' },
{ label: 'Pass Through Response Headers', value: 'pass_response_headers' },

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check how OPERATION_MODE_OPTIONS labels and MODE_DESCRIPTIONS are rendered
# in the JSX to determine if t() is applied at the call site.
rg -n "OPERATION_MODE_OPTIONS\|MODE_DESCRIPTIONS\|getModeValueLabel\|getModeValuePlaceholder" \
  web/default/src/features/channels/components/dialogs/param-override-editor-dialog.tsx \
  | head -40

Repository: QuantumNous/new-api

Length of output: 157


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="web/default/src/features/channels/components/dialogs/param-override-editor-dialog.tsx"

echo "== outline =="
ast-grep outline "$FILE" --view expanded || true

echo
echo "== relevant snippets =="
nl -ba "$FILE" | sed -n '1,260p'
echo
nl -ba "$FILE" | sed -n '260,420p'
echo
nl -ba "$FILE" | sed -n '420,760p'

Repository: QuantumNous/new-api

Length of output: 4029


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="web/default/src/features/channels/components/dialogs/param-override-editor-dialog.tsx"

echo "== imports and option/description definitions =="
sed -n '1,260p' "$FILE" | cat -n

echo
echo "== helper usages and JSX =="
rg -n -C 4 "getModeValueLabel|getModeValuePlaceholder|MODE_DESCRIPTIONS|OPERATION_MODE_LABEL_MAP|useTranslation|t\(" "$FILE"

Repository: QuantumNous/new-api

Length of output: 50375


Wrap the new pass_response_headers placeholder in t().
OPERATION_MODE_OPTIONS, MODE_DESCRIPTIONS, and getModeValueLabel() already go through t() at render time, but getModeValuePlaceholder('pass_response_headers') is still passed straight to placeholder, so this new user-facing string remains hardcoded. Add a locale key and translate it here to keep the field language-reactive.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@web/default/src/features/channels/components/dialogs/param-override-editor-dialog.tsx`
at line 117, The new `pass_response_headers` placeholder in
`getModeValuePlaceholder()` is still hardcoded and not language-reactive. Add a
locale key for this placeholder and wrap the returned value in `t()` so the
`placeholder` prop in `ParamOverrideEditorDialog` updates with the active
language, consistent with `OPERATION_MODE_OPTIONS`, `MODE_DESCRIPTIONS`, and
`getModeValueLabel()`.

Source: Coding guidelines

@seefs001
seefs001 marked this pull request as ready for review July 10, 2026 00:27
@seefs001
seefs001 force-pushed the fix/codex-upstream-sync branch from 6c48462 to 53a729e Compare July 10, 2026 02:00
@seefs001
seefs001 marked this pull request as draft July 10, 2026 02:02

@coderabbitai coderabbitai Bot left a comment

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.

🧹 Nitpick comments (3)
relay/helper/stream_scanner_test.go (1)

103-117: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Initialize the affinity fixture explicitly.

Lines 109-112 rely on ambient channel-affinity configuration and ignore selection success. Create scoped rule/cache state and assert the affinity lookup succeeds before applying the template; this keeps the parallel test deterministic.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@relay/helper/stream_scanner_test.go` around lines 103 - 117, Make
TestStreamScannerHandler_CopiesCodexResponseHeaders initialize its
channel-affinity rule and cache state explicitly within the test scope, rather
than relying on ambient configuration. Assert that GetPreferredChannelByAffinity
succeeds and returns the expected channel before calling
ApplyChannelAffinityOverrideTemplate, preserving deterministic behavior under
t.Parallel.

Source: Coding guidelines

web/classic/src/components/table/channels/modals/ParamOverrideEditorModal.jsx (1)

1081-1088: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Static-analysis "missing key" hint at 2166-2179 is a false positive.

The mapped list root (the outer div) already carries key={operation.id}; the flagged nested <Tag> doesn't need its own key. The i18n-wrapping refactor itself (operationModeOptions, translated tag labels/descriptions) looks correct and consistent.

Also applies to: 2034-2034, 2173-2179, 2255-2255, 2289-2289

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@web/classic/src/components/table/channels/modals/ParamOverrideEditorModal.jsx`
around lines 1081 - 1088, The static-analysis missing-key warnings are false
positives: preserve the existing outer list key, such as operation.id, and do
not add redundant keys to nested Tag elements. Keep the operationModeOptions
useMemo translation and related translated labels/descriptions unchanged.

Source: Linters/SAST tools

web/default/src/features/channels/components/dialogs/param-override-editor-dialog.tsx (1)

298-358: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Codex header allowlists are duplicated across two web/default files.

CODEX_CLI_HEADER_PASSTHROUGH_HEADERS and CODEX_CLI_SSE_HEADER_PASSTHROUGH_HEADERS are declared locally here and separately in web/default/src/features/system-settings/general/channel-affinity/constants.ts (which also has a buildCodexPassHeadersTemplate() helper this file doesn't reuse). They currently match, but this PR triples the duplicated surface by adding a second list (SSE headers) in the same pattern that caused the original bug (#6016: header allowlist drift). Consider importing the shared lists/helper from constants.ts (or a new shared module) instead of maintaining a third copy.

Also applies to: 383-395

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@web/default/src/features/channels/components/dialogs/param-override-editor-dialog.tsx`
around lines 298 - 358, Remove the locally duplicated
CODEX_CLI_HEADER_PASSTHROUGH_HEADERS and
CODEX_CLI_SSE_HEADER_PASSTHROUGH_HEADERS declarations, and import the shared
allowlists (and buildCodexPassHeadersTemplate() where applicable) from
constants.ts or a dedicated shared module. Update all consumers in this dialog
to use the shared definitions so header changes cannot drift between files.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@relay/helper/stream_scanner_test.go`:
- Around line 103-117: Make TestStreamScannerHandler_CopiesCodexResponseHeaders
initialize its channel-affinity rule and cache state explicitly within the test
scope, rather than relying on ambient configuration. Assert that
GetPreferredChannelByAffinity succeeds and returns the expected channel before
calling ApplyChannelAffinityOverrideTemplate, preserving deterministic behavior
under t.Parallel.

In
`@web/classic/src/components/table/channels/modals/ParamOverrideEditorModal.jsx`:
- Around line 1081-1088: The static-analysis missing-key warnings are false
positives: preserve the existing outer list key, such as operation.id, and do
not add redundant keys to nested Tag elements. Keep the operationModeOptions
useMemo translation and related translated labels/descriptions unchanged.

In
`@web/default/src/features/channels/components/dialogs/param-override-editor-dialog.tsx`:
- Around line 298-358: Remove the locally duplicated
CODEX_CLI_HEADER_PASSTHROUGH_HEADERS and
CODEX_CLI_SSE_HEADER_PASSTHROUGH_HEADERS declarations, and import the shared
allowlists (and buildCodexPassHeadersTemplate() where applicable) from
constants.ts or a dedicated shared module. Update all consumers in this dialog
to use the shared definitions so header changes cannot drift between files.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8078da07-18c4-4bfa-b422-3487d43a6325

📥 Commits

Reviewing files that changed from the base of the PR and between 6c48462 and 53a729e.

📒 Files selected for processing (36)
  • dto/openai_request.go
  • dto/openai_request_zero_value_test.go
  • dto/openai_response.go
  • dto/openai_responses_compaction_request.go
  • relay/channel/api_request_test.go
  • relay/channel/claude/relay-claude.go
  • relay/channel/openai/relay_responses.go
  • relay/channel/openai/relay_responses_compact.go
  • relay/chat_completions_via_responses_test.go
  • relay/common/override.go
  • relay/common/override_test.go
  • relay/common/relay_info.go
  • relay/helper/stream_scanner.go
  • relay/helper/stream_scanner_test.go
  • relay/responses_handler.go
  • service/channel_affinity_template_test.go
  • service/relayconvert/responses_request_to_chat.go
  • service/relayconvert/responses_request_to_chat_test.go
  • service/relayconvert/responses_to_chat.go
  • setting/operation_setting/channel_affinity_setting.go
  • setting/ratio_setting/cache_ratio.go
  • web/classic/src/components/table/channels/modals/ParamOverrideEditorModal.jsx
  • web/classic/src/components/table/usage-logs/modals/ParamOverrideModal.jsx
  • web/classic/src/constants/channel-affinity-template.constants.js
  • web/default/src/features/channels/components/dialogs/param-override-editor-dialog.tsx
  • web/default/src/features/system-settings/general/channel-affinity/constants.ts
  • web/default/src/features/system-settings/general/channel-affinity/rule-editor-dialog.tsx
  • web/default/src/features/usage-logs/lib/format.ts
  • web/default/src/i18n/locales/en.json
  • web/default/src/i18n/locales/fr.json
  • web/default/src/i18n/locales/ja.json
  • web/default/src/i18n/locales/ru.json
  • web/default/src/i18n/locales/vi.json
  • web/default/src/i18n/locales/zh-TW.json
  • web/default/src/i18n/locales/zh.json
  • web/default/src/i18n/static-keys.ts
✅ Files skipped from review due to trivial changes (5)
  • web/default/src/features/system-settings/general/channel-affinity/rule-editor-dialog.tsx
  • web/default/src/i18n/locales/ja.json
  • web/default/src/i18n/locales/ru.json
  • web/default/src/i18n/locales/zh.json
  • web/default/src/i18n/locales/en.json
🚧 Files skipped from review as they are similar to previous changes (5)
  • relay/chat_completions_via_responses_test.go
  • relay/channel/api_request_test.go
  • setting/operation_setting/channel_affinity_setting.go
  • dto/openai_request_zero_value_test.go
  • service/channel_affinity_template_test.go

@jjcc123312

Copy link
Copy Markdown

请问这个pr是 fix了curl方式请求codex 5.6-luna “not fond model”的issue吗

@seefs001

Copy link
Copy Markdown
Collaborator Author

请问这个pr是 fix了curl方式请求codex 5.6-luna “not fond model”的issue吗

不是,仅仅是按照codex的代码去补充一下使用codex时需要默认透传的请求头和sse响应头。

至于找不到模型不属于该处理的问题,本项目不处理不通过codex cli使用codex渠道出现的错误,不对codex渠道使用提供技术支持。

@seefs001
seefs001 force-pushed the fix/codex-upstream-sync branch from a326773 to d1e79fb Compare July 11, 2026 02:54
@seefs001
seefs001 marked this pull request as ready for review July 11, 2026 02:55
@Calcium-Ion
Calcium-Ion merged commit dad57a6 into QuantumNous:main Jul 11, 2026
1 check passed
agogo233 added a commit to agogo233/new-api that referenced this pull request Jul 13, 2026
* upstream/main: (56 commits)
  fix: list only channel models in unset price models tab
  fix: harden unset price models tab batch copy, feedback, and memo equality
  feat: add unset price models tab to model pricing settings (QuantumNous#6124)
  feat: enhance model search functionality with status and sync filters
  fix: bound uncached remainder by prompt-max(cached,write) and forward compact prompt_cache_key
  feat: bill OpenAI cache_write_tokens at cache-creation price with zero clamp
  feat: enhance text protocol conversion and advanced custom routing (QuantumNous#5825)
  fix: adjust margin for StatusBadge component in logs columns
  feat: enhance stale instance handling and update theme colors
  feat: update theme colors
  feat(timing): add timing metrics display for stream logs and enhance localization
  revert: restore StatusBadge horizontal padding
  revert: undo t0ng7u UI design-system refactor
  ✨ feat(web): polish themed data views and add task log details
  feat(image): enhance image stream handling with client disconnect logic and billing adjustments
  fix(billing): improve quota handling and error reporting for pre-consume operations
  fix(billing): reject saturated pre-consume quota
  🐛 fix: Fontsource asset resolution across workspace layouts
  fix: sync codex field (QuantumNous#6018)
  chore(deps): bump golang.org/x/crypto from 0.51.0 to 0.52.0 (QuantumNous#6096)
  ...
lansine pushed a commit to evin-pubb/new-api-fork that referenced this pull request Jul 14, 2026
zhaodechao2008 pushed a commit to zhaodechao2008/new-api that referenced this pull request Jul 27, 2026
330079598 pushed a commit to 330079598/new-api that referenced this pull request Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

新版本Codex 修改了报文HTTP头字段名称,导致缓存命中率非常低

3 participants