Commit 8d9bc95
fix(slackbot): create MCP server per agent run to avoid cancel scope error (#1289)
The module-level MCPServerStreamableHTTP singleton was shared across
concurrent asyncio.create_task handlers. streamablehttp_client uses
anyio.create_task_group() internally, binding a cancel scope to the
entering task. When the last handler to exit was a different task than
the one that opened the connection, anyio raised "Attempted to exit
cancel scope in a different task than it was entered in".
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 377d08d commit 8d9bc95
1 file changed
Lines changed: 3 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | 50 | | |
55 | 51 | | |
56 | 52 | | |
| |||
178 | 174 | | |
179 | 175 | | |
180 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
181 | 180 | | |
182 | 181 | | |
183 | 182 | | |
| |||
0 commit comments