fix(mobile): scope child session error to the child sheet - #5413
Open
iscekic wants to merge 3 commits into
Open
Conversation
Route a child session.error (non-root sessionId) to a new optional onChildSessionError callback instead of the shared root status and onError. The manager stores the message per child id in a new childSessionErrorsAtom and exposes a read-only childSessionError atom. Events without a sessionId keep the legacy root behavior.
Read the per-child error atom in the session detail screen and pass it into the child sheet. The sheet shows a runtime error only in the failed child: an error state when the child has no messages, an error banner above the transcript when it has messages. The parent indicator, error atom, and composer are untouched.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryIncremental review of the server root-ID adoption fix; child-error routing now stays on the parent path after Files Reviewed (2 files)
Previous Review Summary (commit 6e384af)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 6e384af)Status: No Issues Found | Recommendation: Merge Files Reviewed (9 files)
Reviewed by grok-4.6 · Input: 144K · Output: 8.2K · Cached: 173.3K Review guidance: REVIEW.md from base branch |
pandemicsyn
approved these changes
Aug 21, 2026
jrf0110
approved these changes
Aug 21, 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
A
session.errorevent with a non-rootsessionIdnow routes to a newonChildSessionErrorcallback and returns before the shared root status oronErrorpath. An event without asessionIdkeeps the legacy root behavior. This keeps a child failure from touching the parent status indicator.Files
packages/cloud-agent-sdk/src/service-state.ts— addsonChildSessionErrortoServiceStateConfig;processSessionErrorroutes non-rootsessionIdevents to it and returns before the root error path.packages/cloud-agent-sdk/src/session.ts— addsonChildSessionErrortoCloudAgentSessionConfigand forwards it tocreateServiceState.The session manager records each child's failure message in a new
childSessionErrorsAtommap and exposes a read-onlychildSessionErroratom that returns the message for a child id, or null. The map clears with the other atoms on switch and destroy, so a stale child error cannot leak into the next session.Files
packages/cloud-agent-sdk/src/session-manager.ts— adds thechildSessionErroratom toSessionManagerAtoms, the backing map, the derived reader, theonChildSessionErrorhandler, and the clear/reset wiring.The child session sheet renders a runtime failure only in the failed child: a child with no messages shows a "Subagent session failed" error state, and a child with messages shows an error banner above the transcript. The parent detail screen reads the per-child error atom and passes the open child's message into the sheet.
Files
apps/mobile/src/components/agents/child-session-sheet-state.ts—getChildSessionSheetStatetakes asessionErrorargument and returnserrorfor it when the child has no messages.apps/mobile/src/components/agents/child-session-sheet.tsx— acceptssessionError; renders the no-message error state or the above-transcript banner.apps/mobile/src/components/agents/session-detail-content.tsx— readsmanager.atoms.childSessionErrorand passes the open child's message to the sheet.Tests: 3 test files updated (
child-session-sheet-state.test.ts,service-state.test.ts,session-manager.test.ts).Generated: none.
Verification
One iOS device round ran two cases.
No defect was reproduced on an unfixed build: the fix landed before round 1, so no round ran on an unfixed build.
Visual Changes
Parent session detail screen (mobile). The user sees a usable composer and no error banner above it after a message round trip. In the picture, the Preparation complete row sits above the Message... composer, where an error banner would appear, and no error text is present.
Reviewer Notes
Human steps: none needed.
Notes: none.