bito-code-review[bot] commented on PR #42767:
URL: https://github.com/apache/superset/pull/42767#issuecomment-5186165744
<!-- Bito Reply -->
The flagged issue is correct. Because `_mcp_user_id_var` is a `ContextVar`,
it persists across the lifecycle of an asyncio task even after the Flask app
context is popped. If not explicitly cleared, subsequent calls in the same task
can inherit the user ID from a previous, authenticated call.
To resolve this, you should ensure the `ContextVar` is reset in the
`finally` block of the middleware methods. Here is the recommended fix for
`superset/mcp_service/middleware.py`:
```python
finally:
# ... existing logic ...
_mcp_user_id_var.set(None) # Reset after logging
```
I have checked the PR comments, and there are no other actionable
suggestions to address. Would you like me to proceed with any other changes?
**superset/mcp_service/middleware.py**
```
finally:
# ... existing logic ...
_mcp_user_id_var.set(None)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]