SIGN IN SIGN UP

fix(middleware): avoid event-loop blocking in WorkspaceContextMiddleware onSystemPrompt (#2632)

# Background

`WorkspaceContextMiddleware.onSystemPrompt()` assembled workspace
context synchronously on the caller thread #2578. In WebFlux
deployments, that caller can be a Netty event-loop thread.
This PR fixes the issue by moving that workspace context assembly work
off the caller thread.
Other middleware paths are not changed here; they need a separate audit
and shared blocking-boundary policy.

# What's Changed

- Deferred workspace context assembly with `Mono.fromCallable(...)`.
- Scheduled the blocking assembly work on `Schedulers.boundedElastic()`.
- Added a regression test that verifies workspace context reads do not
run on the caller thread.

---------

Co-authored-by: Joe Zou <yixian.zou@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
R
Rudy Steiner committed
40e77c08c64c3db0ef31ebf9bcf37ff91b62c384
Parent: e728e7b
Committed by GitHub <noreply@github.com> on 8/12/2026, 3:19:16 PM