Repository navigation
Description
OpenAIChatModel formats every request through the two-arg production path:
List<OpenAIMessage> openaiMessages = formatter.format(messages, effectiveOptions);AbstractBaseFormatter.format(List<Msg>, GenerateOptions) dispatches to doFormat(msgs, options). The deprecated aliases in io.agentscope.extensions.model.openai.formatter only override the one-arg doFormat(List<Msg>), so the production two-arg path falls through to OpenAIChatFormatter and silently skips every provider fix:
formatter.DeepSeekFormatter/formatter.DeepSeekMultiAgentFormatter: the legacyname-field removal and thereasoning_contentpreservation/backfill never run → the old endpoint rejectsnamewith HTTP 400, and thinking-mode requests fail withThe reasoning_content in the thinking mode must be passed back to the APIfor any assistant turn lackingreasoning_content(e.g. framework-synthesized subagent completion notifications whose content is only aHintBlock).formatter.GLMFormatter/formatter.GLMMultiAgentFormatter:ensureUserMessagenever runs → requests without a user message hit GLM error 1214.
PR #3272 fixed exactly this class of bug for the compat formatters, and its commit message states the deprecated formatters were included:
"applyDeepSeekFixes never strips reasoning_content and backfills an empty string for assistant messages that lack it, in both the compat and the deprecated DeepSeekFormatter and DeepSeekMultiAgentFormatter; both formatters now override the two-arg doFormat(List, GenerateOptions) production path."
"the deprecated formatter additionally keeps its legacy name-field removal."
However, the merged diff of #3272 only touches the compat.deepseek / compat.glm classes — the four deprecated classes in formatter were not modified, so the described behavior does not match the code. This issue is about closing that gap.
To Reproduce
// io.agentscope.extensions.model.openai.formatter.DeepSeekFormatter (deprecated alias)
DeepSeekFormatter formatter = new DeepSeekFormatter();
// Framework notification: assistant message whose content is only a HintBlock,
// as synthesized by InboxMiddleware for subagent completion.
List<Msg> msgs = List.of(
Msg.builder().role(MsgRole.USER)
.content(List.of(TextBlock.builder().text("spawn two tasks").build())).build(),
Msg.builder().role(MsgRole.ASSISTANT)
.content(List.of(new HintBlock("hint-1", "Background task completed"))).build());
// Production path used by OpenAIChatModel:
List<OpenAIMessage> out = formatter.format(msgs, (GenerateOptions) null);
// out.get(1): role=assistant, reasoningContent == null -> DeepSeek thinking mode HTTP 400
// One-arg formatter.format(msgs) has the same gap for reasoning backfill;
// additionally, msg name fields are only stripped on the one-arg path.Expected behavior
Both format(msgs) and format(msgs, options) go through the same provider fixes on the deprecated aliases, matching the compat formatters after #3272 and matching the behavior described in #3272's commit message: names removed, reasoning_content preserved and backfilled with an empty string when missing (DeepSeek); at least one user message guaranteed (GLM).
Error messages
HTTP 400: The `reasoning_content` in the thinking mode must be passed back to the API.
HTTP 400 (old endpoint): ... name field not supported ...
GLM error 1214: ...
Environment
- AgentScope-Java Version: 2.1.0-BETA1 (also reproducible on current
main) - Java Version: 17+
- OS: any (Windows / Linux)
Additional context
Verified on the v2.1.0-BETA1 tag with 4 JUnit cases:
- compat
DeepSeekFormattertwo-arg path backfillsreasoning_content=""for a pure-hint assistant (fixed by fix(deepseek): pass reasoning_content back for all assistant turns #3272) — passes. - deprecated
formatter.DeepSeekFormattertwo-arg path leaves the same message withoutreasoning_content— bug reproduced. - deprecated
formatter.DeepSeekFormattertwo-arg path keeps thenamefield — bug reproduced. - deprecated
formatter.DeepSeekFormatterone-arg path stripsname— confirms the gap is specific to the two-arg entry.
We have a fix + regression tests ready (adds the two-arg doFormat override to the four deprecated classes and aligns the legacy DeepSeek fixes with the #3272 semantics while keeping the legacy name removal) and are happy to open a PR referencing this issue.
Activity
jujn commentedon Oct 14, 2026
直接用新的不好吗?不打算修了,也许某天哪个版本直接移除了
zzz-ghost commentedon Oct 14, 2026
了解,那我们项目侧就切到新的 compat formatter 了,等 2.1.0 正式版发布就升级迁移。旧别名未来如果移除也合理,省得两套行为不一致。感谢回复!