Skip to content

fix(v3-dev): 完善原生工具调用纠错与错误诊断 - #260

Closed
xhcz wants to merge 2 commits into
YesWeAreBot:v3-devfrom
xhcz:fix/native-tool-recovery-20261101
Closed

xhcz wants to merge 2 commits into
YesWeAreBot:v3-devfrom
xhcz:fix/native-tool-recovery-20261101

Conversation

@xhcz

@xhcz xhcz commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

修复原生工具调用异常导致回复中断,以及错误诊断信息缺失的问题

工具调用

  • 参数缺失或输出格式异常时,默认最多追加一次模型纠正请求,可自定义次数,0 关闭自动纠正
  • 完整校验整批调用后再执行,避免部分执行后重试造成重复操作
  • 保留思考内容与工具调用标识,完善纠正请求的上下文续接

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1e244bc8-019e-4e97-ac48-6b0a28276de5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-09T17:17:51.043058Z
We couldn’t complete this review. Comment @codex review to try again.
bb5a0cc New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 96a1505048

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

const correctionRetries = Number.isSafeInteger(configuredRetries) && configuredRetries >= 0 ? configuredRetries : 1;
for (let attempt = 0; attempt <= correctionRetries; attempt++) {
assertReplyTurn();
const response = await this.modelSwitcher.chat({

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Surface SDK argument failures to the correction loop

For streamed native calls with malformed function.arguments, xsai parses the arguments before invoking the no-op tool, so ChatModel.chat() rejects rather than returning toolCalls; the existing truncated-argument test in chat-stream-errors.spec.ts already exercises this behavior. That rejection escapes this await, and the newly added invalid_argument_json feedback path is never reached. Once ordinary model retries are exhausted, the turn still stops regardless of nativeToolCorrectionRetries. Surface the raw, unexecuted calls as a recoverable validation result, and cover this through ChatModel rather than only a mocked switcher.

Useful? React with 👍 / 👎.

Comment on lines +586 to +588
JSON.parse(response.text!);
} catch {
toolMarkup = true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve literal tool tags in fenced legacy JSON

If a legacy response is fenced JSON and contains a literal <tool_call> inside a quoted message, this strict parse fails because of the fences and incorrectly classifies the response as tool markup. parseAndValidateResponse uses JsonParser, which accepts fenced JSON, so an otherwise valid legacy/fallback reply that previously worked is now retried or fails with native_tool_call_missing instead of being sent. Apply the same JSON normalization before classifying markup, or distinguish tags outside JSON string fields.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

MiaowFISH pushed a commit that referenced this pull request Nov 14, 2026
整合 #253、#255、#257、#258、#259、#260、#261,保留续接与消息送达保护。

修正消息消费凭据、首次启动唤醒、触发来源恢复、图片范围与预设输出协议;隔离动态模板数据;补齐人物快照失效、日程授权与实例范围;统一工具授权、超时、参数描述及后台结果检查;修复模型超时、原生工具纠错与用量结算;将 Python 执行移至独立 Linux 沙箱。

Co-authored-by: Codex <codex@openai.com>
@MiaowFISH MiaowFISH closed this Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants