Omit service_tier from remote /responses/compact requests under API auth (#21676)

## Summary

API-key-auth remote compaction requests should not inherit
`service_tier` from normal `/responses` turns. This path needs to match
API auth expectations, while ChatGPT-auth remote compaction should keep
reusing the shared request fields that still apply there.

This change keeps the decision inline in
`codex-rs/core/src/compact_remote.rs` only. Under API key auth, the
classic remote `/responses/compact` path now omits `service_tier`; under
ChatGPT auth, it keeps reusing the configured tier.
`codex-rs/core/src/compact_remote_v2.rs` is unchanged. The remote
compaction parity coverage and snapshots were updated to assert the
API-key omission and preserve the ChatGPT-auth behavior.

## Testing

- Updated remote compaction parity coverage in
`codex-rs/core/tests/suite/compact_remote.rs` and the corresponding
snapshots.
This commit is contained in:
Ahmed Ibrahim
2026-05-08 11:15:14 +03:00
committed by GitHub
Unverified
parent d2e71db22a
commit 71d80f9a14
5 changed files with 14 additions and 8 deletions
+6 -1
View File
@@ -22,6 +22,7 @@ use codex_analytics::CompactionImplementation;
use codex_analytics::CompactionPhase;
use codex_analytics::CompactionReason;
use codex_analytics::CompactionTrigger;
use codex_app_server_protocol::AuthMode;
use codex_protocol::error::CodexErr;
use codex_protocol::error::Result as CodexResult;
use codex_protocol::items::ContextCompactionItem;
@@ -197,7 +198,11 @@ async fn run_remote_compact_task_inner_impl(
CompactConversationRequestSettings {
effort: turn_context.reasoning_effort,
summary: turn_context.reasoning_summary,
service_tier: turn_context.config.service_tier.clone(),
service_tier: if sess.services.auth_manager.auth_mode() == Some(AuthMode::ApiKey) {
None
} else {
turn_context.config.service_tier.clone()
},
},
&turn_context.session_telemetry,
&compaction_trace,
-1
View File
@@ -208,7 +208,6 @@ fn should_use_remote_compact_task_for_azure_provider() {
assert!(should_use_remote_compact_task(&provider));
}
#[tokio::test]
async fn process_compacted_history_replaces_developer_messages() {
let compacted_history = vec![