fix(site): fall back to chat detail cache for archive-and-delete confirmation - #25055
Closed
blinkagent[bot] wants to merge 1 commit into
Closed
fix(site): fall back to chat detail cache for archive-and-delete confirmation#25055blinkagent[bot] wants to merge 1 commit into
blinkagent[bot] wants to merge 1 commit into
Conversation
Member
|
Closing in favour of #25057 |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Closes CODAGT-317 (partially — see Caveat below).
Problem
The "Archive agent & delete workspace" molly-guard (typing the workspace name) was firing inconsistently for chats whose workspaces were clearly auto-provisioned. The heuristic in
resolveArchiveAndDeleteActionis:The
chatCreatedAtcallback only read from the infinite chat-list cache:If the chat row wasn't in a currently-loaded page of the infinite list query (different filter active, scrolled past the loaded pages, or invoked from a context where the sidebar list wasn't materialized for that chat), the lookup returned
undefined, thechatCreatedAt && ...short-circuited to false, and the dialog was shown regardless of who created the workspace. From the user's perspective the molly-guard appeared at random.Fix
Fall back to the per-chat detail cache (
chatKey(chatId)) when the list cache misses. That cache is populated whenever the user has visited the chat — which is essentially always true in the archive-and-delete flow.The resolver itself is unchanged — the existing
"chat not found in cache → confirm"test still holds. Only the call site widens where it looks forcreated_at.Caveat
This fixes one source of the false-positive dialog (cache miss). There are reports of the dialog still firing after a full page reload with the chat open, which would not be addressed by this change — those cases likely involve a workspace whose
created_atgenuinely predates the chat'screated_at(e.g. rebound to a pre-existing workspace, or a recreated-with-same-name workspace whose timestamp comparison goes the wrong way). Diagnostic info is being collected for that path; a more durable fix is in flight in #25053 which replaces the timestamp heuristic with an explicitworkspace_auto_createdcolumn.Test plan
pnpm lint:typespasses.pnpm vitest run --project=unit src/pages/AgentsPage/utils/agentWorkspaceUtils.test.ts— 28/28 pass; existing"chat not found in cache → confirm"case still covers the both-caches-miss scenario.pnpm biome checkpasses on the changed file.Created on behalf of @kylecarbs (reported) and @johnstcn (asked for the PR).