Repository navigation
web 0.5.0: a saved copy is checked with the site past a 5-minute floor (board #137), and WEBFETCH_MODEL - #393
Conversation
…with the site past a 5-minute floor Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)
…r (board #137, web 0.5.0) A copy answered every call for 24 hours without a request, so the first session to fetch a changing page fixed what every session saw for a day. Now a copy answers as it stands for 5 minutes after its fetch or its last check (CHECK_FLOOR_MS); past that the fetch is its check. The copy stands, its folder unchanged and the check recorded in the entry's .checked.json, when the site answers 304 to its ETag or Last-Modified, sends the same body, or the extracted text (article, whole page, URL) hashes as the copy's did. Anything else is a changed page, built from the answer already in hand. A rendered copy records no validators (its shell's say nothing of what the scripts load) and is checked by rendering again. A check the site fails gives the copy with why; a 4xx other than 408 and 429 is the error, naming the copy. The HTTP client no longer reads a 304's empty body through the decoder its Content-Encoding names (GitHub's and Wikipedia's 304s failed). Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)
…s quote any version string Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)
Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)
…onses, a failed fallback, a prune, and a fragment (board #137) Four ways the check of a saved copy could keep or hand out the wrong thing. A copy whose article a site extractor filled in from other URLs (Reddit's comments, YouTube's transcript) recorded the shell response's ETag, Last-Modified and body hash, so an unchanged shell confirmed changed content. Each extraction now notes whether it asked Defuddle's fetch for anything; such a copy records only its text digest, and its check extracts again and compares. A check whose fallback failed published a degraded page as a changed one: a markdown stub whose HTML page answered 503, or a rendered copy's empty shell when the render failed or the page's data API was down, each then confirmed by its own body hash. During a check, a page under RENDER_MIN_WORDS where the copy had at least that many is no longer published: the copy answers through the failed-check path, remembered like any failed check, and checkFailed says how many words came back and the render's or the HTML request's reason. A fresh fetch is unchanged, and refresh still takes a page that really shrank. A copy of any age can now be confirmed and handed out, so prune keeps a generation while the later of its fetch and the check its entry's .checked.json records for it is within the age, reading that record just before it deletes. A check that confirms a copy writes the record first and then makes sure the generation is still there; one a prune took while the site was asked is no copy, and the call goes on as a fetch (a 304 is followed by a full request, a matching body or text is published). The cache key drops a URL's fragment, but the 304 guard, the body shortcut and the text digest compared URLs with theirs, so /page#a checked as /page#b was refetched and rebuilt. They now compare and hash the URL without its fragment. Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)
…ailed fallbacks, the prune, fragments Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)
…pt, haiku when unset The owner's request: the summary's model is theirs to pick per machine. $.model.complete resolves the name as --model does (WEBFETCH_MODEL=luna), the reply's Answered-by line and usage.jsonl name the model that answered, and a name the engine refuses fails the summary, not the fetch. Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)
… the regression sample, WEBFETCH_MODEL Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 98892b01f0
ℹ️ 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".
| content = contentDigest(finalUrl, body, wholeText) | ||
| if (previous && content === validators?.content) { |
There was a problem hiding this comment.
Include saved metadata in the content comparison
When an HTML page changes only its extracted metadata, this digest remains identical and the check returns the old generation indefinitely. The metadata is part of the saved frontmatter and the tool result, so it is content consumers actually read, not merely extraction bookkeeping. I reproduced this with the committed bundle: changing <meta name="author"> from Alice to Bob after aging the cache returned Alice with cached: true and a new checkedAt, while a forced refresh returned Bob. Include the persisted metadata in the comparison, excluding only fetch-time fields, so changes to authors, publication dates, titles, and descriptions can publish a new copy.
Useful? React with 👍 / 👎.
| const own = fromResponse && !rendered | ||
| const recorded: Validators = { | ||
| ...(own && res.headers.etag ? { etag: res.headers.etag } : {}), | ||
| ...(own && res.headers['last-modified'] ? { lastModified: res.headers['last-modified'] } : {}), | ||
| ...(own ? { body: sha256(res.body) } : {}), |
There was a problem hiding this comment.
Avoid validating a shell after an unsuccessful render
If the first fetch of a JavaScript page cannot render successfully—for example, Chromium times out or the page's data API is temporarily unavailable—extractPage can retain the plain shell with rendered: false. This condition then records the shell's validators and body hash. Subsequent checks accept a 304 or identical shell bytes before reaching extractPage, so rendering is never retried even after the browser or API recovers; repeated checks can preserve the empty loading page indefinitely. Track the unsuccessful render attempt and avoid the response-level shortcuts for that copy, allowing a later check to retry rendering.
Useful? React with 👍 / 👎.
| export async function recordCheck(entry: string, generation: string, checkedAt: string): Promise<void> { | ||
| await writeRecord(entry, CHECKED_FILE, CHECKED_TMP_PREFIX, { generation, checkedAt }) |
There was a problem hiding this comment.
Preserve check timestamps for previously returned generations
When a generation fetched over seven days ago is confirmed and handed out, then a replacement generation is published and checked, this write overwrites the older generation's only check timestamp. prune subsequently treats the older generation as never checked and deletes it based on its original fetch time, even though its path was just returned to another session. This does not require concurrent operations: I reproduced it by checking a nine-day-old generation A, publishing and checking B, then pruning; A survived the first prune but was deleted after B's check. Keep check timestamps per generation so checking a replacement does not revoke the retention protection of recently returned paths.
Useful? React with 👍 / 👎.
Board #137, plus the owner's
WEBFETCH_MODEL. The machine's shared cache reused a saved copy of a page for 24 hours without asking the site, so the first session to fetch a page that changes during the day (release notes, an issue, a status page) fixed what every session saw for a day. The owner approved the design and its three choices on 2026-10-26. It is recorded in the living spec,docs/doperpowers/specs/2026-10-25-web-fetch-design.md("The cache", "The summary", I1, and the Decision Log entries dated 2026-10-26).What changes (web 0.5.0)
A 5-minute floor. A copy answers as it stands for 5 minutes after its fetch or its last check.
A check past the floor. The call starts with the request a fetch would make, carrying the copy's
ETag/Last-Modified. The copy stands when any of these holds:Its folder doesn't change, so cited paths stay valid, and the check is recorded in the entry's
.checked.json. Anything else is a changed page, built from the answer already in hand, with no second request.Rendered copies record no validators, since a script shell's 304 says nothing of its data. Their check renders again and compares. A copy filled in by a Defuddle site extractor's other requests records none either.
When the check fails:
Replies say what happened. For example:
Cached, fetched 5 h ago, unchanged when checked 2 s ago (refresh: true fetches again), or…; a check for changes failed: HTTP 503 Service Unavailable. The tool description's line becomes "A saved copy is reused when the site shows the page unchanged (asked at most once every 5 minutes)".Prune dates a generation by its last check too, so a path a check hands out stays readable as long as one a fetch hands out.
The HTTP client no longer pipes a 304's empty body through the gzip decoder its
Content-Encodingnames. GitHub's and Wikipedia's 304s failed withunexpected end of file.WEBFETCH_MODELnames the model that answers aprompt;haikuwhen unset or blank. The owner asked for it.The web plugin's version audit skips
evals/runs/, whose transcripts quote any version string.Evidence
Cache-Controlsays little about change: 42 send none, and Tom's Hardware sendsno-storeand still answers 304.WEBFETCH_MODEL=luna, live inclaude -p: luna answered, and the reply says "Answered by luna". A name that doesn't resolve gave the page with "The answer could not be made (api-error 400, unknown)".Review
doperpowers:review-code at medium, two rounds.
70eb95d5, each with a test that failed first:Three narrower edges are logged as debt on board #11:
Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)