session#id errs due to its option being a hash {:skip=>true}
Merge Request: Fix GitLab Duo chat session error in the Web IDE (!171262 - merged)
Summary
A small portion of sessions (ActionDispatch::Request::Session) we encounter would err when calling its id method.
Calling session.id would delegate to its option, which is expected to be an ActionDispatch::Request::Session::Options.
The session with errors have a plain hash {:skip=>true} as option instead, resulting in the following error:
NoMethodError
undefined method `id' for {:skip=>true}:Hash
options.id(@req)
See Sentry
Even though this is rescued so production users will still be able to use most of Duo Chat, they will see error when requesting group SSO protected resources (e.g. ask about an issue/epic within group SSO protected group).
Steps to reproduce
In WebIDE's Duo Chat, type "hi" as the message.
Example Project
What is the current bug behavior?
- Calling session.id fails and errs.
- In WebIDE Duo Chat, typing an question related to an issue in a SSO protected group, will see error.
What is the expected correct behavior?
- Calling session.id should not err
- In WebIDE Duo Chat, typing an question related to an issue in a SSO protected group, will see actual answer.
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com
Possible fixes
Edited by Enrique Alcántara