Repository navigation
Ateam Go: recover faster from a dropped connection, and stop losing the prompt - #565
Merged
Merged
Conversation
…he prompt A phone's tunnel takes from tens of seconds to minutes to settle after it wakes or changes network. The app made that outage longer and harder to read. - A box that should be up is retried at least every 15 s. Only a box that sleeps keeps the 5 s to 2 min pace, since no retry wakes it. - A call unanswered for 5 s has the socket probed there and then, and a dead socket is declared gone at once: its own close event can come long after, or never, which left calls waiting behind a box still shown as connected. - Starting a task asks the box first, and reaches it again if it doesn't answer. A task that couldn't start says why in the composer, with the prompt and files back in the field, rather than in the "Started" bar with Open. - The status dot is amber while one box is offline behind another that is up, and Run on says offline or asleep for the box it names.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
After the phone wakes or changes network (Wi-Fi to 5G and back), its tunnel to a box takes from tens of seconds to a few minutes to settle. The box's Tailscale log showed that on every report: the phone asking for a direct path through the relay every 3 to 6 seconds, with the engine up the whole time. The app can't shorten that, but it made the outage longer and harder to read:
What changes
src/links.ts): a box that should be up is tried at least every 15 s (AWAY_RETRY_CAP_MS). A box that sleeps keeps the steady pace, and still only a tap wakes it.src/connection.ts): a call unanswered for 5 s has the socket probed there and then, not at the next keepalive. A socket judged dead is declared gone at once: closing a half-open socket starts a handshake nothing completes, so its close event can come much later or never, and the calls in flight kept waiting. A call made after that rejects.App.tsx,src/Composer.tsx): the box is asked first (links.verify) and reached again if it doesn't answer. A task that couldn't start says why in the composer, in red, with the prompt and attachments back in the field. The "Started" bar no longer carries failures.src/boxes.tsfleetHealth): the dot is green only while every box that should be up is, amber while one is offline behind another that is up. Sleeping boxes don't count against green. Run on says "offline" or "asleep" next to the box, and its picker no longer calls every unreachable box "(asleep)".Checked
bun test srcinapps/mobile: 148 pass, including new tests for the retry pace (both kinds of box),verify,fleetHealth, and a half-open socket whose close never completes.tsc --noEmit -p apps/mobileandbiome checkon the changed files: clean.Not checked
Known edge
If a task is created but its agent fails to launch, the message says so and the prompt comes back. Sending again then starts a second task.