fix(tmux): validate fallback port

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-04-27 14:24:42 +09:00
parent ac8987a732
commit acf293de96
2 changed files with 37 additions and 1 deletions
+5 -1
View File
@@ -72,7 +72,11 @@ export class TmuxSessionManager {
this.client = ctx.client
this.tmuxConfig = tmuxConfig
this.deps = deps
const defaultPort = process.env.OPENCODE_PORT ?? "4096"
const configuredPort = process.env.OPENCODE_PORT
const parsedPort = configuredPort ? Number(configuredPort) : 4096
const defaultPort = Number.isInteger(parsedPort) && parsedPort > 0 && parsedPort <= 65535
? String(parsedPort)
: "4096"
const fallbackUrl = `http://localhost:${defaultPort}`
const rawServerUrl = ctx.serverUrl?.toString()
try {