Repository navigation
feat(web): optional fetch backend for web_fetch via TOLE_WEB_FETCH_URL - #542
Conversation
#532) With TOLE_WEB_FETCH_URL set, web_fetch asks that backend for pages that need a real browser. ReadOnly, same trust model as web_search. The target is vetted locally first (https only, no credentials, public host) and nothing is sent if it fails. Unset: the direct fetcher is unchanged.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
|
Cora's finding is real and fixed in the next push: Also: the earlier Generated by Claude Code |
…pproval round trip (#543) ## What Fixes the flaky `serve_approvals::approval_allow_round_trip_executes_the_work` (it failed on CI for #539 and #542, both times unrelated to the PR's diff). ## Why After `POST /approvals/{id}/decision` returns `202 resuming`, the test waited for the resumed turn by polling `GET /sessions/{sid}/status` until `busy != true`. Right after the 202 the resume may not have set `busy` yet, so the very first read says "not busy", the loop exits at once, the queue entry already reads `approved`, and the file assertion runs before the replayed `write_file` has landed ("the approved write must have executed"). A "not busy" read proves nothing at that moment. ## Changes - `crates/tole-cli/tests/serve_approvals.rs`: poll for the effect itself (`approved.txt`, up to 10 s), then keep the existing wait for the session to settle. No production code and no assertion weakened: the same checks run, after the condition they depend on. ## Testing - [x] Reproduced under CPU load (6 busy loops on 4 cores), `approval_allow_round_trip` run 25 times in a row: **old code failed 9/25, the fix 0/25**. - [x] `cargo fmt --check`, `cargo clippy -p tole-cli --all-targets -D warnings`, `cargo test -p tole-cli --test serve_approvals` (3 passed). - [ ] Local `cora review --staged`: not run (cora is not installed in this environment); the CI Cora Review job is the verdict. ## Not included: the `tui_e2e` /quit race An earlier CI failure suggested tests send `/quit\r` before the turn is idle (the text would be queued as steering input instead of running as a command), and adding `t.idle()` before `/quit` looked like the fix. I could not reproduce it: 23 runs of the old `tui_e2e` binary under heavier load (8 busy loops, 8 test threads) all passed, so that change is not in this PR. It should be revisited if it fails on CI again, with the failing test name in hand. ## Related Issues Related to #539 and #542 (CI failures that were not theirs). --- _Generated by [Claude Code](https://claude.ai/code/session_01GwJr9GzLbDFeXo3HZHZpyP)_ Co-authored-by: Claude <[email protected]>
What
With
TOLE_WEB_FETCH_URLset,web_fetchasks that backend for the page instead of fetching directly, so JS-rendered and bot-protected pages can work. It stays aReadOnlytool with the same trust model asweb_search. Unset: the direct fetcher is untouched. Closes #532.Why
web_fetchis direct HTTPS only (no JavaScript, no browser), so many real pages come back empty. #215/#436 gave search a configurable backend; fetch had none. Doing it through MCP would make every page fetch aWriteapproval.Changes
web.rs: newWebBackendFetchToolregistered under the nameweb_fetchinstead ofWebFetchToolwhenTOLE_WEB_FETCH_URLis set (WebFetchToolitself is not modified, so the unset case is byte-for-byte the same).GET {url}?url=<target>→{"content": "..."};TOLE_WEB_FETCH_METHOD=POSTsends{"url": "<target>"};TOLE_WEB_FETCH_HEADERS(Name=${VAR}, same parser and rules as the search headers, now parametrized by variable name so errors name the right variable);TOLE_WEB_FETCH_FIELDS='content=<field>'. A malformed value fails startup.TOLE_WEB_ALLOW_PRIVATE=1opts out as for direct fetch). A refused target never reaches the backend.url,content_type,truncated,text).tool_roster.rs: choose the backend tool when configured.Open questions from the issue (decisions taken here)
TOLE_WEB_FETCH_FIELDSexists for that.Testing
cargo fmt,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace(1150 passed)cora review --staged: not run (cora is not installed in this environment); the CI Cora Review job is the verdict.Related Issues
Closes #532. Related: #215, #436.
Generated by Claude Code