Skip to content

fix(crates/panache-mcp): 已给正文时直接建稿,续改时找回原稿 - #67

Merged
SXP-Simon merged 2 commits into
mainfrom
fix/mcp-new-text-or-saved-draft
Nov 27, 2026
Merged

SXP-Simon merged 2 commits into
mainfrom
fix/mcp-new-text-or-saved-draft

Conversation

@SXP-Simon

@SXP-Simon SXP-Simon commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

用户碰到了什么

用户说「帮我把下面的作业写好,先看第一页。第一题:循环从 i = 1 开始,直到 i = 10 结束。」Luna 把“第一页”理解成已有作业的第一页,于是查找本地旧稿。查空后它让用户补照片;有其他作业时,它有时打开了不相关稿件的预览。#66 的默认作业字体要在建稿时才生效,这次问题发生得更早。

改动

调整 MCP 启动说明,以及 save_section、list_drafts 的工具说明。用户在聊天里贴了新题目或正文并要求查看第一页时,先建稿,再按返回的稿件编号预览。用户明确要找回或继续编辑已存稿件时,使用旧稿入口。只改一个 Rust 文件,没有增加工具或参数。

真实 Luna 对照

Windows,真实 stdio MCP、gpt-6-luna、低推理强度。基线是合并 #66 后的 main@a3928c0。每格三次独立会话,完整转发启动说明,用户正文和模型配置相同。两份预置稿为《实验作业》和《周会通知》,每次从同一初始数据库的副本开始。

场景 main 第一版通用英文说明 最终草稿
用户给出上面的原话,稿库为空,直接建稿并预览 0/3 0/3 3/3
同一句原话,库里有其他稿,直接生成新稿并预览 0/3 1/3 3/3
「继续改上次那份《实验作业》」,找到原稿、改对并预览 3/3 3/3 3/3

新建验收核对了第一步是否调用 save_section、只有一个新增编号、已存稿无变化,以及返回的第一页图片是否属于新稿。续改验收核对原编号、温度从 18 度改为 21 度、同页的日期仍为周三、另一份稿件完整保留,以及预览对应修改后版本。单独看到“调用了预览”不算通过:第一版曾成功预览无关旧稿,计为失败。

第一轮在握手开头和两个工具描述里加入了中文引导。与第一版英文同时有位置和含义的差异,这组结果不足以归因于语言。

等义英文复验(5d3ea00)。 保持提示位置、用途和模型配置相同,另开独立会话对照中文候选和当前全英文新增说明。用户始终用同一句中文提问。中文候选和等义英文在空库建稿各 3/3、有无关旧稿时新建各 3/3、续改原稿各 3/3。英文另测省略启动说明的三种情况 6/6,以及换一种中文说法新建 2/2。最终提交将本 PR 新增的三处说明统一为英文。此批小样本没有观察到需要混用两种语言的收益。

补充验证与边界

  • 只给工具目录、省略启动说明重测上述三种情况,每种各 2 次,最终版 6/6 通过。再将新稿请求换成「作业正文给你:温度从 10 ℃ 升至 15 ℃。排成手写稿,第一页给我瞧瞧。」,有旧稿时 2/2 直接建稿并预览。
  • 从首次提交构建并读取真实握手及 14 个工具的完整目录,与行为实验使用的最终候选一致。格式、20 项 MCP 单元测试、Clippy 通过;与 feat(crates/panache-mcp): 按用户用途展示小样并沿用选中的版本 #56 本地试合无文本冲突。
  • 这些结果只覆盖本次 Luna、小样本中文请求。工具说明影响的是模型的选择,服务端仍允许调用者按需查稿。

Summary by Sourcery

Ensure new writing requests create the intended draft before its first page is previewed, while preserving explicit saved-draft continuation behavior.

Bug Fixes:

  • Clarify draft selection so requests containing new text or problems create and preview a new draft instead of opening an unrelated saved draft.

Enhancements:

  • Align MCP startup and tool guidance so saved drafts are searched only when users explicitly request continuation or recovery of earlier work.

背景:用户给了新作业正文并想看第一页时,模型可能先去翻旧稿,找不到便要求补传纸张。

解决手段:在启动说明和建稿、查稿两个工具入口说明如何从当前正文开始,以及何时应找回之前的稿件。

收益:新作业可以直接建稿并预览第一页,续改时仍能找回对应的旧稿。
@sourcery-ai

sourcery-ai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

API

Clarify that newly supplied content should be saved before previewing, while lookup is reserved for requests to find or resume an existing draft.

  • crates/panache-mcp/src/main.rs L280-449 (5 small edits)

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

背景:新增分流说明使用了中文整句,与现有英文工具描述不一致,原实验也未单独控制语言。

解决手段:在相同位置使用等义英文说明,并用相同中文请求对照两种版本。

收益:保持工具说明语言一致,同时保留按请求区分新建和续改的行为。
@SXP-Simon
SXP-Simon marked this pull request as ready for review November 27, 2026 07:27
@sourcery-ai

sourcery-ai Bot commented Nov 27, 2026

Copy link
Copy Markdown

Sorry @SXP-Simon, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 days and 21 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@SXP-Simon
SXP-Simon merged commit f561ce7 into main Nov 27, 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.

1 participant