Repository navigation
iPhone: FTW Cloud hears that the phone looks, even when that changes during the handshake - #33
Merged
Merged
Conversation
…during the handshake A launch passes through inactive, so message 1 often says hz 0. If the app came to the front before message 2, setLooking(true) found no open session and sent nothing, and nothing sent it later. The service never asked the box for 1 s updates, and the box stayed at 5 s for the whole session. In five cold starts of the 0.3.1 release build, three lost the watch. CloudCarrier now keeps what the service last heard and sends watch as soon as the session opens if that differs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Oct 13, 2026
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.
While Fredrik had the app open, his box sent to FTW Cloud every 5–6 s instead of once a second (follow-up from #28). Two things caused it. This PR fixes the one in the app.
1. The app lost the
watch(fixed here).CloudCarriersendswatchonly on an open session. A launch passes through inactive, so message 1 often sayshz: 0. If the app came to the front before message 2,setLooking(true)found no open session and sent nothing, and nothing sent it later. The service then never asked the box for 1 s updates, and the box stayed at 5 s for the whole session. Three of five cold starts of the 0.3.1 release build lost the watch.Now
CloudCarrierkeeps what the service last heard: message 1'shz, then eachwatch. When the session opens and the phone has changed its mind, it sendswatchat once. A change while the session is closed still goes in the next message 1, as before.2. Fredrik's box reads its meter every 5 s (not changed here). The site meter is the Sungrow inverter, and its driver asks for a read every 5 s. The box sends
liveonly when a reading changed. So even with the watch in force, it cannot send more often than every ~5 s. What the watch changes there is the delay after each reading: at most ~1.25 s instead of up to ~5 s. I read this from the home box, read-only, at 19:19 CEST:livewent every 5.7–6.3 s and trailed each Sungrow reading by 0.9–4.7 s, which is the 5 s cadence with no phone looking.Tests
lookingChangedDuringTheHandshakeIsSaidOnceOpenfails on main (watches == [], both ways round) and passes here.lookingChangedWhileClosedGoesInMessage1: a redial sends no extrawatch.swift test: 276 tests pass.Measured end to end (13 Oct, 19:25–19:58 CEST). Release builds in the iOS 26.5 simulator, Core from srcfl/ftw master (f4bfff69) on the laptop with simulated devices, and the deployed cloud.ftw.energy. The test meter read every second, so the box could send at 1 Hz. I logged each frame the box sent from its
GET /api/cloud/preview, every 200 ms.liveframes (median per run)Not in this PR
driver_poll; onlyhost.set_poll_intervalcounts (go/internal/drivers/registry.go). Ferroamp asks for 1000 ms and is read every 5 s. That belongs in srcfl/ftw.watchreached the box every time.🤖 Generated with Claude Code