fix(android): stop the history walk on an empty page
android / debug (push) Successful in 2m15s
android / release (push) Successful in 2m9s
ci / checks (push) Successful in 2m56s
ci / test (push) Successful in 1m8s
ci / chart (push) Successful in 6s
ci / docker (push) Successful in 1m57s
ci / web (push) Successful in 13s
ci / publish-edge-images (deploy/docker/claw.Dockerfile, rhema-claw) (push) Successful in 1m59s
ci / publish-edge-images (deploy/docker/ui.Dockerfile, rhema-claw-ui) (push) Successful in 15s
ci / publish-edge-chart (push) Successful in 4s

loadOlder returned as soon as a page held no events, before clearing moreOlder. The screen kept thinking older turns existed and asked again each time the list settled. Against the mock claw, opening a session with no cached transcript sent six /history requests where one was enough.

An empty page clears moreOlder now, even when the response's more flag says otherwise. With no event to move oldestSeq, another request would only repeat the same empty answer.

assembleDebug passes; the same session sends one history request.
This commit is contained in:
vhaudiquet committed 2026-12-02 11:40:04 +01:00
1 parent 30b5e0f721
commit 57569b6b56
1 file changed
+14 -7
@@ -256,13 +256,20 @@ class ChatController(
val page = result.value.events.mapNotNull { entry ->
entry.event?.let { entry.seq to it }
}
val first = page.firstOrNull() ?: return
// The page is older than everything on screen, and the
// list runs oldest first: it goes above, never below —
// appended, it would land at the newest end.
items = applyEvents(emptyList(), page.map { it.second }) + items
oldestSeq = first.first
moreOlder = result.value.more
val first = page.firstOrNull()
if (first == null) {
// An empty page cannot move the anchor back, so
// retrying would only repeat this request. Stop
// even when `more` promised rows it did not send.
moreOlder = false
} else {
// The page is older than everything on screen, and
// the list runs oldest first: it goes above, never
// below — appended, it would land at the newest end.
items = applyEvents(emptyList(), page.map { it.second }) + items
oldestSeq = first.first
moreOlder = result.value.more
}
}
is ClawResult.HttpError, is ClawResult.Network -> Unit
}