Conversation
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>
Contributor
Author
|
@origami-chen 麻烦审核一下这个 PR:修复 memmy-memory 的埋点把查询词、记忆正文和记忆 ID 当作动作名发到云端的问题。现在只上报已知的子命令名,未知命令记为 unknown。细节见 PR 描述。谢谢! |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
任务与行为
memmy-memory search "<查询词>"、memmy-memory add "<记忆正文>"、memmy-memory get <id>、memmy-memory delete <id>。Memmy 装给 Agent 的 Skill 教的就是这种写法。memmy_cli_*事件。resolveCommandIdentity无条件把第二个词当作command_action,本意是记录session close里的close。可是 search、add、get、delete 没有子命令,第二个词就是查询词、记忆正文或记忆 ID,于是被原样发了出去。另外,第一个词不是已知命令时,原文会被当作command_group发出去。command_action。raw 的方法名和runRaw一样不区分大小写。第一个词不是已知命令时,command_group记为unknown。has_session_id、has_turn_id的判断不变。修改范围
Memory/src/cli/analytics.ts:新增一张已知命令表,对应commands.ts里的runCommand和mapTopLevelCommand,注释写明两边要保持一致;resolveCommandIdentity改为按这张表判断。没有直接引用commands.ts,因为analytics.ts还被plugin-runtime-analytics、memory-add-analytics、memmy-runtime-config这三个 CLI 以外的模块引用,反向引用会把 setup、runtime-installer 等模块一起带进来。Memory/tests/analytics-contract.test.ts:新增用例,覆盖以下几点:command_action上报;unknown;验证证据
fix-cli-analytics-command-action,起点d101fd58(即当前memmy_1031/v1.2.0),提交7ff1188b。提 PR 前已 fetch 并 merge 集成分支(Already up to date)。command_action: "some private query"被原样上报;修改后全部通过。npm run memory:test:106 个测试文件中 104 个通过、1 个跳过(仅在 Windows 上运行的安装器集成测试)、1 个失败;927 个用例中 925 个通过。失败的是l3-world-model.test.ts的 "keeps source IDs in evidence order and caps them at the latest 256…",原因是超时:上限 20 秒,这台机器跑全量时它要 35 秒左右。这个失败和本 PR 无关:d101fd58上,同样条件下跑全量,也是这一条超时(35.4 秒,920 个用例中 918 个通过)。npm run lint、npm run typecheck通过。git diff --check upstream/memmy_1031/v1.2.0...HEAD无输出;交付差异只含上面两个文件。upstream/v1.1.9做过试合并(git merge-tree),没有冲突。已知限制
memmy_cli_failed)的error_code取的是报错原文的前 64 个字符,可能带出记忆 ID、未知命令的原文或--body的正文片段。这是另一个字段,需要另外修,本 PR 没有改。unknown,不会漏发原文。🤖 Generated with Claude Code