Preserve frame order when mixing saved and new routes

This commit is contained in:
Sleeps
2026-10-07 12:39:49 +01:00
parent f453080c25
commit aa5bcd61e3
+11 -2
View File
@@ -393,7 +393,10 @@ def _route_rows(
if override is not None:
decisions[str(row["id"])] = override
routed: list[tuple] = list(reusable)
routed_by_id = {
str(row["id"]): (row, route, score, reason)
for row, route, score, reason in reusable
}
with connect(settings.db_path) as con:
for row in valid_rows:
frame_id = str(row["id"])
@@ -408,13 +411,19 @@ def _route_rows(
""",
(route, reason, score, route_model, policy, frame_id),
)
routed.append((row, route, score, reason))
routed_by_id[frame_id] = (row, route, score, reason)
if verbose:
print(
f"{row['title']} @ {format_ts(int(row['timestamp_ms']))}: "
f"score={score:.4f} -> {route} ({reason})"
)
routed = [
routed_by_id[str(row["id"])]
for row in rows
if str(row["id"]) in routed_by_id
]
if progress is not None:
progress(
{