-
Couldn't load subscription status.
- Fork 83
feat(amazonq): support JupyterLab conversation history on refresh #2325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Allow multiple loadChats() calls in JupyterLab environment.
| * Determines if the environment is JupyterLab. | ||
| */ | ||
| private isJupyterLabEnvironment(): boolean { | ||
| return process.env.JUPYTER_LAB === 'true' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we have a try catch block? does this env var exist by default for Jupyterlab?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This environment variable doesn't exist by default, we set it when starting the LSP server
def start_lsp_server(self, node_path, executable_path, auth_mode=None):
env = os.environ.copy()
env["JUPYTER_LAB"] = "true" # We set this explicitly
Also tested this implementation on a SageMaker space where the JUPYTER_LAB environment variable is not
set, and the current functionalities still work, will not throw any errors.
Safe fallback behavior:
- When the env variable is not set: process.env.JUPYTER_LAB is undefined → undefined === 'true' → false → maintains existing behavior for all other IDEs
- When the env variable is set: process.env.JUPYTER_LAB is 'true' → 'true' === 'true' → true → enables JupyterLab-specific behavior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would prefer one so that all cases are covered and ls does not crash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would prefer one so that all cases are covered and ls does not crash
Done
6e043fa to
0c0779a
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2325 +/- ##
=======================================
Coverage 60.89% 60.90%
=======================================
Files 260 260
Lines 58313 58332 +19
Branches 3547 3550 +3
=======================================
+ Hits 35512 35527 +15
- Misses 22734 22738 +4
Partials 67 67
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Problem
In JupyterLab environments, when users start a new Q chat conversation and refresh their workspace, the active chat tab disappears and cannot be restored by clicking on it in the conversation history panel.
Solution
Allow multiple
loadChats()calls in JupyterLab environment to enable conversation history access after refresh. In other IDEs, maintain existing behavior.JUPYTER_LABenvironment variable detectionloadChats()calls only in JupyterLab to restore open tabsloadChats()callsLicense
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.