Repository navigation
feat(pm-console): keep the signed Android build at the edge - #12723
Conversation
The download came from the laptop alone, so with the laptop away it failed. The laptop's report now describes its build (fingerprint, size, date); the edge asks for a build it does not have, the next report carries it, and the edge keeps it only if it is the build described. Nothing is sent again until the build changes. The edge serves its copy when it is the laptop's newest build or when the laptop is not there to ask, and otherwise passes the download to the laptop. The app says when the copy it would hand out is older than the laptop's newest. Five of six planted faults are caught; the sixth removes one of two size checks that each stop an oversized build on their own. Refs #12521. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YLT5K1QVuzZjfWGFhXSSNF
…still open Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YLT5K1QVuzZjfWGFhXSSNF
…claude/pm-apk-edge
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 40 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis 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. |
… build So that the copy's arrival at the deployed Worker can be checked from outside, like the laptop's commit. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YLT5K1QVuzZjfWGFhXSSNF
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 29c74971db
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| sha256: build.sha256, | ||
| size: build.size, | ||
| at: build.at, | ||
| ...(this.want.has("apk") ? { data: Buffer.from(await build.read()).toString("base64") } : {}), |
There was a problem hiding this comment.
Budget the APK against the complete sync payload
When an APK-requested report also contains large changed sections, adding the APK can permanently stall synchronization. A permitted 5 MiB APK becomes about 6.67 MiB of base64, leaving less than 1.34 MiB for everything else under the edge's 8 MiB SYNC_LIMIT. Large sections are supported—the existing large-section test constructs roughly 3.2 MB of questions. After the resulting 413, once() retains both want('apk') and the unacknowledged section hashes, so subsequent reports repeat the oversized combination rather than making progress. Budget the complete encoded request and send the APK and sections in separate reports when necessary.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Real. Fixed in the next commit: when the build and the changed sections would together pass what a report may carry (REPORT_ROOM, 7.5 MiB, under the edge's 8 MiB), the build goes alone and the sections, which are not marked sent, follow in the next report. Tested with a 4.9 MB build and three megabytes of questions changed in the same turn: every report is accepted, the build is kept, and the questions arrive whole one report later. Removing the check fails that test with the 413 loop you describe. A separate commit also stops a build the edge cannot keep from being re-sent with every report, and stops a wanted build from putting the laptop on its half-second cadence.
Generated by Claude Code
| const quiet = this.now() - (this.hostSeen ?? 0) >= HOST_QUIET_MS; | ||
| if (kept && (kept.sha256 === latest?.sha256 || quiet)) return this.serveApk(kept); |
There was a problem hiding this comment.
Restore the host timestamp before choosing the APK
If the Durable Object restarts after the laptop announces a newer build but before that build is copied, an APK request can incorrectly receive the older build even while the laptop is available. hostSeen starts as null and is restored from storage only by ready(), but this route returns before the general ready() call below it. Consequently, the quiet check uses zero and bypasses the newer build on the laptop despite a recent persisted report. Call ready() before evaluating this gate.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Real. Fixed in the next commit: ready() runs before the gate, so when the laptop last reported is read back before deciding it is away. Tested: a newer build is announced, the edge restarts before it has a copy, and the download goes to the laptop instead of handing out the older copy. Removing the call fails that test.
Generated by Claude Code
…ry report If a build did not match its description, or could not be stored, the edge asked for it again at once, and a missing piece made the laptop report every half second: half a megabyte, twice a second, for as long as it kept failing. The edge now asks again no sooner than ten minutes later, and being asked for the build no longer hurries the laptop. Three planted faults are each caught. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YLT5K1QVuzZjfWGFhXSSNF
…edge reads back the laptop's last report first Two review findings on the build kept at the edge: - A report carrying the build and large changed sections could pass what the edge takes in one report; refused as too large, it would be built the same way again. The build now goes alone when the two would not fit, and the sections follow in the next report. - After a restart the edge chose which build to serve before reading back when the laptop last reported, so a laptop that was there looked absent and the older copy was served. It reads that back first. Both faults, planted again, fail the new tests. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YLT5K1QVuzZjfWGFhXSSNF
Why
The signed Android build was downloaded from the laptop alone (
/console/pm-console.apk), so with the laptop away the download failed (#12521, second item).What changes
Also in this PR: the design record and the living plan are brought up to date with this session's changes and what is still open.
Checks
bun test: 150 pass. New: no build, nothing asked; described, asked for, sent once, not sent again; served from the edge byte for byte without asking the laptop; served after an edge restart with the laptop away; a newer build makes the copy say it is older, the download goes to the laptop meanwhile, and the next report replaces the copy; a build that does not match its fingerprint is not kept and is asked for again; a build too large to carry is never read to be sent; the laptop's description of the file, with the fingerprint worked out separately.wrangler deploy --dry-runbundles (140 KiB);bun run src/server.ts --checkpasses.Not checked
androidBuildin/console/api/me.Refs #12521.
Generated by Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.