continuedev / continue

⏩ Continue is the leading open-source AI code assistant. You can connect any models and any context to build custom autocomplete and chat experiences inside VS Code and JetBrains
https://docs.continue.dev/
Apache License 2.0
18.79k stars 1.59k forks source link

Unable to run /edit or /comment when in a 'live share' session. #591

Open a3957273 opened 1 year ago

a3957273 commented 1 year ago

Before submitting your bug report

Relevant environment info

- OS: MacOS
- Continue: 0.0.413

Description

When attempting to run /edit or /comment on a file that's accessed via 'Remote SSH', continue.dev fails to update the file. The prompt responds successfully, but no code is changed.

To reproduce

  1. Connect to a 'Remote SSH' session.
  2. Attempt to comment some code.
  3. Observe the prompt succeeds but nothing happens.

Log output

[2023-10-29 21:14:39,987] [DEBUG] Loaded Meilisearch index
[2023-10-29 21:14:44,694] [DEBUG] Received GUI message {"messageType":"main_input","data":{"input":"/comment"}}

The prompt looks... suspicious:

This is the prompt that was sent to the LLM during this step

############################################

Settings:
model: gpt-4
temperature: 0.5
max_tokens: 1024

############################################

<User>
/comment

Take the file prefix and suffix into account, but only rewrite the code_to_edit as specified in the user_request. The code you write in modified_code_to_edit will replace the code between the code_to_edit tags. Do NOT preface your answer or write anything other than code. The </modified_code_to_edit> tag should be written to indicate the end of the modified code section. Do not ever use nested tags.

Example:

<file_prefix>
class Database:
    def __init__(self):
        self._data = {{}}

    def get(self, key):
        return self._data[key]

</file_prefix>
<code_to_edit>
    def set(self, key, value):
        self._data[key] = value
</code_to_edit>
<file_suffix>

    def clear_all():
        self._data = {{}}
</file_suffix>
<user_request>
Raise an error if the key already exists.
</user_request>
<modified_code_to_edit>
    def set(self, key, value):
        if key in self._data:
            raise KeyError(f"Key {{key}} already exists")
        self._data[key] = value
</modified_code_to_edit>

Main task:

<code_to_edit>
"use strict";
/*
 * ATTENTION: An "eval-source-map" devtool has been used.
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
self["webpackHotUpdate_N_E"]("webpack",{},
/******/ function(__webpack_require__) { // webpackRuntimeModules
/******/ /* webpack/runtime/getFullHash */
/******/ !function() {
/******/    __webpack_require__.h = function() { return "5ac3467bd283684b"; }
/******/ }();
/******/ 
/******/ }
)
</code_to_edit>
<user_request>
Write comprehensive comments in the canonical format for every class and function
</user_request>
<modified_code_to_edit>

############################################

Settings:
model: gpt-35-turbo
max_tokens: 600

############################################

            Diff summary: "Write comprehensive comments in the canonical format for every class and function"

              "use strict";
  /*
   * ATTENTION: An "eval-source-map" devtool has been used.
   * This devtool is neither made for production nor for readable output files.
   * It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
   * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
   * or disable the default devtool with "devtool: false".
   * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
   */
+ 
+ /**
+  * The webpackHotUpdate_N_E function is a part of the Webpack's Hot Module Replacement (HMR) system.
+  * This function is responsible for applying updates to the current module.
+  * @param {string} name - The name of the current module.
+  * @param {Object} modules - An object containing the updated modules.
+  * @param {Function} applyHandlers - A function that applies the module updates.
+  */
  self["webpackHotUpdate_N_E"]("webpack",{},
+ /**
+  * Webpack runtime function.
+  * @param {Function} __webpack_require__ - The Webpack require function.
+  */
  /******/ function(__webpack_require__) { // webpackRuntimeModules
  /******/ /* webpack/runtime/getFullHash */
+ 
+ /**
+  * This function is a part of Webpack's runtime.
+  * It's responsible for getting the full hash of the current build.
+  * The hash is used by the HMR system to check if the current module is up to date.
+  */
  /******/ !function() {
  /******/  __webpack_require__.h = function() { return "5ac3467bd283684b"; }
  /******/ }();
- /******/ 
?         -

+ /******/
  /******/ }
  )
        Please briefly explain the changes made to the code above. Give no more than 2-3 sentences, and use markdown bullet points:

############################################

Settings: model: gpt-35-turbo max_tokens: 600

############################################

Write a very short title to describe this requested change (no quotes): 'Write comprehensive comments in the canonical format for every class and function'. This is the title:


The webpack compiled code was _not_ what I requested it to comment.  I requested it to comment a generic TypeScript file I had written.
sestinj commented 1 year ago

@a3957273 the incorrect prompt looks like it's related to a fix that I'll be releasing today.

When you say "The prompt responds successfully, but no code is changed." can I confirm that you mean you're seeing a response in the sidebar that describes some changes, but the "side-by-side diff window" is never opened showing changes in the actual editor?

It would be helpful to know: in this sharing session, are you located on the host machine, or are you connecting to someone else's machine?