-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
cody: log user out on invalid session + display error in-chat #51005
Conversation
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.
I like the new check!
Bundle size report 📦
Look at the Statoscope report for a full comparison between the commits 9130ebd and 123ed1b or learn more. Open explanation
|
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.
Added an inline comment about how to resume after an error. It doesn't block this PR but I was wondering about it as I looked at the code, maybe you have some thoughts there :)
Does this need extra logic for cody in the web?
void this.sendLogin(false) | ||
this.clearAndRestartSession() | ||
} | ||
this.onCompletionEnd() |
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.
If an error occurs, that means that there will be an empty assistant message in the transcript. Do we want to simply continue with that, or restart before the failure?
Ex:
H: Hi
A: Hi!
H: What is X
A: <error>
Should the new transcript for another submission after the error be
H: Hi
A: Hi!
H: What is X
H: Oh an error, ok. What is X?
A: It is X!
or
H: Hi
A: Hi!
H: What is X
A: ''
H: Oh an error, ok. What is X?
A: It is X!
If it's the latter, I think we should attach the error to the message in the transcript so it's also persisted that we later know that the errored message produced an empty response and why (?)
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.
i've replaced the empty assistant message with:
text: 'Failed to generate response due to server error.', |
So the flow will be like:
H: Hi
A: Hi!
H: What is X
A: Failed to generate response due to server error.
H: Oh an error, ok. What is X?
A: It is X!
Does this address your concern? If not I can open a new PR for this, just lmk :D
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.
i've replaced the empty assistant message with:
text: 'Failed to generate response due to server error.', |
So the flow will be like:
H: Hi
A: Hi!
H: What is X
A: Failed to generate response due to server error.
H: Oh an error, ok. What is X?
A: It is X!
Does this address your concern? If not I can open a new PR for this, just lmk :D
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.
Does this send that failure message in the transcript to the LLM or is that hidden from there? Just curious, might confuse the LLM 😬
But otherwise that sounds great, thank you @abeatrix!
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.
What's included in speaker.text is sent to LLM and hidden from user, and what's included in speaker.displayText is displayed to user, but hidden from LLM (if i not mistaken 😆 )
Example:
sourcegraph/client/cody-shared/src/prompt/prompt-mixin.ts
Lines 16 to 18 in 9130ebd
// Stuff the prompt mixins at the start of the human text. | |
// Note we do not reflect them in displayText. | |
return { ...humanMessage, text: `${mixins}\n\nConversation starts here:\n\n${humanMessage.text}` } |
I hope this makes sense 😄
re-add `this.isMessageInProgress = false` that was removed by mistake in my last PR: #51005 ## Test plan <!-- All pull requests REQUIRE a test plan: https://docs.sourcegraph.com/dev/background-information/testing_principles --> Minor change. Same test cases, all passing.
re-add `this.isMessageInProgress = false` that was removed by mistake in my last PR: sourcegraph/sourcegraph#51005 ## Test plan <!-- All pull requests REQUIRE a test plan: https://docs.sourcegraph.com/dev/background-information/testing_principles --> Minor change. Same test cases, all passing.
RE #50973 #50307
Current Issue: When the token become invalid during the chat session, it does not log users out and not displaying any error message
Solution: Log the user out for invalid login credentials during the chat session.
More detail in Loom: https://www.loom.com/share/cfd51d7cd97e49989af77c8d2e103973
Updated: Display error message in frontend https://www.loom.com/share/4a4ef8a298e241c9af220ad116a4d5be
Example:
![image](https://user-images.githubusercontent.com/68532117/234289394-e8d3fd57-3051-4f11-8d6c-36275dde02a4.png)
Shout out to @eseliger for his PR on sending error messages to chat client!
Test plan
All tests have passed and tested locally. See changes in the attached loom video above