refactor(session): adopt streamer lifecycle for ended vs hold - #556
Draft
RonenMars wants to merge 1 commit into
Draft
refactor(session): adopt streamer lifecycle for ended vs hold#556RonenMars wants to merge 1 commit into
RonenMars wants to merge 1 commit into
Conversation
Replace idle+!ptyAttached / completedAt inference with the streamer's additive lifecycle field. sessionPhase and sessionOpensAsHistory now prefer lifecycle so holds (resumable) are not conflated with genuine ends, while older servers keep the legacy idle+detached fallback. Co-authored-by: Ronen Mars <ronenmars@gmail.com>
RonenMars
force-pushed
the
refactor/session-lifecycle-phase
branch
from
August 6, 2026 04:32
78f2425 to
9c04478
Compare
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
Closes #508.
The streamer already ships an additive
lifecyclefield (attached|detached|orphaned|resumable|completed|failed). Streamer #437 made holds reportresumableinstead ofcompleted, and documented thatcompletedAtis stamped on both a real exit and a hold — so it cannot be the client's "ended" signal.This PR adopts that contract on mobile:
lifecycle/lifecycleSource/lifecycleUpdatedAttoSessionsessionPhase()to preferlifecycle(and stop treatingcompletedAtalone as ended)sessionOpensAsHistory()for the session-screen redirect and live-activity terminal checkisTerminal, conversation→session live gate, and hub presentation (resumable → historical/resume) to the new helpersidle + !ptyAttachedfallback whenlifecycleis absent (older servers +starting=1still gates spawn)Test plan
npx jest --ci --runInBand --forceExit --testPathPattern "sessionPresentation|live-activity\.test|SessionScreen.endedRedirect|LiveActivity.reconcile"— 58 passednpx jest --ci --runInBand --forceExit --testPathPattern "conversation-detail-gating|SessionStatusBadge"— 19 passedapp/session/[id].tsx)