fix(grok): preserve conversation across repeated ask calls#332
Open
Astro-Han wants to merge 1 commit intojackwener:mainfrom
Open
fix(grok): preserve conversation across repeated ask calls#332Astro-Han wants to merge 1 commit intojackwener:mainfrom
Astro-Han wants to merge 1 commit intojackwener:mainfrom
Conversation
…#330) The adapter unconditionally navigated to grok.com/ on every invocation, destroying the existing conversation URL even when --new was not passed. Since the browser daemon already reuses the same Chrome tab, skipping navigation lets the tab stay on the current chat thread. - Only navigate to grok.com/ when --new is true or tab is not on grok.com - Add tryStartFreshChat to the default path's --new branch (was dead code) - Add isOnGrok helper with hostname-based domain matching - Add unit tests for isOnGrok
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.
Description
Fix session continuity for
grok ask— repeated calls now continue the same conversation instead of creating a new one each time.Root cause: the adapter unconditionally navigated to
https://grok.com/(the new-chat homepage) on every invocation, destroying the existing conversation URL. Since the browser daemon already reuses the same Chrome tab across commands, simply skipping the navigation lets the tab stay on the current chat thread.Related issue: #330
Type of Change
Checklist
Changes
isOnGrok()helper — checkswindow.location.hrefhostname to determine if the tab is already ongrok.com, usingnew URL().hostnamefor precise matching (rejectsfakegrok.cometc.)runDefaultAsk— replaced unconditionalpage.goto(GROK_URL)with conditional navigation: only whennewChat=trueor tab is not on grok.comrunExplicitWebAsk— same conditional navigation logicif (newChat)block inrunDefaultAsk(lines 62-73) was overridden by the unconditionalgotoon line 75; nownewChatproperly callstryStartFreshChat()isOnGrokcovering: grok.com URLs, subdomains, non-grok domains, and detached tab errorsScreenshots / Output