Repository navigation
fix(memory): stop dropping end-topic turns that carry feedback from L1 - #548
Conversation
…mand
A turn routed as end_topic used to be dropped from L1 capture as a whole,
so feedback, work conventions and instructions sent together with the
closing words never reached L1, user memory or the episode reward.
Only a bare end-topic command ("结束会话" / "不聊了") is still kept out of
L1. Every other end_topic turn now goes through the same capture decision
as a normal turn; the closed episode waits for that decision before
reflection and reward are queued.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
Reviewed changes and tests support the intended behavior with no unresolved blocking issues.
Review effort: Lite
Findings: None
What changed in this PR
Fixes end_topic handling so feedback-bearing closing turns can be captured for L1, user memory, and rewards while standalone closing commands remain excluded.
Changes:
- Narrows filtering to standalone end-session commands.
- Defers reward processing until capture decisions complete.
- Adds regression coverage for mixed feedback and closing turns.
| File | Description |
|---|---|
Memory/tests/service/session/episode-relation.test.ts |
Adds and updates capture and reward regression tests. |
Memory/src/service/session/session-turn-service.ts |
Refines end-topic filtering and capture behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@origami-chen 麻烦审核一下这个 PR:修复模型判为 end_topic 的回合整轮不进 L1 的问题,只保留对"结束会话""不聊了"这类纯结束口令的排除,细节见 PR 描述。 另外,这个 PR 从 fork 提交, |
| const { db, service } = createTestService({ | ||
| llm: createEndTopicCaptureLlm(calls, END_TOPIC_CONVENTION, { | ||
| l1: { | ||
| summary: END_TOPIC_CONVENTION, |
There was a problem hiding this comment.
这里缺一个非空的title,会导致单测失败
There was a problem hiding this comment.
@origami-chen 已修复。v1.2.2 的捕获判定要求 l1 同时带非空的 title 和 summary,这个用例的桩数据只给了 summary,判定抛错,结束轮的 L1 停在 resolving。已在这里补上 title(0aa4be29)。
同时把 PR 的目标分支 v1.2.2 合进了任务分支(d8c1b218,无冲突),PR 的改动仍然只有这两个文件。
验证:合入 v1.2.2 后先复现了失败(expected { status: 'resolving' } to deeply equal { status: 'activated' });补上 title 后,episode-relation 的 21 个用例全部通过,npm run memory:test(1092 个用例)、npm run lint、npm run typecheck 均通过。麻烦再看一下。
v1.2.2 requires the turn capture decision to return a non-empty l1.title together with l1.summary. The mixed feedback-and-closing test stub only returned a summary, so the capture decision threw and the closing L1 stayed in resolving instead of being activated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
任务与行为
修改范围
Memory/src/service/session/session-turn-service.ts:captureEpisodeIncrementalSteps的过滤条件从"任何 end_topic 回合"改为"纯结束口令"。rawTurnIsExcludedFromL1去掉重复的 end_topic 判断:没配模型时,end_topic 只可能来自结束口令,这类回合在前一步已经排除。Memory/tests/service/session/episode-relation.test.ts:新增混合消息用例,验证 L1、用户记忆和奖励目标都落在这一轮。原来断言"LLM 判定的 end_topic 不捕获"的用例改为:交给捕获判定后,只有收尾语的回合被拒,奖励目标退回上一轮。验证证据
fix-end-topic-l1-capture,起点d101fd58(即当前memmy_1031/v1.2.0),提交4f4e110c。提 PR 前已 fetch 并 merge 集成分支(Already up to date)。l1MemoryIds为空),修改后通过。npm run memory:test:105 个测试文件通过,1 个跳过(仅在 Windows 上运行的安装器集成测试);920 个用例通过。npm run lint、npm run typecheck通过。git diff --check upstream/memmy_1031/v1.2.0...HEAD无输出;交付差异只含上面两个文件。已知限制
🤖 Generated with Claude Code