Add cookies from http session to web socket used by JupyterCodeExecutor
Why are these changes needed?
As noted in the below issue session affinity doesn't work as expected in a Kubernetes environment if the cookies aren't shared between the http and wss requests. AutoGen is likely to try to establish a WS connection with a kernel that was created in a different pod.
Related issue number
Closes #3311
Checks
- [ ] I've included any doc changes needed for https://microsoft.github.io/autogen/. See https://microsoft.github.io/autogen/docs/Contribute#documentation to build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes introduced in this PR.
- [ ] I've made sure all auto checks have passed.
Thanks for the fix! Any way to add a test to "replicate" the error you saw with Kubernetes? Even a mock is good enough
Thanks for the fix! Any way to add a test to "replicate" the error you saw with Kubernetes? Even a mock is good enough
Thanks! In regards to testing, I think JupyterClient unit tests would be the easiest approach, though I don't see any explicit tests for that class. We could mock the Jupyter gateway server response to include the set-cookie headers and make sure the WS use them. The problem stated more broadly is about sessions, not specifically Kubernetes. There could be other situations, e.g. auth, where the current implementation would cause problems as well.