Compare commits

..
Author SHA1 Message Date
anandh8x daabe11164 fix(providers): send stable session headers to OpenCode 2026-09-15 18:02:59 +05:30
2 changed files with 2 additions and 37 deletions

No files matched your search

+1 -20
View File
@@ -2254,19 +2254,6 @@ func TestResolveRejectsInvalidCrossSessionInbound(t *testing.T) {
}
func TestResolveReportsExplicitMaxTurns(t *testing.T) {
// A nil ResolveOptions.Env means "read the real process environment" (see
// envValue), so a case that leaves it nil inherits whatever the developer
// happens to export. ANTHROPIC_BASE_URL alone is enough: applyProviderEnv
// synthesizes a second, keyless "anthropic" profile from a base URL on its
// own, the single-provider shortcut in normalizeProviders stops applying,
// and Resolve fails with `active provider "" not found` before this test
// reaches its assertion. Every variable the resolver reads does it, so the
// cases below state an EMPTY environment rather than no environment, and
// these three are set to a hostile value so the test proves it.
t.Setenv("ANTHROPIC_BASE_URL", "https://proxy.example/v1")
t.Setenv("OPENAI_API_KEY", "from-the-developer-shell")
t.Setenv(MaxTurnsEnv, "7")
const providerJSON = `{
"activeProvider": "p",
"providers": [{"name": "p", "provider_kind": "openai-compatible", "base_url": "https://x.example/v1", "apiKey": "k", "model": "m"}]
@@ -2279,15 +2266,10 @@ func TestResolveReportsExplicitMaxTurns(t *testing.T) {
set bool
}{
{"built-in default only", ResolveOptions{
Env: map[string]string{},
Overrides: Overrides{Provider: ProviderProfile{Name: "p", ProviderKind: "openai-compatible", BaseURL: "https://x.example/v1", APIKey: "k", Model: "m"}},
}, false},
{"user config", ResolveOptions{
Env: map[string]string{},
UserConfigPath: writeConfig(t, providerWithTurns),
}, true},
{"user config", ResolveOptions{UserConfigPath: writeConfig(t, providerWithTurns)}, true},
{"project config", ResolveOptions{
Env: map[string]string{},
UserConfigPath: writeConfig(t, providerJSON),
ProjectConfigPath: writeConfig(t, `{"maxTurns": 40}`),
}, true},
@@ -2296,7 +2278,6 @@ func TestResolveReportsExplicitMaxTurns(t *testing.T) {
Overrides: Overrides{Provider: ProviderProfile{Name: "p", ProviderKind: "openai-compatible", BaseURL: "https://x.example/v1", APIKey: "k", Model: "m"}},
}, true},
{"cli override", ResolveOptions{
Env: map[string]string{},
Overrides: Overrides{
MaxTurns: 42,
Provider: ProviderProfile{Name: "p", ProviderKind: "openai-compatible", BaseURL: "https://x.example/v1", APIKey: "k", Model: "m"},
+1 -17
View File
@@ -2,7 +2,6 @@ package tui
import (
"context"
"path/filepath"
"strings"
"testing"
@@ -113,22 +112,7 @@ func TestMouseWheelOnClippedFooterStatusDoesNotMoveComposerCursor(t *testing.T)
}
func TestAltScreenTranscriptScrollKeepsFooterFixed(t *testing.T) {
// Cwd is pinned because an empty Options.Cwd makes newModel take the real
// working directory, which at test time is this package inside whoever's
// checkout, and the branch assertion below is not a monotonic function of
// that path's length. The title bar picks the widest candidate that fits:
// workspace carries branch AND path, cwdOnly carries only the path, and
// compactLeft carries only the branch. At width 90 with this branch, a cwd
// of up to 52 bytes keeps branch and path, 53 to 74 falls to path-only and
// loses the branch, and 75 or more falls again to branch-only and gets it
// back. So this failed from a checkout 74 bytes deep and passed from one 80
// bytes deep, while CI sits at 40 and never sees it.
m := newModel(context.Background(), Options{
AltScreen: true,
ProviderName: "openai",
ModelName: "gpt-4.1",
Cwd: filepath.Join(string(filepath.Separator), "workspace", "zero"),
})
m := newModel(context.Background(), Options{AltScreen: true, ProviderName: "openai", ModelName: "gpt-4.1"})
m.width = 90
m.height = 10
m.gitBranch = "feat/pinned-header"