Skip to content

fix(persona): 第三方 system 放进第一条 user 的 system-reminder - #728

Closed
dofastted wants to merge 3 commits into
mainfrom
fix/caller-system-reminder
Closed

dofastted wants to merge 3 commits into
mainfrom
fix/caller-system-reminder

Conversation

@dofastted

@dofastted dofastted commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • 第三方调用方的 system 不再进官方 system 数组。原文放到第一条 user 消息开头,只包一层 <system-reminder>。
  • 已经包过的内容和 MANDATORY 行会先拆掉,避免套两层。空的调用方 system 不产生空 reminder。
  • 调用方自己带的 # Environment 仍留在 system,不进 reminder。
  • 默认官方档和完整档的真实 CLI 矩阵已在本机通过:official / official_full × sdk-cli / cli × 空 / 纯文本 / 已包过。该 e2e 依赖本地 main 上尚未推送的链路,没有放进这个 PR。

Test plan

  • node --test test/unit/persona-template.test.mjs:48 pass
  • 合并前仍需 live verify-live.py。本 PR 未部署、未合并。

Note

Medium Risk
Changes outbound request shape for all unofficial traffic with custom system prompts (system block count, cache prefixes, and token-hiding overlays), though behavior is covered by broad unit test updates.

Overview
Third-party system text no longer lands in the fifth official system[] block. With the default four-block layout, outbound system stays length 4 when there is no caller text; caller-supplied # Environment sections still append to system[] unchanged.

Everything else from the caller (plain system strings, including content that was already wrapped) is prepended to the first user message as a single <system-reminder> layer—no extra MANDATORY wrapper on that path. unwrapSystemReminder now peels nested reminders (up to four layers) and strips the MANDATORY constraint line so reminders are not doubled. Empty caller system produces no reminder.

Persona rendering splits caller_system-only template blocks from official blocks (stripping {{caller_system}} from the latter), renders caller parts with renderPersonaTemplate(..., { standing: false }), and wires the new user-prefix behavior in applyCrsUnofficialPersona. Unit tests across persona, cli-hop, and API backend assert the new shape and usage-overlay expectations.

Reviewed by Cursor Bugbot for commit d605605. Configure here.

摘要

  • CHANGELOG「未发布」:补充 fix(persona): 第三方 system 放进第一条 user 的 system-reminder #728 行为说明(第三方/调用方 system 不再进官方 system[] 末段,非 Environment 文本进首条 user 的 <system-reminder> 等)。
  • 单测:对齐 template / official_prompt / zero / OpenAI 转换等路径下 caller 位于首条 user 的断言;system.length 5→4(无 Environment 尾块时);usage 侧 overlay 计数随 caller reminder 调整。

测试

本地 node --test:

  • test/unit/crs-persona.test.mjs
  • test/unit/persona-coverage.mock.test.mjs
  • test/unit/persona-settings-switch.test.mjs
  • test/unit/crs-persona-usage.test.mjs
  • test/unit/cli-hop-body.test.mjs
  • test/unit/api-backend.test.mjs
  • test/unit/crs-clean.test.mjs
  • test/unit/persona-template.test.mjs

(203 + persona-template 相关用例通过;未 rebase main,#727 尚未合入。)

Open in Web Open in Cursor 

官方 system 保持关闭。调用方原文拆出后只包一层 reminder,已有包装和 MANDATORY 行先去掉。调用方自带的 Environment 仍留在 system。
@cursor

cursor Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 31ef0627-2d62-4287-9d81-a95325a938e6)

unwrapSystemReminder 去掉最多四层标签后再去掉约束行,避免提醒里套两层。单测覆盖默认官方档和完整档的空、纯文本、已包过三种输入。
@dofastted

Copy link
Copy Markdown
Owner Author

补上 MANDATORY 行剥离。unwrapSystemReminder 现在去掉最多四层 <system-reminder>,再去掉约束行;这条 reminder 路径直接调用它。

node --test test/unit/persona-template.test.mjs:49 pass。新增断言覆盖 official / official_full × 空 / 纯文本 / 已包过 MANDATORY。已包过的输入在 user 里只有一层 reminder,且不含 MANDATORY 行。

@cursor

cursor Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 9c2330c1-4b5c-4344-8cef-9b6021195715)

补充「未发布」说明第三方 system 进首条 user 的 system-reminder 行为;
将仍期望 official system 末段承载 caller 的断言改为首条 user 或 4 块结构。

Co-authored-by: ted <kuhlmangarry24@gmail.com>
@cursor

cursor Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 20d9554f-b5aa-458d-91a2-dee1a5aca41d)

@dofastted

Copy link
Copy Markdown
Owner Author

关闭:第三方 system 包成 放进第一条 user、解包时去掉已有 MANDATORY 行,这两点已随 #730 在 main 实现(persona-template.mjs 的 caller_system 块、crs-persona.mjs 的 MANDATORY_CONSTRAINT_LINE)。本 PR 的实现与 main 冲突,不再单独合并。

@dofastted dofastted closed this Oct 26, 2026
@dofastted dofastted mentioned this pull request Oct 26, 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