Skip to content

Stop the deploy sweep paying for a web search it discards - #242

Merged
adamjohnwright merged 1 commit into
mainfrom
fix/sweep-postprocess
Sep 18, 2026
Merged

adamjohnwright merged 1 commit into
mainfrom
fix/sweep-postprocess

Conversation

@adamjohnwright

Copy link
Copy Markdown
Contributor

Found while checking, before deploying beta, whether the post-deploy sweep would spend money on searches nobody reads. It would have — so that deploy ran with --skip-sweep.

The defect

answer_sweep calls ainvoke without enable_postprocess, so it defaults to True and the postprocess node runs a Tavily web search for each of the fifteen questions. The sweep reads answer and nothing else, so every result is discarded.

This is the same defect the answer endpoint had (fixed in #237), surviving in the other caller. It runs after every beta deploy, which is where the cost repeats.

It also made each question slower — the sweep waited for a web search before completing — which is why its per-question timings ran slower than the endpoint's on the same questions.

Why a test rather than just the fix

Nothing fails when this regresses. The cost is invisible from the outside: the sweep still passes, the answers are still right, and the only signal is a bill. So it is pinned, and the test guards its own assumption — if the sweep ever starts reading additional_content, the guard is no longer the right one and says so.

Mutation-checked: flipping the flag back to True fails the test.

Related

Beta is now running the answer endpoint (tag 480db64), verified end to end through the public URL. Two things worth recording from that:

  • SSE is not buffered by nginx or Cloudflare — 659 token events arrived spread over 10.1s, so progressive rendering works on the real path.
  • nginx 403s some user-agents on /chat/: python-httpx is blocked while curl and browser UAs pass. That is the site's automation blocking, not this service, but it will bite the website's server-side proxy if their HTTP client sends a default library UA. They have been told.

CI-equivalent locally: ruff, format, mypy (129 files), full suite with no API keys set.

🤖 Generated with Claude Code

The sweep calls ainvoke without enable_postprocess, so the postprocess node ran
a Tavily search for each of its fifteen questions. The sweep reads `answer` and
nothing else, so every one of those results was thrown away -- and this runs
after each beta deploy, which is where the cost repeats.

The same defect as the answer endpoint had, in the other caller. Found while
checking, before deploying beta, whether the post-deploy sweep would spend money
on searches nobody reads. It would have, so that deploy ran with --skip-sweep.

Each question also waited for the search before completing, which is why the
sweep's per-question timings were slower than the endpoint's on the same
questions.

Pinned by a test, because nothing fails when this regresses: the cost is
invisible from the outside. The test also guards its own assumption -- if the
sweep ever starts reading additional_content, the guard is no longer the right
one and says so.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@adamjohnwright
adamjohnwright merged commit e179170 into main Sep 18, 2026
10 checks passed
@adamjohnwright
adamjohnwright deleted the fix/sweep-postprocess branch September 18, 2026 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant