Skip to content

bot: a failed newest history page is reported, once an hour per bot - #973

Merged
svanlabs[bot] merged 1 commit into
mainfrom
fix/history-newest-page-log
Oct 12, 2026
Merged

svanlabs[bot] merged 1 commit into
mainfrom
fix/history-newest-page-log

Conversation

@svanlabs

@svanlabs svanlabs Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

What generated this?

Generated-by: claude-code/claude-sonnet-5-5

Motivation

Closes #971.

The newest-hands loop of the history download drops a failed page without a log line: fetch_page returns a bare None on any 5xx and the loop breaks (crates/apps/bot/src/history/download.rs). A read-only probe on 2026-10-12 (GET /me/hand-history?limit=1, one per key, approved by the operator) gave HTTP 200 for SvanBotV10 and HTTP 500 after about 11 s for the other four keys. Their history stores had stopped growing one after another over eight days (newest row: Svanar 10-04 23:40, 13,147 live hands behind; SuraGunnar 10-10 18:59; Svanism 10-11 05:10; SurSvan 10-11 21:24) and the log held only the hourly season refresh.

Solution

One change in crates/apps/bot/src/history/download.rs:

  • fetch_page returns Result<Value, String>: Err("HTTP 500") for a 5xx, the status after the 429 and other retries, a 200 body that is not JSON, or the last transport error. The key travels only in the request header, never in these strings.
  • The newest-hands loop logs the reason as a warning through note_newest_failure, at most once an hour per bot (the loop runs hourly once every bot is done, every minute while one is not, so the limiter only matters for the one-minute case). A page that comes back clears the bot's hour.
  • The backfill call site ignores the reason as before; it already names a repeated failure.

Tests: a_server_error_page_comes_back_with_its_status (a local listener answering 500) and a_failed_newest_page_is_reported_once_an_hour_per_bot. The new API does not exist on origin/main, so before the change they cannot compile; to show they assert behaviour, I disabled the fix (no log line, empty reason) and both failed (left 0, right 1; left "", right "HTTP 500"), then restored it. The stage-1 call site that connects the two is covered by reading, not by a test.

Log-only change off the decision path: no paired simulation, no golden change. The cause of the 500 is on the venue's side and is not addressed here. Not released: the installed build is 0e3d584.

Checklist

  • scripts/check.sh full passes on this exact commit (0d96c89), run in a worktree on the shared warm target/dev:
test.py: 899 passed, 0 failed, 4 ignored in 35 binaries; build 0.3s, run 4.5s (6 jobs x 2 threads, profile gate, peak test RSS 195 MB)
== ok (full, 178 s)
check.sh full: exit 0
  • This is one change.
  • Not a behaviour change on the decision path: no paired simulation; the golden snapshot is untouched.
  • Not a performance change.
  • No document names the changed behaviour.
  • The AI-provenance rule was followed: Generated-by: is in the commit footer and in the section above.

🤖 Generated with Claude Code

The newest-hands loop of the history download dropped a failed page
without a line: `fetch_page` returned a bare `None` on any 5xx and the
loop broke. On 2026-10-12 the venue answered HTTP 500 after about 11 s
for four of the five bot keys, so their history stores had stopped
growing one after another over eight days (the oldest, Svanar, 13,147
live hands behind) and the log said nothing.

`fetch_page` now returns the reason (`Err("HTTP 500")`, a body that is
not JSON, or the last transport error), and the newest-hands loop logs
it as a warning, at most once an hour per bot; a page that comes back
clears the bot's hour. The backfill path, which already names a repeated
failure, ignores the reason as before.

Closes #971.

Generated-by: claude-code/claude-sonnet-5-5
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@svanlabs
svanlabs Bot merged commit ed21fc0 into main Oct 12, 2026
3 checks passed
@svanlabs
svanlabs Bot deleted the fix/history-newest-page-log branch October 12, 2026 11:56
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.

Fix: a failed newest history page is dropped without a log line

0 participants