Skip to content

feat(prompt): distinguish a replayed lesson from a compacted one (#998) - #1021

Closed
Thatgfsj wants to merge 2 commits into
card/d3-full-publicationfrom
card/p7-teaching-dedupe
Closed

Thatgfsj wants to merge 2 commits into
card/d3-full-publicationfrom
card/p7-teaching-dedupe

Conversation

@Thatgfsj

Copy link
Copy Markdown
Collaborator

关联

Refs #998(P7:区分恢复后的重复教学与压缩后的漏教)。工作流 #978,总索引 #1000。
与既有 PR #1008(修原讨论 #929)的集成顺序见下。

改前 / 改后

  • 改前:恢复一个带教学的会话时会再灌一遍整课(重复教学);上下文压缩把教学移走后不再补任何提示(漏教)。
  • 改后:教学状态按「同一 revision 是否仍可见」判定——恢复会话重放同一课但新增 0 条;压缩移除后只发一条短提醒;被撤回的批次不消耗教学机会。

改动

  • src/prompt-injection/index.ts、src/prompt-injection/types.ts:新增 teachingState / teachingContribution(读 deriveMessages + replaceGeneration)
  • src/publication/ptc.ts:batching provider 改用该状态
  • src/adapter/dsh/types.ts:类型补充
  • 测试:test/prompt-injection.test.mjs(复现 + 三条验收断言)、test/resident-switch.test.mjs
  • docs/CHANGELOG.md:Unreleased 条目

验证

npm run build    # 通过
node test/run.mjs prompt-injection   # 2 suites passed
node test/run.mjs resident-switch    # 通过
node test/run.mjs batching           # 4 suites passed
npm run check:size                   # 825 files, all <= 1000 lines

撤回本次 src 改动后重建:prompt-injection 相关断言转红(复现用例与三条验收全部失败)。

集成顺序(重要)

PR #1008 把一次性教学改到工具结果的 additionalContexts(ephemeral 通道)。本 PR 的判定依赖教学进入消息历史;若 #1008 先合,本 PR 需 rebase 到 ephemeral 通道再验证持久投递。建议 #1008 先合,两 PR 不同时合。

@Thatgfsj

Copy link
Copy Markdown
Collaborator Author

Superseded by #1033:18 张 OPS-PTC 卡的实现已随统一 PR 合入 main(本 PR 的提交已在 main 中),保留为评审记录。

P7 的 step-tail 通道按 #929 改为 ephemeral additionalContexts 后由 #1033 交付,原 provider/压缩短提醒未保留。

@Thatgfsj Thatgfsj closed this Nov 20, 2026
@Thatgfsj
Thatgfsj deleted the card/p7-teaching-dedupe branch November 20, 2026 15:46
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