Skip to content

fix: 跨账号去重本地 Agent 会话记忆 - #609

Closed
Orsted290 wants to merge 36 commits into
MemTensor:v1.2.3from
Orsted290:fix-agent-source-account-dedup
Closed

Orsted290 wants to merge 36 commits into
MemTensor:v1.2.3from
Orsted290:fix-agent-source-account-dedup

Conversation

@Orsted290

Copy link
Copy Markdown
Contributor

问题定位

同一段 Codex 或 Claude Code 对话可以经由 Agent Hook 和桌面扫描两条路径写入 Memmy。Hook 使用安装时保存的账号 ID,桌面扫描使用当前登录账号 ID。原有 source-turn 去重和会话查找将账号 ID 纳入匹配范围,导致账号不同时无法识别同一来源会话,重复创建 Session、Episode 和 L1 记忆。

修改内容

  • source-turn 去重改为基于本地来源、配置命名空间、会话 ID 和轮次识别,不再因云账号 ID 不同而重复捕获。
  • 同一来源会话的新回合复用已有 Session,并沿用其账号归属,避免切换账号后拆分出重复会话。
  • 增加跨账号、重复提交及会话复用的回归测试。

测试结果

  • npm run lint、npm run typecheck:通过。
  • Memory 测试:1111 通过,1 跳过。
  • 本地打包验收中,Hook 先写、扫描先写、并发提交后重试三种顺序均只生成一个 Session、一个 Episode、每轮一条 L1 和一个召回候选。
  • 真实切换账号手动验收:同一 Codex 会话经 Hook 和桌面扫描提交后,库中为 1 个 Session、1 个 Episode;两轮各有 1 条已激活的 L1,重复扫描未新增副本;真实召回中该轮仅出现 1 个候选。

验收范围

本 PR 解决跨账号采集导致的重复记忆。已有会话保留原账号归属;本次不迁移历史数据或改变账号归属策略。

Anson-Se and others added 30 commits September 26, 2026 13:17
…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>
Preserve complete extraction for PDF and Office documents and return bounded chunks with continuation offsets. Select PDF pages before pagination and keep continuation hints within the tool result budget.

Add regression fixtures, runtime recovery checks, reproducible benchmarks, and isolated account-model review scripts. Record 140 passing tests, typecheck results, and three successful live synthetic scenarios. Leave plain-text pagination and extraction caching outside this change.
A trailing newline was shown as an extra blank line, so patches against one-line memory files failed to match.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the long-document fix limited to the runtime change and its tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
Every memmy-memory run reports memmy_cli_* events to the cloud analytics
endpoint. resolveCommandIdentity took the second positional word as
command_action unconditionally, which was meant for subcommands such as
`session close`. For search, add, get and delete that word is the search
query, the memory text or the memory id, so it was sent verbatim. An
unrecognized first word was also sent verbatim as command_group.

command_action is now reported only when the first word is a group with
subcommands (service, session, turn, raw) and the second word is one of
that group's known subcommands; raw methods match case-insensitively, as
runRaw does. An unrecognized first word is reported as command_group
"unknown". The known commands live in a small table in analytics.ts that
mirrors runCommand and mapTopLevelCommand. has_session_id and has_turn_id
are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The session close route only woke the auto worker when the close result
listed closed episodes, jobs, or scheduled evolution. For an L3 World
Model v2 session, closeSession also freezes the pending L3 evidence
batches and queues l3_world_model_update jobs, but it does not return
them. When the session's episode had already closed earlier (idle
timeout or end_topic), closedEpisodeIds was empty and nothing woke the
worker. The worker does not poll, so the new L3 jobs stayed queued until
an unrelated request happened to wake it.

The close route now always schedules the worker, as the token compaction
boundary already does after freezing batches. A close with no follow-up
work costs one empty drain. A new REST contract test closes an L3 v2
session whose episode had already ended and checks that the worker picks
up the frozen L3 job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Synchronize the main branch code to the v1.2.0 branch
App updates left previously installed Cursor, Claude Code, and Codex hooks on the first-install script. Startup now compares the stored hook fingerprint and reinstalls when it is missing or stale.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the hook revision test beside the Cursor resume test renamed on v1.2.1.

Co-authored-by: Cursor <cursoragent@cursor.com>
DeepSeek Harness no longer accepts a generic plugin message source, and completed assistant turns are recorded as assistant/message.

Co-authored-by: Cursor <cursoragent@cursor.com>
DeepSeek Harness rejects official model requests when an enabled plugin manifest has no version.

Co-authored-by: Cursor <cursoragent@cursor.com>
fix(dsh): restore Memmy plugin activation across supported DSH tags
fix: remove legacy memory embedding config
A stored fingerprint no longer counts as current unless the on-disk script and bridge match it, and the fingerprint is recorded only after the rest of the install succeeds.

Co-authored-by: Cursor <cursoragent@cursor.com>
Send account identity with plugin and scan events, and coerce boolean params so GA4 keeps the events.
fix(analytics): report each newly stored memory once
…ding

fix(documents): 支持长文档分段续读
…ry-repair-queue

fix: deprioritize startup summary repairs
…-worker

fix(memory): wake the worker after every session close
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>
…and-action

fix(memory): stop sending CLI arguments as analytics command actions
@Orsted290
Orsted290 changed the base branch from v1.2.2 to v1.2.3 October 12, 2026 07:02
@Orsted290
Orsted290 requested a review from Wang-Daoji as a code owner October 12, 2026 07:02
@Orsted290 Orsted290 closed this Oct 13, 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.

6 participants