Skip to content

feat(v3-dev): 完善对话执行、诊断上报与联网搜索 - #264

Merged
MiaowFISH merged 15 commits into
YesWeAreBot:v3-devfrom
xhcz:feat/v3-dev-model-prompt-diagnostics
Nov 26, 2026
Merged

MiaowFISH merged 15 commits into
YesWeAreBot:v3-devfrom
xhcz:feat/v3-dev-model-prompt-diagnostics

Conversation

@xhcz

@xhcz xhcz commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

修复了一些已知问题,完善对话执行、上下文维护、日志诊断和联网搜索。

  • 修复模型响应异常结束时仍可能执行工具、流式工具调用误超时,以及部分模型格式纠错未实际重试的问题。
  • 完善动作参数校验和回复结果记录,区分主动沉默、合法空发送、失败、取消及部分送达。
  • 完善提示词渲染与多模态上下文处理,支持在 System 模板中使用当前模型和模型组信息。发生模型切换时,模板使用实际选中的模型。
  • 扩展联网搜索,支持配置并组合启用多个搜索引擎,完善搜索用量统计、超时和失败回执。
  • 支持维护和主动回读 OneBot 对话历史,补充消息来源标记,并返回框架指令的执行结果。
  • 完善历史清理与记忆任务取消,清理相关工具输出和模型请求快照,阻止过期结果写回。
  • 完善日志与错误上报。Koishi 详细 DEBUG 折叠请求正文并展开模型响应,错误报告支持从 lite 到 full-all 的五档内容和身份脱敏。
  • 重新整理 Koishi 配置页,将相关设置归入对应功能分组。

@coderabbitai

coderabbitai Bot commented Nov 22, 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: df26c988-ed2f-4dd3-8eb0-1d16adde07db

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 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T11:02:27.785507Z 49ae347 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: 8a0f4fb816

ℹ️ 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".

Comment on lines +90 to +91
const floor = Math.floor(Date.now() / 1000) * 1000;
this.targets.set(key, { session, channelId, floor, generation: this.world.l2_manager.getHistoryGeneration({ platform: "onebot", channelId }) });

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 Honor the reset cutoff when registering a new backfill target

If an all-history reset completes before this chat is first observed, and both occur in the same second as pre-reset messages, this initializes the target to the current generation while rounding its cutoff down. syncPage() consequently skips its generation-change safeguard and accepts those pre-reset rows through row.time * 1000 >= target.floor; recordMessage() then writes deleted messages back into history under the new generation. Preserve the reset cutoff for newly observed targets, or conservatively exclude the ambiguous second.

Useful? React with 👍 / 👎.

signal?.throwIfAborted();
let url: string;
try {
url = normalizeUrl(value);

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 significant URL paths when fetching pages

For a managed fetch_webpage call whose URL has a significant trailing slash, such as a site serving different resources at /docs/ and /docs, normalizeUrl() removes that slash and fetchPage() dispatches the altered URL to every extraction engine. The tool can therefore return a different page or fail for an otherwise valid URL. Keep the validated request URL intact for retrieval rather than reusing the lossy canonicalization intended for deduplication.

Useful? React with 👍 / 👎.

@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: 5b9ac06bad

ℹ️ 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".

Comment on lines +305 to +306
const renderModel = await this.promptService.prepareModelSystem?.(view);
const baseSystem = renderModel ? renderModel() : await this.promptService.render("agent.system", view);

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 Include model-dependent System content in packing estimates

When a custom System template contains a sizeable {{#model}} block or expands model.group.models, calling renderModel() without a model omits that content from every packWorldState estimate. RequestExecutor.execute() later inserts the fully rendered System prompt without repacking the world state, so the request can exceed contextInputBudgetTokens and fail with ContextBudgetError even when evicting old history would make it fit. Include the model-dependent content, or a conservative bound for it, in the packing estimate.

Useful? React with 👍 / 👎.

await this.service.observeChannel(session);
this.logger.debug(`记录机器人消息 | 频道: ${conversationCid(session)} | 消息ID: ${session.messageId}`);

const origin = operator ? "operator" : session.scope?.startsWith("commands.") ? "framework" : getModelMessageOrigin();

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 Let confirmed send provenance override self-message echoes

With ignoreSelfMessage false, a OneBot self-message echo arriving before after-send takes the operator path and stores origin: "operator". The later confirmed send has the same message ID and is discarded by InteractionManager.recordMessage() as a duplicate, so even a send wrapped in withModelMessageOrigin() remains permanently attributed to an operator and is presented to subsequent model calls as 〔人工操作〕. Allow confirmed send receipts to enrich an existing row's provenance, or defer operator attribution until this distinction is known.

Useful? React with 👍 / 👎.

@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: 49ae347b57

ℹ️ 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".

Comment on lines +125 to +128
if (shouldCaptureReportConversation(this.config)) {
try {
const snapshot = context.conversation ?? this.captureConversation?.();
secrets = conversationReportSecrets([snapshot, context.error, context.additionalInfo], secrets);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Collect credentials independently of conversation capture

With level: "low", a credential carried in error.context or additionalInfo and repeated verbatim in an error message or stack can be uploaded in full. For example, a context.cookie value repeated in a cause message is redacted by the legacy detailed reporter but leaks through the new low-level reporter. This gate skips conversationReportSecrets() for low, and formatLeveledDump() does not perform the legacy sanitizer's structured-credential discovery, so only the structured field is redacted, not its bare copies. Collect diagnostic credentials before applying the conversation-capture gate.

Useful? React with 👍 / 👎.

Comment on lines +164 to +166
if (target.generation !== generation) {
target.generation = generation;
target.floor = (Math.floor(Date.now() / 1000) + 1) * 1000;

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 Anchor the backfill cutoff to the clear time

For an already observed chat, the first refresh after a history clear moves the cutoff to the refresh time rather than the clear time. Consequently, every missed message between those events is permanently excluded from backfill. A clear at 110 seconds followed by a refresh at 160 seconds sets the floor to 161 seconds, so a legitimate post-clear message from 120 seconds is skipped by this and all subsequent reads. Capture the cutoff when history is invalidated and reuse it here, rounding only the ambiguous reset second.

Useful? React with 👍 / 👎.

Comment on lines +78 to +80
merged.set(url, {
title: hit.title.trim() || url,
url,

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 Keep search-result URLs separate from deduplication keys

When an engine returns a slash-sensitive URL such as https://host/docs/, this stores the slash-stripped deduplication key in the result instead of retaining the original link. The still-affected path is SearchService.search(), which calls mergeHits() for each engine and again for the final result; a subsequent fetch_webpage therefore requests /docs, even though direct-fetch validation now preserves slashes. This can retrieve a different resource or fail for a valid search result. Keep the validated retrieval URL in the hit and use the normalized value only for indexing.

Useful? React with 👍 / 👎.

@MiaowFISH
MiaowFISH merged commit 2b51495 into YesWeAreBot:v3-dev Nov 26, 2026
3 checks passed
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