You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With stateful/vscode-runme#1744 I noticed an edge case where a new GenerateStream was not initiated and instead the existing stream was reused. This lead the a failure because the sessionIds didn't match so the server detects that the update is invalid and that a new stream should have been initiated.
I think the problem is when we close the notebook we don't clear the state in the map. Therefore there is an edge case where you
Close a document
Reopen a document
If the active cell on initial open is the same as the one that was active on close, then the ghost cell generator assumes the existing stream is for the current cell and a new one doesn't need to be initiated.
Since the server detects that the update is invalid and closes the stream, the client will initiate a new stream on the next cellChangeEvent. If the user is editing the cell then a new event will be generated and thus a new stream is generated.
However, if the user is just executing a cell then there is no follow up event to initiate a new stream.
There's two potential ways to fix this.
We could try to clear the nbstate when the document closes
We could add retries to the stream generation code
2 might be better solution because if a user expects a completion and this doesn't happen due to a transient issue (i.e. this issue or some other error) then we'd like to retry automatically because not generating a completion is frustrating.
The text was updated successfully, but these errors were encountered:
With stateful/vscode-runme#1744 I noticed an edge case where a new GenerateStream was not initiated and instead the existing stream was reused. This lead the a failure because the sessionIds didn't match so the server detects that the update is invalid and that a new stream should have been initiated.
Here's the relevant server logs.
Here's what I believe to be the root cause.
In the VSCode extension, the GhostCellGenerator keeps track of the active cell that is associated with the current stream. It uses this to detect when the active cell changes and therefore a new stream should be initiated. It does this by storing the activeCell in a map keyed by notebookUri
https://github.com/stateful/vscode-runme/blob/90fcc5b60322b4fe34be714ac120a5794004f837/src/extension/ai/ghost.ts#L40
I think the problem is when we close the notebook we don't clear the state in the map. Therefore there is an edge case where you
If the active cell on initial open is the same as the one that was active on close, then the ghost cell generator assumes the existing stream is for the current cell and a new one doesn't need to be initiated.
Since the server detects that the update is invalid and closes the stream, the client will initiate a new stream on the next cellChangeEvent. If the user is editing the cell then a new event will be generated and thus a new stream is generated.
However, if the user is just executing a cell then there is no follow up event to initiate a new stream.
There's two potential ways to fix this.
2 might be better solution because if a user expects a completion and this doesn't happen due to a transient issue (i.e. this issue or some other error) then we'd like to retry automatically because not generating a completion is frustrating.
The text was updated successfully, but these errors were encountered: