Repository navigation
Read saved site state before verify-site opens a thread, since a text box's focus now starts the container - #5810
Merged
Merged
Conversation
… box's focus now starts the container #5802 made the Worker start a visitor's container when an interaction batch reports a text box's focus. verify-site's saved-state check opened the saved thread, which focuses its reply box, and only then asserted that the state, revision stylesheet and revision document came from durable storage. The prewarm woke the container in between, so the stylesheet read was served by the container and publish-site failed with "private revision resource woke its container" (run 42904167365). The check now does every durable read and the running-container comparison before opening the thread. The prewarm and what the site serves are unchanged. Refs #5809
leaf-agent
commented
Nov 10, 2026
leaf-agent
left a comment
Collaborator
Author
There was a problem hiding this comment.
Opening the thread now happens before the media write, so the container is already running when the media POST goes out. The later check(worker.containers() != asleep, "the mutation did not wake the container") therefore passes because of the prewarm, not because of the write. The verifier no longer shows that a write wakes a stopped container. I'll push a fix that moves the thread step after that check. The comment check still runs, and the media write runs with the container asleep again.
…till wakes a stopped container Opening the thread focuses its reply box, which starts the container. Placed before the media write, it left "the mutation did not wake the container" passing on that prewarm rather than on the write. The thread step and the browser-error check now come after the write's checks. Refs #5809
leaf-agent
added a commit
that referenced
this pull request
Nov 10, 2026
…5815) A leaf.page read that hits a dropped container connection now gets one more attempt in the Worker instead of reaching the visitor as a 500. This is the failure behind `publish-site`'s red run on `37de78c5458c` ([run 42909821856](https://github.com/max-sixty/leaf/actions/runs/42909821856)): the open page's `/api/news` poll landed while the verifier's media upload was waking the container, the SDK answered `500 Error proxying request to container: Error: Container port connection closed unexpectedly.`, and the saved-state browser-error gate counted the console error. #5810 had just moved that gate behind the media write. **Cause.** Containers SDK 0.3.7 catches a proxy failure and returns a plain 500 with one of two bodies: `Container suddenly disconnected, try again` or `Error proxying request to container: …` (`dist/lib/container.js`, the `catch` in `containerFetch`). `LeafWebsiteSession.forward` logged that 500 and returned it unchanged. The same shape (one `/api/news` or `/api/state` 500 at the Worker-to-container boundary, then a successful read) was written off as transient in #2331, #3115 and #3165. **Change.** `forward` classifies both SDK bodies as `disconnected`. It sends a `disconnected` `GET` or `HEAD` once more and returns the second answer. A write is never resent, because it may already have reached Python. A 500 that Python stamped with `Leaf-Release`, or any other unclassified 500, passes through as before. The `http_error` record gains `retried`, and `worker/README.md` documents it. **Verification.** The new Worker test (`reads again once when the container connection drops, but never resends a write`) fails on `main` with `expected 500 to be 200` and passes here. `pnpm run check:worker` passes (92 tests plus `tsc`). The start-up race needs Docker, which this sandbox doesn't have (#4293), so the real check is the next `publish-site` run, which goes through a container start in the saved-state step. Closes #5814 — automated triage Co-authored-by: leaf-agent <[email protected]>
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.
publish-siteonmainhas failed since #5802 (run 42904167365,RuntimeError: private revision resource woke its container). #5802 made the Worker start a visitor's container (prewarmContainer) when an interaction batch reports a text box's focus.verify_saved_stateinleaf-dev verify-siteclicks the saved thread, which focuses its replyleaf-text, and only after that checks that the state, the revision stylesheet and the revision document came from durable storage. The run's log shows the sequence: afocusinonleaf-textwithtextBox: true, thencontainer_prewarm_completed, then the stylesheet GET taking 4 s and being answered by the woken container.This PR moves the thread step to the end, after every durable read, the "reading saved content started a page container" comparison and the media write. Each of those checks again finds the container stopped: the reads still prove they are served from durable storage, and the write still proves it wakes the container and that the next writer restores the record. The thread's saved comment and the browser-error check still run, after the thread opens. Nothing changes in the Worker, the runtime or the prewarm.
Verification: this PR's
cirunsuv run leaf-dev verify-site website-worker("Measure the bundled release in a browser"), the same command as the failing step. The failing run above is the before.For the author of #5802 to weigh: opening a thread puts focus in its reply box, so every thread open on leaf.page now starts the session's container, even when the visitor only reads. The rate limit bounds this. Whether that counts as "about to write" is a product call, and this PR doesn't make it.
Refs #5809 — automated triage