fix(sync): keep pending questions answerable after restart (#2005)

Co-authored-by: bashrusakh <bashrusakh@users.noreply.github.com>
This commit is contained in:
Leonid
2026-07-11 16:04:41 +03:00
committed by GitHub
co-authored by bashrusakh
parent fbcf4ea2b9
commit 420582984e
2 changed files with 47 additions and 10 deletions
+7 -10
View File
@@ -1738,21 +1738,18 @@ export function SyncProvider(props: {
.filter((s) => !!s?.id)
.sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0))
// Also load child sessions (sub-agent delegations) so they
// appear in the sidebar immediately instead of relying on
// the async global session store.
// Also load child sessions (sub-agent delegations) with pagination
// so pending questions can scope to them immediately after restart.
let allSessions: typeof rootSessions = []
try {
const allResult = await props.sdk.session.list({
allSessions = await listGlobalSessionPages(props.sdk, {
directory: dir,
limit: 200,
archived: false,
roots: false,
pageSize: 500,
})
const allError = (allResult as { error?: unknown }).error
if (!allError) {
allSessions = ((allResult as { data?: unknown }).data ?? []) as typeof rootSessions
}
} catch {
// Child load is best-effort; fall back to roots only
// Child load is best-effort; fall back to roots only.
}
// Merge: keep root sessions from the first query (for accurate