perf(mobile): load child sessions on demand - #5717
Merged
Merged
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
Previous Review Summaries (5 snapshots, latest commit 5a3acc3)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 5a3acc3)Status: No Issues Found | Recommendation: Merge Files Reviewed (1 file)
Previous review (commit d7f05af)Status: No Issues Found | Recommendation: Merge Files Reviewed (7 files)
Previous review (commit c656e55)Status: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
Previous review (commit cf54a83)Status: No Issues Found | Recommendation: Merge Files Reviewed (6 files)
Previous review (commit f1b3c94)Status: No Issues Found | Recommendation: Merge Files Reviewed (25 files)
Reviewed by grok-4.6 · Input: 160.9K · Output: 6.9K · Cached: 263.6K Review guidance: REVIEW.md from base branch |
Contributor
Author
|
(bot) Kilobot review not detected, proceeding further |
pandemicsyn
approved these changes
Aug 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AuthenticatedOwneradds frozenauthEpoch,generation, anduserIdsnapshots;beginAuthenticatedOwnerrevokes old ownership, andconfirmAuthenticatedOwnerrequires a currentgetMeresult.AuthProviderblocks access before credential changes and publishes tokens only for the current epoch; ordinary token refresh keeps the owner generation.AgentSessionProviderdestroys revoked managers immediately, so retained session state cannot continue under a retired account owner.Files
apps/mobile/src/lib/context-scope.ts— Added source; +64/−0 lines. Adds subscriptions, current and confirmed owner checks, and nonempty identity confirmation that cannot change a confirmed generation's user.apps/mobile/src/lib/auth/auth-context.tsx— Modified source; +9/−0 lines. Clears sign-in tokens before persistence and revokes sign-out ownership before asynchronous cleanup. Remote cleanup retains the existing token.apps/mobile/src/components/agents/session-provider.tsx— Modified source; +15/−1 lines. Subscribes to ownership changes, checks ownership immediately, and removes the subscription during manager cleanup.apps/mobile/src/lib/context-scope.test.ts— Added owner-scope test file; +70/−0 lines.apps/mobile/src/lib/auth/auth-context.test.tsx— Modified authentication test file; +229/−3 lines.UserWebConnectionProviderconfirms an unconfirmed owner withuser.getMebeforeactiveSessions.createWebTicket, adding an account request rather than trusting cached data or token claims.IdentityConfirmationContextanduseIdentityConfirmationexposeIdentityConfirmationwithisPending,isError, andretry; recovery retains software development kit (SDK) backoff and concurrent-attempt protection.Connections use
authEpochandgeneration; inactive authentication admits none, and owner revocation destroys retained connections and rejects stale ticket results.Files
apps/mobile/src/components/agents/user-web-connection-provider.tsx— Modified source; +133/−17 lines. Checks ownership around ticket requests and reuses the native lifecycle recovery callback for Retry. The confirmation hook requires the provider; cleanup releases connections, while revocation destroys them even with session retains.apps/mobile/src/components/agents/user-web-connection-provider.mounted.test.tsx— Modified mounted connection-provider test file; +418/−66 lines.apps/mobile/src/components/agents/user-web-connection-provider.test.ts— Modified connection-provider test file; +68/−42 lines.SessionDetailScreenwaits for a confirmedAuthenticatedOwner, including organization sessions, and isolatescliSessionsV2.getmetadata andAgentSessionProviderinstances by owner.Legacy
titleparameters remain accepted but no longer populate headers orcachedTitle; loading uses a generic title until owned data arrives.Account errors use
useIdentityConfirmation.retrywith pending, Copy, and Back controls;NOT_FOUNDandUNAUTHORIZEDstill omit Retry.Files
apps/mobile/src/app/(app)/agent-chat/[session-id].tsx— Modified source; +50/−21 lines. Personal metadata requires a confirmed account, valid session ID, and no organization parameter. Ownership enters the query hash and provider key without changing typed query keys or prefix invalidation. Loading and error headers enable Back fallback; spawned-session retries stay unchanged.apps/mobile/src/app/(app)/agent-chat/[session-id].mounted.test.tsx— Modified mounted session-route test file; +981/−43 lines.SessionDetailContentopens the selected sheet before startinghydrateChildSession, and removes automatic sibling loading and its one-time retry.The retired
collectEmptyChildSessionIdsandhydrateEmptyChildSessionsexports no longer support speculative loading; model labels depend on already available messages.Child Retry, cached rows, nested opening, and separate pagination stay connected to the existing manager.
Files
apps/mobile/src/components/agents/session-detail-content.tsx— Modified source; +1/−39 lines. Removes the speculative effects and attempted-child set, while keeping immediate selection. The loaded header enables Back fallback.apps/mobile/src/components/agents/session-detail-content-helpers.ts— Modified source; +2/−53 lines. Removes the empty-child scan, concurrent hydration helper, and unused imports; existing message retry helpers remain unchanged.apps/mobile/src/components/agents/session-detail-content.test.ts— Modified session-detail test file; +677/−606 lines.apps/mobile/src/components/agents/session-detail-content-helpers.test.ts— Modified session-detail helper test file; +1/−179 lines.apps/mobile/src/components/agents/session-detail-queue.test.ts— Added session queue test file; +697/−0 lines.getChildSessionCardStatereturns emptylatestActivityfor completed or failed tasks without assistant messages, andChildSessionSectionomits that row.Pending and running cards keep the waiting text; titles, status, optional model labels, and nested opening still use available task and message data.
Files
apps/mobile/src/components/agents/child-session-card-state.ts— Modified source; +3/−1 lines. Stops assigning waiting text to finished tasks without assistant activity.apps/mobile/src/components/agents/child-session-section.tsx— Modified source; +15/−13 lines. Renders the activity row only when text exists; task identity and child opening remain available.apps/mobile/src/components/agents/child-session-card-state.test.ts— Modified child-card state test file; +60/−29 lines.ChildSessionSheetdisplays hydration errors and Retry above cached messages instead of hiding failures once content exists.lastHydrationErrorretains the current child's error while loading; switching children or finishing recovery clears it.QueryError.isRetryingreports recovery progress without replacingSessionMessageList, preserving the transcript layout and existing paging, nesting, streaming, and bottom spacing.Files
apps/mobile/src/components/agents/child-session-sheet.tsx— Modified source; +59/−39 lines. Keeps the content wrapper stable, retains recovery controls during Retry, and enablesSheetHeader.wrapTitle.apps/mobile/src/components/agents/child-session-sheet-recovery.mounted.test.tsx— Added mounted recovery test file; +293/−0 lines.apps/mobile/src/components/agents/child-session-sheet-state.test.ts— Modified sheet-state test file; +5/−1 lines.apps/mobile/src/components/agents/child-session-sheet-test-helpers.tsx— Added sheet test helper; +327/−0 lines. This file is test support, not production source.apps/mobile/src/components/agents/child-session-sheet.mounted.test.tsx— Modified mounted child-sheet test file; +133/−198 lines.ScreenHeaderProps.backFallbackaccepts an optional Expo RouterHrefand keeps Back available without navigation history unlessshowBackButtondisables it.onBackstill takes precedence; otherwise Back uses existing history or replaces the current route with the fallback.Session loading, error, and content headers use the agents tab fallback; callers without a fallback keep their existing behavior.
Files
apps/mobile/src/components/screen-header.tsx— Modified source; +7/−2 lines. Adds optional fallback navigation and keeps the Back control available when the fallback exists.apps/mobile/src/components/screen-header.mounted.test.tsx— Modified mounted screen-header test file; +70/−35 lines.SheetHeader.wrapTitledefaults to false; the child sheet opts in so long task titles remain complete while loading.Opted-in headers use an expandable minimum height with no title line limit; other callers keep a fixed height and single line.
Reserved action space keeps Done and other controls separate from the title.
Files
apps/mobile/src/components/sheet-header.tsx— Modified source; +6/−2 lines. Adds optional wrapping and selects fixed or minimum row height without moving the leading and trailing controls.apps/mobile/src/components/sheet-header.mounted.test.tsx— Modified mounted sheet-header test file; +56/−0 lines.The optional
--child-performanceflag adds a deterministicChildPerformanceFixturetree toapp:mobile-sheet-fixtures; the default four sessions and read-only behavior stay unchanged.fixtureSessionIds,fixtureCleanupSessionIds, andbuildMobileSheetFixtureResultadd optional IDs, counts, and descendant-first cleanup;buildToolPartItem.statusadds running and error states.pollForChildPerformanceFixtureaccepts complete, validated history only, so fixture success waits for ingestion and pagination rather than a live agent.Files
dev/seed/app/mobile-sheet-fixtures.ts— Modified source; +51/−48 lines. Documents and parses the flag before the email; scopes cleanup to the selected user and preserves parent relationships. Only the performance root receives the repository URL. Ingests and polls every performance session before reporting optional identifiers and counts.dev/seed/lib/mobile-sheet-fixtures.ts— Modified source; +335/−13 lines. Builds one root, 24 direct children, and one nested child with stable synthetic IDs and times. Message counts are 2 for the root, 120 each for selected/nested children, 0 for the empty child, and 12 for each other child. Running tools omit end/output; error tools store error text, while omitted status remains completed. Optional results add performance IDs and counts; the child ID list is comma-separated. Authenticated polling validates schema, relationships, exact counts, and pagination cursors; retries pending histories every 500 milliseconds for 30 seconds; rejects terminal errors and omissions.dev/seed/lib/mobile-sheet-fixtures.test.ts— Modified fixture test file; +438/−0 lines.Tests: 16 files changed (12 modified, 4 added; +4,523/−1,202 lines), including the named sheet test helper and session queue tests.
Generated: 0 files changed; no generated catalogs or lockfiles change.
Visual Changes
Child session sheet
Parent session
demo.mp4
Identity confirmation and cached recovery states
Verification
On iOS, 44 measured cases ran: 33 passed, ten supplied a prewarmed baseline, and one return retained its blocked grade.
Setup and warmups are excluded from this count; overlapping cohort and observation rows below must not be added together.
The owner ended runtime verification after return observation 04, with observations 02 and 03 carried forward.
Android is outside the approved iOS-only scope; this report does not claim complete native acceptance criteria AC1–AC10 coverage.
Historical round grades remain unchanged.
The table above combines later outcomes only where the reports establish a pass; it does not rewrite these historical grades.
baseline-r1: VOID; the interrupted report contains no completed observation.baseline-next-r1: VERIFICATION BLOCKED; required selectors were undiscovered, and no warmup or measured opening ran.baseline-owner-r1: VERIFICATION BLOCKED; the multiline row selector timed out during the incomplete warmup.baseline-owner-r2: VERIFICATION BLOCKED; readiness passed, but all ten measured attempts were prewarmed rather than cold.changed-measurement-r1: VERIFICATION PASSED; the excluded warmup and ten fresh openings completed.warm-retained-g9-r1: VERIFICATION PASSED; all ten measured warm openings reused ready rows without new requests or replays.replaced-return-g9-r1: VERIFICATION FAILED; the excluded warmup reproduced missing Back, and no measured return ran.nav-return-g10-r1: VERIFICATION BLOCKED; Back remained visible, but absent history was unproved and observation 01 retained its blocked grade.historyless-nav-g12-r1: VERIFICATION BLOCKED; existing history failed the admission gate before child, Done, or Back actions.initial-url-nav-g13-r1: VERIFICATION BLOCKED; Next.js was down before native execution.initial-url-nav-g13-r2: VERIFICATION BLOCKED; the workflow revision guard failed before patch application or native entry.initial-url-nav-g14-r1: VERIFICATION BLOCKED; the single initial-URL entry timed out before destination access.slow-g15-r1: VERIFICATION FAILED; the excluded warmup hid the child number in the pending title, so measured openings did not run.slow-g16-r1: STOPPED EARLY; the repaired warmup and observations 01–02 passed, while the round budget left 03–10 unrun.slow-g17-r1: VERIFICATION PASSED; a fresh excluded warmup and observations 03–06 passed.slow-g17-r2: VERIFICATION PASSED; observations 07–10 passed and completed the validated ten-observation aggregate.return-g17-r1: STOPPED EARLY; setup, warmup, and observations 02–03 passed, while the round budget left 04–05 unrun.return-g18-r2: VERIFICATION PASSED; fresh setup, warmup, and observation 04 passed, reaching the owner's reduced endpoint.Measured results and limits
Reproduced defects on the unfixed build
replaced-return-g9-r1;cf54a838arepairs it, and later with-history returns no longer reproduce it.slow-g15-r1;c656e55d0repairs wrapping, and the repaired warmup plus ten delayed observations no longer reproduce it.Reviewer Notes
Kilo-Org/cloud. Worktree:/Users/igor/Projects/.worktrees/mobile-child-performance-834d. No sibling repository worktrees belong to this change.eb6750c48b253194ad81cbf4d135e0c960c25120...d416abb04f36ee9812a07b1f4f2c86101df48226; branch:mobile-child-performance-834d.Human steps
Notes
i18n-leftoverpasses.