[Bug]: desktop takeover always fails on a default-bind install: tracked-runtime-inspection reads an absent record hostname as "" while resolve reports 127.0.0.1
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- typescript
Direzione di ricerca
Read src/config/tracked-runtime-inspection.ts, src/server/proxy-liveness.ts, and src/cli/stop-approval.ts to trace how an absent hostname is read and compared; inspect the regression tests in linked PR #8182. Reproduce with a default-bind runtime record that omits hostname. Done means takeover approval accepts the valid record and safely stops the runtime, with tests covering the absent-hostname case.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Client or integration
Codex App
Area
Service lifecycle
Summary
On a default-bind install (config.hostname unset), the desktop's approved takeover never succeeds. Approving the "A runtime is already listening. Take it over?" prompt ends in:
state: taking-over
reason: the guarded stop could not confirm the approved runtime:
The approved runtime or managing CLI changed: the tracked runtime record changed; no stop was attempted.
runtime process: still running or never started
The old runtime is never signalled, so the desktop waits ~165 s and the port stays occupied. Retrying cannot help: nothing rewrites the record while the old runtime keeps serving.
The cause is two readers of the same runtime-port.json disagreeing about an absent optional field. hostname is optional in the record schema, and a default bind has no configured value to persist, so the writer drops the key. Liveness discovery then defaults it to loopback for its verdict, while the guarded stop defaults it to "" for comparison — so the guard compares "" against "127.0.0.1" and always reports drift.
Reproduction
Environment: Desktop 2.97.0 (notarized), CLI on PATH 2.97.0, the runtime it wanted to stop was 2.96.0 started by the launchd service com.opencodex.proxy, config home ~/.opencodex, port 10100 (default), config.hostname unset.
- Install the CLI and start the proxy through the service on a default bind:
ocx service install && ocx service start - Confirm the record has no
hostnamekey:cat ~/.opencodex/runtime-port.json # {"pid":32333,"port":10100,"attestationSecret":"..."} <- no hostname - Launch the desktop app while that runtime is still running, and approve the takeover prompt.
Expected: the approved runtime is stopped and the desktop starts its own.
Actual: approval-changed / the tracked runtime record changed, runtime still running, and the record's mtime never changes.
Root cause, with hostname optional in the record (src/config/process-state.ts:37, and isValidRuntimePortState accepts undefined):
- The writer drops it when nothing is configured:
src/cli/index.ts:609writeshostname: bound.config.hostname, which isundefinedfor a default bind, soJSON.stringifyomits the key. src/server/proxy-liveness.ts:525reads absence as loopback (opts.hostname?.trim() || "127.0.0.1"), soocx resolve --jsonreportsliveness.hostname: "127.0.0.1"for that record.src/config/tracked-runtime-inspection.ts:150reads absence as""(hostname: parsed.hostname ?? "").- The desktop forwards the discovered value as the approved expectation (
desktop/src-tauri/src/runtime_stop.rs:254,--expect-hostname), andsrc/cli/stop-approval.ts:147-149compares the two directly: pid and port match,"" !== "127.0.0.1", so it returnsapprovalChanged("the tracked runtime record changed").
Observed ocx resolve --json in the failing state (abridged):
{"liveness":{"status":"live","pid":32333,"port":10100,"source":"runtime","hostname":"127.0.0.1","version":"2.96.0"},
"takeover":{"kind":"supported","protocolVersion":1,"minimumCliVersion":"2.61.0","token":"..."}}
Proposed fix: treat an absent record hostname as unknown rather than an empty host, compare bind scope through probeHostname only when the record carries one, and persist the scope the listener actually bound. Patch with regression tests: #8182.
Version
Desktop 2.97.0; the running proxy it refused to stop was 2.96.0.
Operating system
macOS 27.2 (26B123), arm64 (Apple M4 Max)
Provider and model
No response
Logs or error output
$ cat ~/.opencodex/runtime-port.json
{"pid":32333,"port":10100,"attestationSecret":"..."}
$ ocx resolve --json | jq '.liveness'
{"status":"live","pid":32333,"port":10100,"source":"runtime","hostname":"127.0.0.1","version":"2.96.0"}
# desktop, after approving the takeover
state: taking-over
reason: the guarded stop could not confirm the approved runtime: The approved runtime or managing CLI changed: the tracked runtime record changed; no stop was attempted.
runtime process: still running or never started
Workaround that avoids the takeover entirely: quit the desktop, ocx service stop, ocx service uninstall, reopen the app so it supervises its own runtime, then ocx restore back to re-point Codex at that proxy.
Not a duplicate of #7771: there the Windows Task Scheduler registration survives and the port is never freed. Here no manager stop is ever attempted — the guard refuses first, on a valid record that simply omits an optional field.
Screenshots and supporting files
No response
Redacted configuration
No response
Checks
- I searched existing issues and documentation.
- I removed secrets, tokens, account details, request credentials, and personal data.
- Lingua principale
- TypeScript
- Stelle
- 16.9k
- Fork
- 1.3k
- Merge medio
- 23h
- PR unite (30g)
- 687
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di lidge-jun/opencodex
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
bug gui
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
lidge-jun/opencodex#8344 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Claude account rows no longer show the email (since #8055), so "Account 1, 2, 3" cannot be told apartForse già presa @lidge-jun l’ha presa oggi. Apertaaccount-pool bug gui
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
lidge-jun/opencodex#8286 · 5 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement provider streaming
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
lidge-jun/opencodex#8363 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di lidge-jun/opencodex
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
earendil-works/pi-claude-code#36 ·
I maintainer di solito rispondono entro 6 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Resources: New work of jabodetabekForse già presa @rmt-svc l’ha presa oggi. Apertaresources
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
railmapgen/rmp-gallery#4167 ·
I maintainer di solito rispondono entro 2 giorni
-
documentation p1
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
microsoft/monaco-editor#5577 ·
I maintainer di solito rispondono entro 1 giorno