Skip to content

fix(thread): seed first-frame session/provenance, fold #5139, and shrink SharedThreadRouteContentContent - #5150

Closed
stamp-build[bot] wants to merge 5 commits into
mainfrom
agent/reef/thread-first-frame-session
Closed

stamp-build[bot] wants to merge 5 commits into
mainfrom
agent/reef/thread-first-frame-session

Conversation

@stamp-build

@stamp-build stamp-build Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Reef from raft opened this pull request through Stamp
View in Stamp →


Follow-up sweep for the Android 1.27.0 release blocker (#proj-mobile:#216), now rebased onto main (67e5dfc7c4, which includes #5143), folding in #5139 (7407d10881..fda59fb1ca) and extracting two cohesive helpers out of SharedThreadRouteContentContent so the combined code stays well under the 54,970-byte JVM method-size ratchet without raising the ceiling.

Root Cause

  1. Stale frame-1 event-bus upload / send closures (fix(thread): an edited image no longer sticks on "Checking file…" #5139, folded here): DisposableEffect(eventBus, threadInstanceKey) captured frame-1 uploadComposerAttachmentFiles and performComposerSend; wrapping both in rememberUpdatedState lambdas (not ::localFun, whose FunctionReference.equals ignores captured locals) keeps them fresh across recompositions.
  2. Remaining frame-1 null session / provenance / slug bugs on cached opens (fix(thread): seed first-frame session/provenance, fold #5139, and shrink SharedThreadRouteContentContent #5150): since fix(thread): a cached conversation opens without flashing Loading (#171) #5104 removed LoadingShell on cached opens, SharedThreadRouteContentContent mounted on frame 1 with currentSession, replyCacheProvenanceOwner, and currentServerSlug still null even though threadViewModel.ensureStarted() already captured the verified ReplyCacheProducerContext inline on the warm path:
    • ThreadPeerReadReceipts.kt: frame-1 BindOwner(null) wiped the shell-wide SharedPeerReadReceiptStore across every conversation.
    • ThreadPage.kt: createAgentComputerServerResolved latched true on null (server_id_missing).
    • Immediate Send/Retry (missing_owner_provenance), immediate Reply/Task opens (stale_provenance), inline task actions, early Unsave (recordMessageUnsaved), copyMessageLink, openActionCardChannel, and frame-1 misses for app link previews, Artifact cards, Task v2 lists, collapse, @mention suggestions, and quoted permalinks (serverSlug = null).
  3. JVM method-size ceiling: combining fix(thread): composer uploads key on the signed-in account from the first frame #5143 + fix(thread): an edited image no longer sticks on "Checking file…" #5139 pushed ThreadPageKt.SharedThreadRouteContentContent to 55,013 bytes (43 bytes over the 54,970-byte ratchet in scripts/ci/check_jvm_method_size.py).

Fix

  1. Folded fix(thread): an edited image no longer sticks on "Checking file…" #5139 (7407d10881..fda59fb1ca): explicit rememberUpdatedState lambdas for latestUploadComposerAttachmentFiles and latestPerformComposerSend.
  2. First-frame producer context & independent null-owner hardening (65abd1d026):
    • SharedThreadStore.kt: record this store's own inline initialProducerContext in start() (cleared in clear()), exposed via SharedThreadViewModel.initialProducerContext.
    • ThreadPage.kt: rememberThreadProducerContext(...) seeds frame-1 session/provenance/slug fenced by dataSource.isCurrentReplyCacheProvenance(it.provenance); createAgentComputerServerIdState/ResolvedState derived via rememberUpdatedState; toggleMessageSaved resolves owner session before unsaveMessage.
    • ThreadPeerReadReceipts.kt + RaftSharedStoreProvider.kt: ignore owner == null in bindThreadPeerReadReceiptsOwner and explicitly dispatch BindOwner(null) on all 4 sign-out / account-retirement / server-access-loss / scope-release paths.
  3. Method-size extraction (47d041e1c1):
    • Extracted ObserveThreadFirstContentPerformanceGate(...) (passing threadOpenStartedAt: () -> TimeMark? so live frame-1 reads and zero extra recompositions are preserved).
    • Extracted ThreadTaskConversationState + rememberThreadTaskConversationState(...), moving the Task v2 header/tasks/details ViewModels and effects out of SharedThreadRouteContentContent and collapsing 9 captured locals of the RaftForegroundBannerHost trailing lambda into 1 taskConversation object.

Verification

Lagoon and others added 5 commits November 20, 2026 11:02
…ng file…"

The event-bus effects that take the image editor's Done (and the other
composer events) are keyed only on the thread, so they kept the first
frame's copy of uploadComposerAttachmentFiles. On that frame the session
is not loaded yet, so the copy holds the upload store of account "".
The upload ran and succeeded there, but the composer applies outcomes
from the signed-in account's store, so the tile never left "Checking
file…". Since #5104 a cached conversation renders the full page on its
first frame, before the session is captured, which exposed this on
Android 1.27.0.

The effects now call the latest copy through rememberUpdatedState.

Co-authored-by: bytemain <13938334+bytemain@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ded session

The external-share auto-send collector is keyed only on the thread, so it
kept the first frame's performComposerSend, whose session and provenance
are null before the session loads: the send was rejected
(authority_changed_before_message_send) and the share never went out.
It now calls the latest copy through rememberUpdatedState.

Co-authored-by: bytemain <13938334+bytemain@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…function references

A local function reference compares equal across compositions (equals
ignores the captured locals), so rememberUpdatedState's structural
policy kept the first frame's copy and the previous commit had no
effect. Found by Reef in the alpha's dex.

Co-authored-by: bytemain <13938334+bytemain@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@stamp-build stamp-build Bot changed the title fix(thread): seed first-frame session and provenance on cached opens and harden null-owner effects fix(thread): seed first-frame session/provenance, fold #5139, and shrink SharedThreadRouteContentContent Nov 20, 2026
@stamp-build
stamp-build Bot force-pushed the agent/reef/thread-first-frame-session branch from e150bd8 to 47d041e Compare November 20, 2026 11:06
@stamp-build stamp-build Bot added the build-alpha Build a cloud-hosted .alpha validation APK label Nov 20, 2026
@stamp-build stamp-build Bot removed the build-alpha Build a cloud-hosted .alpha validation APK label Nov 20, 2026
@stamp-build

stamp-build Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

Merged by Stamp in batch 894d75681ac8d24d90255bd7f50b16c5: 99f4e64 . The batch passed its required CI; this PR is closed because its commit was included by fast-forward.

Review in stamp.build

@stamp-build stamp-build Bot closed this Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants