Client stop paths treat EPERM as a confirmed exit and drop state for a live companion
Les mainteneurs répondent en général sous 1 jour
Une pull request liée a déjà été fusionnée.
- #3551 par @thymikee — fusionnée
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 52/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- node.js, typescript
- Domaine
- cli
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- TypeScript
- Étoiles
- 5k
- Forks
- 334
- Merge moyen
- 11 h 48 min
- PR mergées (30 j)
- 605
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de callstack/agent-device
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
callstack/agent-device#3407 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
callstack/agent-device#3353 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
callstack/agent-device#1869 ·
Les mainteneurs répondent en général sous 1 jour
-
iOS: fill rejects the right text as `TEXT_ENTRY_MISMATCH` when the focused field moves while typing (since 0.21.25)Peut-être pris @Lanchez l’a pris aujourd’hui. Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 42/100
callstack/agent-device#3595 ·
Les mainteneurs répondent en général sous 1 jour
-
`fold` always fails on Xcode 27.1 RC: its pose check calls `devicectl device motion hinge-angle`, which this devicectl doesn't havePeut-être pris @thymikee l’a pris aujourd’hui. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
callstack/agent-device#3581 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de callstack/agent-device
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
status:approved type:bug
Difficulté 1/5 Moins d'une heure Accessibilité débutants 70/100
egdev6/quorb#109 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
stage:4
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
ilan-pinto/roaring-lions#598 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 1 jour
-
Frontmatter next to `src:` is applied to every imported slide, not only the first (undocumented)Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
Les mainteneurs répondent en général sous 1 jour