Conversation
`activate_session_conversation` previously only wrote the session mapping; it never updated the conversation's `last_activated_at` metadata. This meant that `jp c use` and `jp query` did not actually refresh the "last worked on" timestamp that drives list sorting, archive cutoffs, and `--id=last`. The fix splits the old method into two: - `activate_session_conversation(&ConversationLock, ...)` — requires the caller to already hold the conversation lock. It bumps `last_activated_at` on the metadata and writes the session mapping. Requiring a `&ConversationLock` makes it a type-level invariant that the metadata write is safe. - `record_session_activation(session, id, now)` — the old behaviour: writes only the session mapping, leaving conversation metadata untouched. Used in the lock-contention fallback and in tests that exercise session-mapping logic in isolation. In `jp c use`, a non-blocking lock attempt is now made before activating. If the lock is acquired, the full `activate_session_conversation` path runs. If another process holds the lock (e.g. a streaming query is in progress), `record_session_activation` is used as a fallback so the session mapping is still captured immediately, while `last_activated_at` is left at the lock holder's recent value — close enough for sorting and archive purposes in the common case. Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
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.
activate_session_conversationpreviously only wrote the session mapping; it never updated the conversation'slast_activated_atmetadata. This meant thatjp c useandjp querydid not actually refresh the "last worked on" timestamp that drives list sorting, archive cutoffs, and--id=last.The fix splits the old method into two:
activate_session_conversation(&ConversationLock, ...)— requires the caller to already hold the conversation lock. It bumpslast_activated_aton the metadata and writes the session mapping. Requiring a&ConversationLockmakes it a type-level invariant that the metadata write is safe.record_session_activation(session, id, now)— the old behaviour: writes only the session mapping, leaving conversation metadata untouched. Used in the lock-contention fallback and in tests that exercise session-mapping logic in isolation.In
jp c use, a non-blocking lock attempt is now made before activating. If the lock is acquired, the fullactivate_session_conversationpath runs. If another process holds the lock (e.g. a streaming query is in progress),record_session_activationis used as a fallback so the session mapping is still captured immediately, whilelast_activated_atis left at the lock holder's recent value — close enough for sorting and archive purposes in the common case.