Client stop paths treat EPERM as a confirmed exit and drop state for a live companion
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 52/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- node.js, typescript
- Ambito
- cli
Direzione di ricerca
Read the two stop paths in src/client/client-companion-tunnel.ts and src/metro/client-metro.ts, then compare their behavior with the daemon stopper in packages/daemon-contracts/src/daemon-process.ts. Trace the callers that delete companion state or swallow errors, and check the close-code path in src/client/client-companion-tunnel-worker.ts. Done means live processes keep tracked state and report a typed failure, confirmed exits report stopped, and close-code behavior stays unchanged.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happens
A companion (or a dev server we spawned) that refuses our signal because it belongs to another user
is recorded as stopped, and its tracked state is deleted while the process keeps running.
Reproduce the companion case with a companion started under another owner (for example via sudo),
then run any command that ends the Metro/DevTools companion tunnel:
agent-device connect --remote-config /tmp/remote.json --proxy-base-url https://bridge.example.test
sudo <start a companion for the same profile> # owns the recorded pid
agent-device disconnect --remote-config /tmp/remote.json
agent-device connect --remote-config /tmp/remote.json # starts a *second* companion
disconnect reports success, ~/.agent-device/.agent-device companion state is gone, and the next
connect spawns a second companion while the first is still registered for the same bridge scope.
Why
Both client stop paths read EPERM from process.kill as "already exited" and return early:
stopCompanionProcessinsrc/client/client-companion-tunnel.ts(~283-305) returns, and both
callers then delete the state file, sostopCompanionTunnelreportsstopped: trueand the next
ensureCompanionTunnelstarts a companion beside the surviving one.stopSpawnedMetroProcessinsrc/metro/client-metro.ts(~412-429) does the same, and its only
caller (~851) ends in.catch(() => {}), so even its throw branches are unobservable.
EPERM means the opposite of absence: the process exists and is not ours to signal. Only ESRCH, or
a liveness probe that stops answering, proves an exit. The daemon's own stopper already gets this
right — packages/daemon-contracts/src/daemon-process.ts (~145-175) reports retained /
signal-failed instead of dropping its registration.
Expected
Signal, then confirm. A stop reports stopped only for a process whose exit was confirmed; a
process that survived every signal keeps its tracked state and fails with a typed reason, so a retry
stops the same process instead of starting a second one.
Also in this area
normalizeCloseCode's keep-list in src/client/client-companion-tunnel-worker.ts (~209-223) is dead
for codes 1001-1015 and the 1011 fallback, because the only path through it
(~401 → ~277) runs normalizeOutgoingCloseCode afterwards. The two should be one function with no
wire-behavior change.
- Lingua principale
- TypeScript
- Stelle
- 4.9k
- Fork
- 328
- Merge medio
- 11h 49m
- PR unite (30g)
- 585
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
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 callstack/agent-device
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
callstack/agent-device#3407 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
callstack/agent-device#3353 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
callstack/agent-device#1869 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement needs-triage
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
callstack/agent-device#3531 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement needs-triage
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
callstack/agent-device#3529 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di callstack/agent-device
Issue simili
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 70/100
siyuan-note/siyuan#20517 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
NaturalIntelligence/fast-xml-parser#890 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
zsviczian/obsidian-excalidraw-plugin#3000 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
pnpm/get.pnpm.io#68 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
nuxt-modules/better-auth#578 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno