7dbfdcf081
mavgpud.service, the Maven GPU supervisor, is an enabled systemd user unit that binds *:8080 and restarts on kill. The correx server wanted the same port, so qa-stack died with BindException and the QA stack never came up. Worse, qa-stack's --stop ran `fuser -k 8080/tcp`, which killed mavgpud rather than a correx server; systemd then restarted it straight into the port it had just freed, so it won the race every time. Moves the default to 8090 in the four places that have to agree: ServerConfig, ConfigLoader's fallback, the CLI's DEFAULT_PORT, and the TUI's -port flag. A mismatch between any two of them is a client that cannot find its own server. The machine-local halves are not in this diff and were applied on disk: `~/.config/correx/config.toml` pinned `port = 8080` explicitly, which overrides the code default, and `scripts/` is gitignored so qa-stack.sh's five references (including the --stop kill, now aimed at 8090) live only on this box. Verified live: the server binds 8090 and answers /health while mavgpud keeps 8080. Left open in #695: mavgpud also spawns a llama-server on :10000, which is qa-stack's router port, and qa-stack pkills that pattern. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
43 lines
1021 B
Go
43 lines
1021 B
Go
// Command tui is the correx terminal UI: a Bubble Tea client that speaks the
|
|
// correx WebSocket protocol to apps/server.
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
|
|
tea "charm.land/bubbletea/v2"
|
|
"github.com/correx/tui-go/internal/app"
|
|
"github.com/correx/tui-go/internal/ws"
|
|
)
|
|
|
|
func main() {
|
|
host := flag.String("host", "localhost", "server host")
|
|
port := flag.Int("port", 8090, "server port")
|
|
flag.Parse()
|
|
|
|
if path := os.Getenv("CORREX_TUI_LOG"); path != "" {
|
|
f, err := tea.LogToFile(path, "tui")
|
|
if err != nil {
|
|
fmt.Fprintln(os.Stderr, "correx tui: cannot open log file:", err)
|
|
os.Exit(1)
|
|
}
|
|
defer f.Close()
|
|
app.EnableDebugLog()
|
|
}
|
|
|
|
client := ws.New(*host, *port)
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
defer cancel()
|
|
go client.Run(ctx)
|
|
|
|
// Alt-screen is requested per-frame via the View's AltScreen field in v2.
|
|
p := tea.NewProgram(app.NewModel(client))
|
|
if _, err := p.Run(); err != nil {
|
|
fmt.Fprintln(os.Stderr, "correx tui error:", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|