The Codex row on the Agents page now has an Open button beside the start button. It opens the Codex desktop app (mac and Windows) when it is installed, else Codex's CLI in a terminal. "Open Codex with" in Codex's details (Automatic, Codex app, Terminal) picks which; it is this computer's own setting (settings.CodexOpen, kept across a sync and a Settings save). The row menu's Open in terminal still opens the terminal. The web build has no button. Run (mica): go test internal/gui, agent, settings, settingsapi, provider ok; gofmt clean; GOOS=windows vet and GOOS=linux -tags nogui vet clean; GUI codex-open-button (62), agent-open-terminal (24), i18n-keys, codex-service-tier in chromium and webkit, en/zh/zh-TW/ja/de, narrow. agent-prefs lists the new row. Broken by hand: codexOpensApp always false turns TestCodexOpenButton red. Budget: coreScriptBudget +1,112 for this code, packed small, no page to move it to. Reds on main before this change, same count ate18aca103without it: agent-details-ready (16 chromium), gui-ja and gui-de (one string), agent-prefs panel-sheet test (5 chromium), and from4e0026661plugin-signed-out-account, plugin-signin-no-url, saved-signedout-remove, signin-proxy. Not caused here; not fixed here. Not tried: a real Windows launch of the Codex app, a real macOS app open, Linux.
47 lines
1.7 KiB
Go
47 lines
1.7 KiB
Go
package agent
|
|
|
|
import (
|
|
"context"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
// Codex's Open button (Yink88564391 on X): on a Mac it opens the bundle
|
|
// whose Info.plist says com.openai.codex, never the ChatGPT chat app's
|
|
// of the same name; on Windows it starts the Store package's app; with no
|
|
// app installed it opens nothing and says so.
|
|
func TestOpenCodexApp(t *testing.T) {
|
|
restartSandbox(t)
|
|
apps := filepath.Join(t.TempDir(), "Applications")
|
|
appFolders = func() []string { return []string{apps} }
|
|
var opened []string
|
|
appOpen = func(_ context.Context, b string) error { opened = append(opened, b); return nil }
|
|
var launched []winProc
|
|
winLaunch = func(p winProc) error { launched = append(launched, p); return nil }
|
|
|
|
restartOnMac = true
|
|
if CodexAppInstalled() || OpenCodexApp(context.Background()) == nil || len(opened) != 0 {
|
|
t.Fatalf("no app installed, yet installed=%v opened=%q", CodexAppInstalled(), opened)
|
|
}
|
|
installApp(t, apps, "ChatGPT.app", codexAppPlist("com.openai.chat", "1.2026.280"))
|
|
if CodexAppInstalled() || OpenCodexApp(context.Background()) == nil || len(opened) != 0 {
|
|
t.Fatalf("the chat app taken for Codex's: opened %q", opened)
|
|
}
|
|
installApp(t, apps, "Codex.app", codexAppPlist("com.openai.codex", "26.930.31730"))
|
|
if !CodexAppInstalled() {
|
|
t.Fatal("Codex.app not seen")
|
|
}
|
|
if err := OpenCodexApp(context.Background()); err != nil || len(opened) != 1 || opened[0] != filepath.Join(apps, "Codex.app") {
|
|
t.Fatalf("opened %q (%v)", opened, err)
|
|
}
|
|
|
|
// Linux has no launcher magpie starts
|
|
restartOnMac = false
|
|
if CodexAppInstalled() || OpenCodexApp(context.Background()) == nil {
|
|
t.Fatal("offered to open the app where magpie cannot")
|
|
}
|
|
if len(launched) != 0 {
|
|
t.Fatalf("launched %v off Windows", launched)
|
|
}
|
|
}
|