Client stop paths treat EPERM as a confirmed exit and drop state for a live companion
Mantenedores costumam responder em até 1 dia
Um pull request relacionado já foi integrado.
- #3551 de @thymikee — integrado
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 52/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- node.js, typescript
- Domínio
- cli
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- TypeScript
- Estrelas
- 5.1k
- Forks
- 339
- Merge médio
- 12h 57min
- PRs com merge (30d)
- 653
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de callstack/agent-device
-
Limrun iOS fill reports success but drops non-ASCII textTalvez já em andamento @mvanhorn assumiu há 4 dias. Abertabug ready-for-agent
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 87/100
callstack/agent-device#3819 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
callstack/agent-device#1869 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
callstack/agent-device#3931 ·
Mantenedores costumam responder em até 1 dia
-
bug needs-info
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 55/100
callstack/agent-device#3929 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
callstack/agent-device#3924 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
Todas as issues de callstack/agent-device
Issues semelhantes
-
[Bug]: Device screenshot fails with 500 on iPhone Duo (Xcode 27.2): serve-sim calls simctl without --displayTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
pingdotgg/t3code#24900 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
inu-appcenter/UNIDorm-web#411 ·
Mantenedores costumam responder em até 1 dia
-
🐛 bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Mantenedores costumam responder em até 2 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
ranxianglei/billion-context#4720 ·
Mantenedores costumam responder em até 1 dia
-
area:arcade game p3-medium ready-for-agent type:bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
fderuiter/deruiter.dev#2840 ·
Mantenedores costumam responder em até 1 dia