spring-ai icon indicating copy to clipboard operation
spring-ai copied to clipboard

Stale FIXME markers in pre-3.0.0 internal tool execution paths — keep, normalize, or let 3.0.0 removal handle it?

Open stohirov opened this issue 6 months ago • 5 comments

Summary

Six chat models carry an identical // FIXME: bounded elastic needs to be used since tool calling is currently only synchronous comment above the internal tool-execution Flux. The underlying limitation (synchronous-only tool calling) is unchanged, but the project has since adopted boundedElastic as the canonical dispatch pattern in ToolCallAdvisor, and the FIXME-tagged paths are themselves slated for removal in 3.0.0. This leaves the FIXME markers in an awkward middle state — worth a brief team decision.

Where the FIXMEs live (main)

File Line
models/spring-ai-minimax/.../MiniMaxChatModel.java 394
models/spring-ai-deepseek/.../DeepSeekChatModel.java 304
models/spring-ai-google-genai/.../GoogleGenAiChatModel.java 561
models/spring-ai-ollama/.../OllamaChatModel.java 394
models/spring-ai-mistral-ai/.../MistralAiChatModel.java 331
models/spring-ai-bedrock-converse/.../BedrockProxyChatModel.java 826

All six sit directly above:

return Flux.deferContextual(ctx -> {
    // ... tool execution ...
}).subscribeOn(Schedulers.boundedElastic());

…and all six are inside a code path that already prints: "Internal tool execution in XChatModel is deprecated since 2.0.0 and will be removed in 3.0.0. Use ChatClient with ToolCallAdvisor instead."

Verification findings

Origin of the FIXME. Added in commit 28bceb3ac ("Prevent blocking event loop calling tools", Mar 2025) alongside the boundedElastic workaround across 10 chat models. The commit message explains: "due to the fact that currently tools can only be synchronous and blocking, every tool call needs to be offloaded to a blocking-safe Scheduler." It "Resolves #2341" (MCP Async Blocking Error — closed/completed). The FIXME was added simultaneously with the fix as forward-looking text, not as a marker of an open follow-up.

Underlying limitation is unchanged. ToolCallingManager.executeToolCalls(...) (spring-ai-model/.../ToolCallingManager.java:41) still returns ToolExecutionResult synchronously, not Mono. The boundedElastic dispatch is still a workaround for that, not a resolution of it.

The "canonical" newer models tell a mixed story.

  • ToolCallAdvisor.java:322 (the 3.0.0 replacement) uses a descriptive comment with no FIXME: // Execute tool calls on bounded elastic scheduler (tool execution is blocking). Added in 19c606adb ("Add streaming support to ToolCallAdvisor").
  • OpenAiChatModel.java:477 has no comment at all above its subscribeOn(Schedulers.boundedElastic()). Its FIXME disappeared as a side-effect of 75fa84486 (SDK migration rewrite), not as a deliberate "FIXME no longer needed" cleanup.
  • AnthropicChatModel.java:359 has a short inline descriptive comment (// Run blocking tool execution on a different thread). Its FIXME also disappeared as a side-effect of b0ce25aed (Anthropic SDK rewrite).

So the picture is: the project has de facto dropped the FIXME marker — but the underlying concern (sync-only tool calling) it was flagging is genuinely still open, just no longer being signposted in code.

The honest part

The FIXMEs are not stale in the strict sense — they document a real limitation (synchronous tool calling) that the codebase has not actually resolved. What changed is the project's posture toward that limitation: ToolCallAdvisor (the 3.0.0 path) treats boundedElastic dispatch as the established pattern rather than a workaround to revisit, and OpenAi/Anthropic dropped their FIXMEs incidentally during SDK rewrites.

So this is a downgrade of the concern, not a resolution. The six remaining FIXMEs are the last surviving signposts of an architectural question that the new tool-calling path has effectively decided to live with rather than fix.

The question

Since these paths are scheduled for removal in 3.0.0, is it worth normalizing the comments to match ToolCallAdvisor's pattern, or should we leave them as-is and let the 3.0.0 removal handle it? Happy to PR either direction (or close this issue) based on team preference.

stohirov avatar May 20 '26 14:05 stohirov

@stohirov As shared in https://github.com/spring-projects/spring-ai/pull/6084#issuecomment-4498795784, we really don't need new mostly AI generated issues or PR with little added value, so I will close the issue.

sdeleuze avatar May 20 '26 15:05 sdeleuze

@sdeleuze I am sorry for that but I just wanted to share more details using AI, not the PR itself. I just happened to find out this closed PR: https://github.com/spring-projects/spring-ai/pull/5198 without any explanations or so and that's why I tried to make this issue more detailed to get info about it. I am really open to contribute in either direction.

stohirov avatar May 20 '26 16:05 stohirov

@stohirov Thanks for the additional context.

@chemicL Could you please provide guidance on what should be done about those FIXME markers that I think you introduced?

sdeleuze avatar May 20 '26 16:05 sdeleuze

The markers were introduced for a valid reason and unless something has changed still need addressing. Assuming a different mechanism - either centralized via ToolCallAdvisor - or a solution that actually makes non-blocking tool calling possible, the comments can then be removed. Is there a point in having an issue about these comments? We probably have actual issues about proper streaming support already.

chemicL avatar May 25 '26 08:05 chemicL

Ok let's close this issue then.

sdeleuze avatar Jun 04 '26 11:06 sdeleuze