Skip to content

small chat 3#29131

Merged
chrisnojima merged 59 commits intonojima/HOTPOT-next-670-clean-2from
nojima/ZCLIENT-small-chat-3
Apr 13, 2026
Merged

small chat 3#29131
chrisnojima merged 59 commits intonojima/HOTPOT-next-670-clean-2from
nojima/ZCLIENT-small-chat-3

Conversation

@chrisnojima-zoom
Copy link
Copy Markdown
Contributor

@chrisnojima-zoom chrisnojima-zoom commented Apr 9, 2026

Move more out of inbox.
Unify how search bar works
Remove defer into component itself and simplify
Fix highlight and enter not working on inbox items sometimes

This comment was marked as outdated.

Comment thread go/chat/search/storage.go
@@ -672,26 +672,45 @@ func (s *store) Add(ctx context.Context, convID chat1.ConversationID,
msgs []chat1.MessageUnboxed,
) (err error) {
defer s.Trace(ctx, &err, "Add")()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed two deadlocks in the chat search indexer that caused thread loading to break permanently after switching users.

Bug 1: Indexer.Clear held idx.Lock() while performing bulk LevelDB deletes (one per indexed message in a conversation). All GetThreadNonblock calls go through
Indexer.Suspend, which also needs idx.Lock(), so they blocked for the entire duration of the delete loop — potentially many seconds.

Bug 2: store.Add held the store's write mutex (s.Lock()) while calling ChatHelper.GetMessages to fetch superseded messages for EDIT and ATTACHMENTUPLOADED message types.
That call goes through ConvSource.GetMessages → ConversationLockTab, which has no timeout on the lock acquisition path when no deadlock cycle is detected. If any other
goroutine held the conversation lock at that moment, store.Add would block indefinitely while holding s.Lock(). Since Indexer.Clear calls store.ClearMemory (which also
needs s.Lock()), it too blocked indefinitely, keeping idx.Lock() held and freezing all thread loading.

The repro: send a message via CLI as a different user, then switch users. The background indexer queues work from the previous session; when it processes EDIT messages it
triggers the store.Add → conv lock path while Indexer.Clear is running for the new session, creating the deadlock.

Fixes:

  • Removed the unnecessary idx.Lock() from Indexer.Clear — the store has its own concurrency controls and the indexer mutex guards unrelated fields (started, suspendCount).
  • Moved the superseded-message fetch in store.Add to before s.Lock() is acquired, so the mutex is only held for pure in-memory index mutations.

cc: @zoom-ua

Copy link
Copy Markdown
Contributor

@zoom-ua zoom-ua Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please pick these into master cc @mmaxim

did you audit the search code for any similar issues? can you add a regression test too?

This comment was marked as outdated.

Comment thread go/chat/search/storage.go
@@ -672,26 +672,45 @@ func (s *store) Add(ctx context.Context, convID chat1.ConversationID,
msgs []chat1.MessageUnboxed,
) (err error) {
defer s.Trace(ctx, &err, "Add")()
Copy link
Copy Markdown
Contributor

@zoom-ua zoom-ua Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please pick these into master cc @mmaxim

did you audit the search code for any similar issues? can you add a regression test too?

},
onMessagesUpdated: messagesUpdated => {
if (!messagesUpdated.updates) return
const activelyLookingAtThread = Common.isUserActivelyLookingAtThisThread(get().id)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

search indexing throws off a bunch of these as a side effect

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as outdated.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 42 out of 44 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread shared/chat/conversation/input-area/location-popup.native.tsx
Comment thread shared/chat/conversation/list-area/index.native.tsx
@chrisnojima chrisnojima changed the title WIP: small chat 3 small chat 3 Apr 13, 2026
@chrisnojima chrisnojima merged commit d4e7255 into nojima/HOTPOT-next-670-clean-2 Apr 13, 2026
@chrisnojima chrisnojima deleted the nojima/ZCLIENT-small-chat-3 branch April 13, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants