Persist token count and scroll position across agent restarts#50620
Merged
Persist token count and scroll position across agent restarts#50620
Conversation
6de7065 to
a8b2636
Compare
- Move scroll handler from ConnectionView into ThreadView so it can trigger persistence. - Extract schedule_save() method that coalesces saves with a throttle timer. Both the draft prompt observer and the scroll handler call it, replacing the old _draft_save_task with a shared _save_task. - Add dbg! statements at each step of the scroll position data flow for debugging.
- Use gpui::ListOffset as the in-memory type for scroll position on both Thread and AcpThread. SerializedScrollPosition remains only for the serde boundary in DbThread. Eliminates all manual conversions between layers. - Consistent naming: ui_scroll_position everywhere (field, getter, setter) across AcpThread, Thread, and DbThread. - Scroll handler writes directly to Thread via as_native_thread() instead of bouncing through AcpThread. AcpThread only carries the initial value during the load path (set in register_session). - Remove all dbg! statements. - Revert from_db back to tail expression (intermediate binding was only needed for removed dbg!). - Add comment explaining cx.defer in scroll handler (RefCell hazard). - Use assert_eq! for float comparison in test (12.5 is exactly representable in f32).
2be6b72 to
f90e65e
Compare
mikayla-maki
approved these changes
Mar 3, 2026
tahayvr
pushed a commit
to tahayvr/zed
that referenced
this pull request
Mar 4, 2026
…dustries#50620) Release Notes: - Token counts and scroll position are restored when loading a previous agent thread
wzulfikar
pushed a commit
to wzulfikar/zed
that referenced
this pull request
Mar 4, 2026
…dustries#50620) Release Notes: - Token counts and scroll position are restored when loading a previous agent thread
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.
Release Notes: