| @@ -30,7 +30,7 @@ func TestIsCodexMultiAgentClient(t *testing.T) { · 29 unmodified lines |
| 30 | }, | 30 | }, |
| 31 | { | 31 | { |
| 32 | name: "codex tui", | 32 | name: "codex tui", |
| 33 | userAgent: "codex-tui/0.145.0 (Mac OS 26.5.2; arm64) iTerm.app/3.6.11 (codex-tui; 0.145.0)", | 33 | userAgent: "codex-tui/0.153.3 (Mac OS 26.5.1; arm64) iTerm.app/3.6.11 (codex-tui; 0.153.3)", |
| 34 | want: true, | 34 | want: true, |
| 35 | }, | 35 | }, |
| 36 | { | 36 | { |
| @@ -237,7 +237,7 @@ func TestOptimizeCodexMultiAgentV2RequestSkipsNamespaceConflict(t *testing.T) { · 200 unmodified lines |
| 237 | t.Parallel() | 237 | t.Parallel() |
| 238 | | 238 | |
| 239 | payload := []byte(`{"tools":[{"type":"namespace","name":"collaboration","tools":[{"type":"function","name":"spawn_agent"}]},{"type":"namespace","name":"collaboration-optimize","tools":[]}]}`) | 239 | payload := []byte(`{"tools":[{"type":"namespace","name":"collaboration","tools":[{"type":"function","name":"spawn_agent"}]},{"type":"namespace","name":"collaboration-optimize","tools":[]}]}`) |
| 240 | headers := http.Header{"User-Agent": []string{"codex-tui/0.145.0"}} | 240 | headers := http.Header{"User-Agent": []string{"codex-tui/0.153.3"}} |
| 241 | cfg := &config.Config{Codex: config.CodexConfig{OptimizeMultiAgentV2: true}} | 241 | cfg := &config.Config{Codex: config.CodexConfig{OptimizeMultiAgentV2: true}} |
| 242 | got, optimized := OptimizeCodexMultiAgentV2Request(context.Background(), headers, payload, cfg) | 242 | got, optimized := OptimizeCodexMultiAgentV2Request(context.Background(), headers, payload, cfg) |
| 243 | if optimized { | 243 | if optimized { |
| @@ -516,13 +516,13 @@ func TestRewriteCodexMultiAgentV2InputConditions(t *testing.T) { · 272 unmodified lines |
| 516 | { | 516 | { |
| 517 | name: "codex tui enabled", | 517 | name: "codex tui enabled", |
| 518 | cfg: &config.Config{Codex: config.CodexConfig{OptimizeMultiAgentV2: true}}, | 518 | cfg: &config.Config{Codex: config.CodexConfig{OptimizeMultiAgentV2: true}}, |
| 519 | userAgent: "codex-tui/0.145.0", | 519 | userAgent: "codex-tui/0.153.3", |
| 520 | want: true, | 520 | want: true, |
| 521 | }, | 521 | }, |
| 522 | { | 522 | { |
| 523 | name: "optimization disabled", | 523 | name: "optimization disabled", |
| 524 | cfg: &config.Config{}, | 524 | cfg: &config.Config{}, |
| 525 | userAgent: "codex-tui/0.145.0", | 525 | userAgent: "codex-tui/0.153.3", |
| 526 | }, | 526 | }, |
| 527 | { | 527 | { |
| 528 | name: "unrelated client", | 528 | name: "unrelated client", |
| @@ -607,7 +607,7 @@ func TestRewriteCodexSpawnAgentDescriptionDisabledLeavesPayloadUnchanged(t *test · 78 unmodified lines |
| 607 | t.Parallel() | 607 | t.Parallel() |
| 608 | | 608 | |
| 609 | payload := []byte(`{"tools":[{"type":"function","name":"spawn_agent","description":"unchanged","parameters":{"properties":{"message":{"encrypted":true}}}}]}`) | 609 | payload := []byte(`{"tools":[{"type":"function","name":"spawn_agent","description":"unchanged","parameters":{"properties":{"message":{"encrypted":true}}}}]}`) |
| 610 | headers := http.Header{"User-Agent": []string{"codex-tui/0.145.0"}} | 610 | headers := http.Header{"User-Agent": []string{"codex-tui/0.153.3"}} |
| 611 | got := RewriteCodexSpawnAgentDescription(context.Background(), headers, payload, &config.Config{}) | 611 | got := RewriteCodexSpawnAgentDescription(context.Background(), headers, payload, &config.Config{}) |
| 612 | if string(got) != string(payload) { | 612 | if string(got) != string(payload) { |
| 613 | t.Fatalf("disabled optimization changed payload: %s", got) | 613 | t.Fatalf("disabled optimization changed payload: %s", got) |
| @@ -645,13 +645,13 @@ func TestReplaceCodexSpawnAgentModelsNormalizesSectionsAndPreservesInstructions( · 31 unmodified lines |
| 645 | func TestCodexClientUserAgentPrefersGinRequest(t *testing.T) { | 645 | func TestCodexClientUserAgentPrefersGinRequest(t *testing.T) { |
| 646 | gin.SetMode(gin.TestMode) | 646 | gin.SetMode(gin.TestMode) |
| 647 | request := httptest.NewRequest(http.MethodPost, "/v1/responses", nil) | 647 | request := httptest.NewRequest(http.MethodPost, "/v1/responses", nil) |
| 648 | request.Header.Set("User-Agent", "codex-tui/0.145.0") | 648 | request.Header.Set("User-Agent", "codex-tui/0.153.3") |
| 649 | ginCtx, _ := gin.CreateTestContext(httptest.NewRecorder()) | 649 | ginCtx, _ := gin.CreateTestContext(httptest.NewRecorder()) |
| 650 | ginCtx.Request = request | 650 | ginCtx.Request = request |
| 651 | ctx := context.WithValue(context.Background(), "gin", ginCtx) | 651 | ctx := context.WithValue(context.Background(), "gin", ginCtx) |
| 652 | headers := http.Header{"User-Agent": []string{"overridden-client/1.0"}} | 652 | headers := http.Header{"User-Agent": []string{"overridden-client/1.0"}} |
| 653 | | 653 | |
| 654 | if got := codexClientUserAgent(ctx, headers); got != "codex-tui/0.145.0" { | 654 | if got := codexClientUserAgent(ctx, headers); got != "codex-tui/0.153.3" { |
| 655 | t.Fatalf("codexClientUserAgent() = %q, want gin request User-Agent", got) | 655 | t.Fatalf("codexClientUserAgent() = %q, want gin request User-Agent", got) |
| 656 | } | 656 | } |
| 657 | } | 657 | } |
| @@ -785,7 +785,7 @@ func TestOptimizeCodexMultiAgentV2RequestRemovesEncryptionInAdditionalTools(t *t · 127 unmodified lines |
| 785 | ]} | 785 | ]} |
| 786 | ] | 786 | ] |
| 787 | }`) | 787 | }`) |
| 788 | headers := http.Header{"User-Agent": []string{"codex-tui/0.145.0"}} | 788 | headers := http.Header{"User-Agent": []string{"codex-tui/0.153.3"}} |
| 789 | cfg := &config.Config{Codex: config.CodexConfig{OptimizeMultiAgentV2: true}} | 789 | cfg := &config.Config{Codex: config.CodexConfig{OptimizeMultiAgentV2: true}} |
| 790 | got, _ := OptimizeCodexMultiAgentV2Request(context.Background(), headers, payload, cfg) | 790 | got, _ := OptimizeCodexMultiAgentV2Request(context.Background(), headers, payload, cfg) |
| 791 | | 791 | |