Skip to content

[Linux App 26.1021.22027] Switching conversations restores stale/top transcript position #57404

Open

Description

@a408665321

What version of the Codex App are you using (From “About Codex” dialog)?

26.1021.22027, read from the installed Linux package metadata. The About-dialog value was not independently captured.

What subscription do you have?

Not included; no subscription-specific cause has been established.

What platform is your computer?

Ubuntu 24.04.3 LTS, Linux 7.0.0-38-generic, x86_64.

What issue are you seeing?

The conversation transcript repeatedly returns to the top/earliest messages after switching to another conversation and back. Manually navigating to the latest messages does not reliably persist across the next switch, making long conversations difficult to use. This concerns the main conversation transcript, not the sidebar or a file preview.

This report adds a Linux occurrence and a bounded stale-restoration-snapshot investigation. Related reports:

These reports may share a symptom without sharing a root cause. If this Linux occurrence belongs under an existing issue, please consolidate it there.

What steps can reproduce the bug?

User-reported procedure on the affected installation:

  1. Open a long existing local Codex conversation.
  2. Manually scroll to the latest output, or note a recognizable historical reading position.
  3. Select another conversation in the sidebar.
  4. Select the original conversation again.
  5. It returns to the top/oldest messages instead of the position just selected. Repeating the navigation continues to lose the position.

The affected conversation uses paginated history. Its local record was approximately 14 MiB when inspected. The record parsed successfully and continued to receive updates; this establishes message-record health, not scroll-state correctness. No conversation contents or identifiers are attached.

What is the expected behavior?

Preserve each conversation's last valid reading anchor across navigation. If the user was at the bottom, resume following the latest output. If reading history, preserve that position. Delayed history loading or virtual-list measurements must not replace a newer user-selected position with an older restoration request.

Additional information

Candidate stale-snapshot path — not a confirmed native-UI root cause

Read-only inspection of the shipped conversation renderer found an initial restoration snapshot cached by conversation ID, hidden-content flag, restore-enabled flag, and store identity. The cache does not include the transcript-visible flag, although visibility participates in whether the transcript is active. The saved state includes distance-from-bottom, latest-turn follow state, and a virtualized-list restoration anchor.

A bounded harness executes the extracted snapshot-cache block with a persistent memo-cache array and a synchronous per-conversation store. It reproduces this sequence:

  1. Render conversation A with saved distance-from-bottom 9000 and an old anchor.
  2. Save a newer position, such as distance 0 (bottom), or 1200 plus a different history anchor.
  3. Toggle the transcript-visible input false and then true without changing the other cache dependencies.
  4. The cache still returns distance 9000 and the old anchor.

Refreshing this initial snapshot on transcript visibility transitions makes both assertions pass. A local experiment adds that visibility dependency and one compiler-cache slot. All five bounded checks pass: returning to bottom, returning to a saved history anchor, stable snapshots during ordinary visible rerenders, independent conversation IDs, and existing hidden/restore-disabled opt-outs.

Conceptually, the proposed invariant is to refresh the activation snapshot when a retained transcript becomes visible again, while leaving it stable during ordinary visible renders. This is not a request to continuously reapply the saved offset on every scroll-state update.

Verification limits

  • The harness isolates the installed cache block. It does not simulate React scheduling, actual panel retention/remount behavior, or browser layout/virtual-list timing.
  • A separate local test application successfully loaded and initialized the experimentally patched module without page errors. This is a startup/module-loading check, not a logged-in scroll-switching regression test.
  • No synchronized before-switch/store-write/after-switch DOM trace was captured. The visibility transition reaching this cache on the affected UI path remains to be established.
  • The user has not confirmed that the experimental patch resolves the real symptom. It is not an upstream fix or a recommended supported workaround.
  • This issue was observed before the experimental scroll patch. A fresh clean-install A/B comparison has not been performed.

Please investigate the saved-state writers and restoration reads during conversation activation, including virtual-list anchors and latest-row height updates. A useful native regression would cover switching away/back from both the exact bottom and historical content, then delivering delayed history/layout measurements.

The public repository does not expose the desktop conversation renderer, and docs/contributing.md currently says external code contributions/PRs are not accepted. Accordingly, the candidate change and its limitations are provided here for maintainer review rather than submitted as an unrelated CLI/TUI patch.

No private project names, local paths, raw logs, transcripts, account identifiers, credentials, screenshots, or packaged application code are included.

Activity

  1. added
    bug
    app
    session
    on Oct 27, 2026
  2. github-actions commented on Oct 27, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  3. a408665321 commented on Oct 28, 2026

    @a408665321
    Author

    Follow-up, 2026-10-28: the initial visibility-dependency experiment did not resolve the affected user's real conversation-switching symptom. The running process was verified to use the patched application copy, and the installed conversation asset matched the tested patched source. Please do not treat the five isolated cache checks in the original report as a validated UI fix.

    ResizeObserver errors correlate with activation of the affected conversation

    A read-only analysis of the current desktop process's retained log found the following signature:

    [desktop-notifications][global-error]
    ResizeObserver loop completed with undelivered notifications.
    rendererWindowAppearance=primary rendererWindowVisible=true
    

    At the analysis snapshot there were 408 matching log rows. Comparing primary-window thread_stream_view_activity_changed active=true events with subsequent error rows:

    Activity-event group Activation events At least one global ResizeObserver error in the following 3 seconds
    Affected conversation 20 19 (95%)
    All other conversations combined 69 31 (about 45%)

    For one affected-conversation activation at 2026-10-28 02:34:14.995 UTC, matching errors followed approximately 2, 36, 42, 68, 130 and 155 ms later, with another at about 2.456 s.

    These are associations, not recorded viewport resets. Activity events are proxies for activation, not a verified count of manual navigation clicks. Errors are primary-renderer-global, do not contain a conversation ID or observer stack, and may arise from other UI elements. The 3-second windows can overlap. There is no synchronized trace of the actual viewport jumping. The error could be a contributor, a consequence, or a shared symptom of a layout/restoration feedback loop.

    A second stale-target path remains in the experimentally patched renderer

    An isolated probe executing the shipped bottom-navigation, latest-height, and restore callbacks in a synchronous scroll-controller harness produced:

    1. Initial saved restoration distance=1000, saved latest-row height=100, static follow mode.
    2. Execute explicit bottom navigation: distance=0, restoration marked finished, follow mode=user_follow.
    3. Deliver a delayed latest-row height of 200: the height handler reopens restoration and updates the old target to 1100; its follow-latest branch brings distance back to 0.
    4. Invoke the restore callback again: it commands distance=1100 although follow mode is still user_follow.

    The scroll-command sequence was [0, 0, 1100]. The installed asset was verified identical to the source used by the probe. This remains a callback-level reproduction, not evidence that this exact sequence occurred in the user's native UI. It does not exercise actual React scheduling, DOM geometry, panel lifecycle, or ResizeObserver delivery, and does not explain the exact top destination by itself. A closely related callback-level lead was independently reported in #52139; please consider that existing analysis as well.

    Source-review leads and proposed invariants

    The virtualized list's row-size observer can update measured heights, directly change the list container height, and use a synchronous UI commit path. Separate scroll-container size observers can consume spacer growth and compensate scroll position. This makes observer/layout/restoration interaction worth tracing, but does not identify which observer generated the global error.

    Suggested investigation and regression requirements:

    • An explicit newer user scroll or bottom-navigation request must supersede the previous restoration request. Delayed height measurements may compensate geometry but must not resurrect a superseded target. A restoration generation/cancellation token is one possible implementation, not a verified patch.
    • Preserve a valid message anchor and follow-latest state through history hydration and delayed latest-row measurements.
    • Identify the actual offending ResizeObserver before changing scheduling. If measurements cause synchronous observed-size writes, consider coalescing writes across a frame and skipping equal geometry, while preserving valid viewport compensation. Do not merely suppress the global error.
    • Capture activation, observer identity/geometry, restoration generation and target, explicit-user-navigation events, and actual scroll commands in a real switch-away/back regression. Cover both bottom-follow and historical-reading positions.

    The affected local conversation remains paginated and had grown to approximately 26 MiB; 8366 record lines parsed with no JSON errors. This is context, not proof that size causes the bug. No restart, settings change, additional app patch, or conversation-data change was performed during this follow-up investigation.

    The bot suggested #57378 as a possible duplicate. This follow-up adds Linux activation/ResizeObserver timing and bounded callback evidence; maintainers can consolidate it under the appropriate desktop issue. No private conversation contents/IDs, local paths, account details, credentials or raw application logs are attached.

  4. a408665321 commented on Nov 2, 2026

    @a408665321
    Author

    Follow-up, 2026-11-02: a revised local experimental patch appears to resolve the affected user's conversation-switching symptom so far. The user reported this today; it is encouraging user feedback, not an upstream fix or a controlled clean-install A/B result.

    Stronger runtime evidence: restoration completes during placeholder layout

    After the earlier visibility-dependency experiment failed, targeted diagnostics were added to the installed desktop renderer. They record saved-distance reads, restoration state/targets, follow mode, viewport geometry, and cleanup writes, without conversation contents. Three captured failures showed the same premature-completion pattern. One representative sequence was:

    Relative time Event / state
    0 ms Read saved distance-from-bottom = 0 (correct bottom position).
    +54 ms Activation requests bottom; scrollHeight=954, clientHeight=954, scrollTop=0 — a viewport-sized placeholder with no scroll range.
    +163 ms Restoration callback sees done=false, target=0, mode=prework_follow. The existing bypass marks restoration complete.
    +342 ms Cleanup sees scrollHeight=6294, clientHeight=948, scrollTop=0, done=true, target=0; it saves distance-from-bottom 5346.
    Subsequent callbacks done=true causes restoration to return without correcting the position.

    This connects the valid saved bottom position to premature completion and then to persistence of the incorrect top position. It supports a desktop frontend restoration/lifecycle defect on this path. It does not establish a common cause for every report of lost scroll position.

    Correction to the earlier ResizeObserver lead

    There was no ResizeObserver loop error within ±2 seconds of any of these three captured failures. The correlation in my previous comment remains an association, but these newer traces weaken the hypothesis that the global observer-loop error is necessary to trigger this failure. The local fix does not suppress those errors or alter observer scheduling.

    The separate delayed-height callback probe described previously ([0, 0, 1100]) remains a distinct callback-level lead; it should not be conflated with the runtime sequence above.

    Revised local fix and review-driven changes

    The change was developed against the same installed app version, 26.1021.22027. In conceptual source terms:

    • For an initial near-bottom target (within 24 px) in prework_follow or user_follow, keep restoration pending through placeholder and intermediate layouts. Restore bottom during those layouts and complete when the existing visible-content-ready callback runs, rather than merely when content first becomes scrollable.
    • Expose the pending bottom target consistently to the virtualized list, preventing competing anchor compensation. With measured-viewport preservation enabled, the actual restore runs through the existing layout/viewport callbacks after measurement compensation; the getter alone does not command a scroll.
    • Record cancellation durably on user scrolling, hold-viewport, explicit bottom navigation, leaving follow mode, or a genuine latest-turn change. Delayed stored-height adjustment must not reactivate a canceled initial-bottom restore.
    • Preserve the existing pending-message-to-server-turn acknowledgement case, and retain historical-position restoration behavior.
    • Use a stable visible-content-ready handler. An initial draft created a new inline handler during renders; review identified that this could repeatedly cancel/restart the child's two-animation-frame readiness wait while streaming. That draft was corrected before installation.

    Claude Code performed source review and follow-up reviews. Review identified partial-hydration, short-content lifetime, callback-identity, and message-reconciliation risks; the implementation was revised accordingly. Final review found no remaining concrete blocker to a reversible local experiment. This is not maintainer approval. The reviewer could not execute tests on its host; test results below were executed locally.

    Validation and remaining limits

    • 15/15 local regression checks passed against the extracted compiled callback and surrounding integration callbacks. Coverage includes three-stage hydration, short conversations completing at readiness, historical targets, cancellation after stored-height rearming, follow-mode exit, new-turn placement, pending-message acknowledgement, the pending getter, and the ready handler.
    • In an isolated, unauthenticated application profile, the patched module initialized successfully. A real DOM / ResizeObserver scenario grew content through 948 → 1300 → 3000 → 6294 px with a final 948 px viewport; restoration reached scrollTop=5346. The canceled case stayed at top with no restoration scroll commands.
    • JavaScript syntax validation and packaged-asset integrity checks passed. The experiment uses a reversible user-local application copy, retaining the original system package and existing sandbox profile. No conversation data was edited.
    • 2026-11-02 user feedback: it appears fixed in actual use. No fresh synchronized logged-in trace or exhaustive UI regression was captured with that feedback, so duration, repeat count, streaming behavior, and all historical-reading cases remain unquantified. Existing diagnostics are retained for any recurrence.
    • The previous visibility-snapshot experiment remains in the local experimental base. There was no clean-install A/B isolation of the new change alone, so the result should not be treated as proof that this change is sufficient on every installation.

    Suggested upstream regression: activate a long conversation from saved bottom, deliver a viewport-sized placeholder followed by several history/layout stages, and verify restoration does not complete early or persist top as the next snapshot. Also cover active streaming, short content, historical reading, user interaction during hydration, and pending-message acknowledgement.

    No private conversation identifiers, project names, local paths, raw logs, credentials, or packaged application source are attached. The existing issue is left open for maintainer investigation and an upstream fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Linuxappbugsession

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions