-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat: durable candidates MVP + scoped traceable recall + Codex archive watcher #1055
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MarcoLissitzky
wants to merge
18
commits into
rohitg00:main
Choose a base branch
from
MarcoLissitzky:feat/codex-windows-archive-recall
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
d5611a6
chore(runtime): snapshot p0 freeze baseline
MarcoLissitzky 7ac195c
feat(memory): add durable candidates MVP
MarcoLissitzky 6c7ab5c
docs(handoff): capture p1 durable candidates state
MarcoLissitzky 285fdf8
feat(archive): finalize canonical store import
MarcoLissitzky 9e57966
feat(recall): add scoped traceable context recall
MarcoLissitzky 2245597
docs: sync stats to P2 recall + P1 durable baseline
MarcoLissitzky 35436df
feat(plugin): add Codex archive watcher lifecycle
MarcoLissitzky e2e2a29
fix(recall): enforce hard budget boundaries
MarcoLissitzky 0c72e25
test(recall): add end-to-end benchmark runner
MarcoLissitzky eeb2b94
docs(recall): record P2 final acceptance
MarcoLissitzky 1aa1b65
feat(recall): expose runtime build info endpoint
MarcoLissitzky 9121369
docs(recall): finalize P2 acceptance gates
MarcoLissitzky 55eaad1
docs(skills): refresh generated P2 references
MarcoLissitzky 283085d
docs(recall): record final verification metrics
MarcoLissitzky 0229f38
docs(recall): classify final baseline exceptions
MarcoLissitzky 9d3c6c3
fix(recall): close observability review blockers
MarcoLissitzky cb74c2b
docs(recall): record review acceptance
MarcoLissitzky 154c657
docs(recall): finalize runtime acceptance record
MarcoLissitzky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| # CodeRabbit Review Triage — PR #1050 | ||
|
|
||
| 日期:2026-07-13 | ||
| 当前复核基线:`52f7200` (`p2-recall-observability-final`) | ||
| CodeRabbit 原 review 范围:`93ae9bc` → `2245597` | ||
|
|
||
| 本报告按当前 HEAD 复核旧评论;旧评论没有被直接当作当前代码事实。此次工作不 push、不写远端 issue、不修改 Scheduled Task,也不移动 tag。 | ||
|
|
||
| ## 当前仍有效且本次修复 | ||
|
|
||
| | 评论 | 当前分类 | 当前证据与处理 | | ||
| |---|---|---| | ||
| | `mem::context` 丢弃 `limit` | `still-valid` → fixed | `src/functions/context.ts` 未转发调用方 limit,且 Recall Core 用 `limit || 20`;新增 context/Core 回归测试,转发并保留 `limit=0`。 | | ||
| | `resolveRecallIdentity` 接受任意 cwd 并同步执行 git | `still-valid` → fixed | 当前路径使用同步 git 且未做可信根约束;改为异步、500ms 超时、显式允许根、realpath/目录/UNC/越界/symlink escape 校验,并对失败降级 unknown。 | | ||
| | Git remote 归一化不一致 | `still-valid` → fixed | HTTPS、SSH URL、SCP 旧实现产生不同 fingerprint;统一 hostname、用户信息、默认端口、URL decoding、`.git` 和尾斜杠处理,并覆盖不同 host/owner/repo 不碰撞。 | | ||
| | Recall stats 非原子 get/set | `still-valid` → fixed | 选中数、分数总和和 scope mismatch 改用 `state::update` 原子 increment;平均分由缩放整数累加器物化;memory 内容/version/updatedAt 不参与写入。 | | ||
| | Viewer dropped count 未完整转义 | `still-valid` → fixed | dropped reason/label/value 的同一路径统一经 `esc(String(...))` 后进入 `innerHTML`,并加入 payload XSS 回归测试。 | | ||
|
|
||
| ## 其他评论的当前分类 | ||
|
|
||
| | 评论 | 当前分类 | 说明 | | ||
| |---|---|---| | ||
| | README 测试数 `1,423` vs `1,500+` | `defer-with-issue` | 当前 README 仍有旧 badge/开发段落数字;不影响运行时,建议文档清理阶段统一从实际测试清单生成。 | | ||
| | README endpoint 数 `136` vs 生成 reference `125` | `defer-with-issue` | 评论中的两个数字已过时;当前 README 为 137,生成 reference 为 126,说明仍有计数漂移,但不阻塞本次 P2 代码合并。 | | ||
| | `recall_budget.maxSessionSummaries` 错误标签 | `defer-with-issue` | 当前仍可见,影响配置错误诊断一致性,不改变 recall 结果;建议配置/schema 一致性阶段修复。 | | ||
| | archive import session ID 一致性 | `defer-with-issue` | 当前 archive import 仍未把解析到的 session ID 贯穿导入路径;建议 archive/replay 一致性阶段修复。 | | ||
| | observe rollback image reference decrement | `defer-with-issue` | 当前 rollback 仍有直接删除 image 的路径;可能造成引用计数不一致,但与本次五项 P2 合并阻塞无直接依赖。 | | ||
| | pre-compact epoch 错误隔离 | `defer-with-issue` | 当前 epoch 与 context 仍在同一失败边界;建议 hook 可用性/降级阶段修复。 | | ||
| | MCP `outputMode` schema | `defer-with-issue` | 当前 registry schema 仍为宽泛 string,server 运行时有校验;建议 MCP schema 收紧阶段修复。 | | ||
| | 共享类型整理 | `defer-with-issue` | 当前 `InjectionLedgerEntry` 等类型仍存在模块内定义;属于可维护性整理,不阻塞行为验收。 | | ||
| | 重复 checkoutId spread | `defer-with-issue` | 当前 API payload 构造仍有重复 spread;结果通常相同但增加维护风险,建议 API 清理阶段修复。 | | ||
| | stale comment / unknown wildcard 说明 | `defer-with-issue` | `remember` 附近注释与当前 scope gate 语义不完全一致;建议 scope 文档/注释阶段修复。 | | ||
| | fake timer cleanup | `defer-with-issue` | 当前测试仍手动恢复 timer;建议测试卫生阶段统一 afterEach。 | | ||
| | 重复 enum | `defer-with-issue` | 当前 eval schema 与生产类型仍有重复候选枚举;建议 shared-type 阶段整理。 | | ||
| | CJK token range | `defer-with-issue` | 当前 token 快路径仍使用有限 Unicode range;建议 tokenizer 正确性阶段扩展并补基准。 | | ||
| | trace retention 全量扫描 | `defer-with-issue` | 当前 retention 仍扫描完整 trace 列表;建议存储/索引优化阶段处理。 | | ||
| | hydration 串行 KV 读取 | `defer-with-issue` | 当前 hydration 仍按顺序读取;建议启动性能阶段并行化及限流。 | | ||
|
|
||
| 本次没有发现可安全标为 `already-fixed-after-2245597` 或 `not-applicable` 的上述重点评论;数字评论的具体旧数字虽然已经过时,但其文档漂移问题仍存在,因此按 `defer-with-issue` 记录。 | ||
|
|
||
| ## 非当前合并阻塞问题清单 | ||
|
|
||
| | 问题 | 影响 | 建议阶段 | 建议 issue 标题 | 是否阻塞当前合并 | | ||
| |---|---|---|---|---| | ||
| | README 测试数/endpoint 数漂移 | 用户看到的项目规模与生成事实不一致 | docs hygiene | `docs: reconcile README test and endpoint counts` | 否 | | ||
| | 配置错误标签 camelCase | 错误路径与 TOML 配置名不一致,降低排障效率 | config consistency | `fix: align recall budget error labels with config keys` | 否 | | ||
| | archive import session ID 一致性 | 导入记录可能失去原始 session 关联 | archive/replay | `fix: preserve archive import session identity` | 否 | | ||
| | observe rollback image ref decrement | 多引用图片的回滚计数可能不准 | media lifecycle | `fix: decrement image refs during observe rollback` | 否 | | ||
| | pre-compact epoch 错误隔离 | epoch 失败可能连带跳过 context | hook resilience | `fix: isolate pre-compact epoch failures` | 否 | | ||
| | MCP outputMode schema | 客户端无法从 schema 获得枚举约束 | MCP contract | `fix: constrain memory recall outputMode schema` | 否 | | ||
| | duplicate checkoutId spread | API payload 维护风险 | API cleanup | `refactor: remove duplicate checkout identity spread` | 否 | | ||
| | stale scope wildcard comment | 注释误导 scope 行为理解 | scope docs | `docs: correct legacy scope wildcard comment` | 否 | | ||
| | fake timer cleanup | 测试隔离依赖手动清理 | test hygiene | `test: centralize fake timer cleanup` | 否 | | ||
| | duplicate enum/shared types | 类型漂移风险 | type consolidation | `refactor: consolidate recall shared types` | 否 | | ||
| | CJK token range | 少数 Unicode CJK 字符估算可能偏差 | tokenizer correctness | `fix: expand CJK token detection coverage` | 否 | | ||
| | trace retention full scan | 大规模 trace store 的 sweep 成本 | storage performance | `perf: bound trace retention candidate scan` | 否 | | ||
| | serial hydration | 启动/恢复延迟随记录数线性叠加 | startup performance | `perf: parallelize bounded hydration reads` | 否 | | ||
|
|
||
| ## 本次修复验证范围 | ||
|
|
||
| 新增/更新回归测试覆盖 limit 传播与 `limit=0`、search 与 context budget 分离、prompt hard budget、remote normalization、cwd 安全与异步 git、100 次并发 stats、memory 不变、Viewer XSS payload。benchmark runner 的 in-memory KV stub 也补齐了与生产 `state::update` 对齐的原子操作语义。 | ||
|
|
||
| 不创建远端 issue。tag 建议以最终远端查询结果为准:远端未发现 `p2-recall-observability-final*` 时,建议用户确认后重建本地未 push tag;若旧 tag 已 push,保留旧 tag 并新建 `p2-recall-observability-final.1`。 |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| # P2 Recall Observability — Final Acceptance | ||
|
|
||
| 日期:2026-07-13 | ||
| 原验收 commit:`52f7200` | ||
| 原验收 tag:`p2-recall-observability-final`(本地指向 `52f7200`) | ||
| CodeRabbit review 复核范围:PR #1050 的旧范围 `93ae9bc` → `2245597`;本次以当前 HEAD 为准。 | ||
|
|
||
| ## 本次结论 | ||
|
|
||
| CodeRabbit 五项重点评论在当前 HEAD 仍存在,均已先补回归测试再修复: | ||
|
|
||
| 1. `mem::context` 现在保留并转发 `limit`,`limit=0` 不会被默认值覆盖;ranked results 的 limit 不再被 context token budget 错误截断。 | ||
| 2. recall identity 改为异步 git 探测,cwd 受 `AGENTMEMORY_RECALL_ALLOWED_ROOTS`/默认工作根约束,并拒绝越界、不存在、文件、UNC、symlink escape;git 探测有 500ms 超时,失败安全降级 unknown。 | ||
| 3. HTTPS、SSH URL、SCP remote 统一 hostname/用户/default port/URL encoding/`.git`/尾斜杠后计算稳定 repoId;不同 host/owner/repo 不碰撞。 | ||
| 4. recall stats 使用底层 `state::update` 的原子 increment 保存 count、scaled score total、scope mismatch;平均分在读取时物化,不写 Memory 内容、version 或 updatedAt。 | ||
| 5. Viewer dropped reason/label/value 同一路径全部转义后才进入 `innerHTML`。 | ||
|
|
||
| 逐条分类和非阻塞事项见 [CODERABBIT_REVIEW_TRIAGE.md](CODERABBIT_REVIEW_TRIAGE.md)。其他评论(archive import session ID、observe rollback image ref、trace retention、hydration、pre-compact、MCP schema、README 数字、配置标签、checkoutId、stale comment、重复 enum、fake timer、CJK token、共享类型)未混入本次修复,均列为 `defer-with-issue`。 | ||
|
|
||
| ## 修改清单 | ||
|
|
||
| - `src/functions/context.ts`、`src/recall/core.ts`、`src/triggers/api.ts`:贯通并校验 limit,保留零值。 | ||
| - `src/recall/identity.ts`:异步、受信根、realpath、symlink/UNC/越界检查、超时和 remote canonicalization。 | ||
| - `src/state/kv.ts`、`src/recall/trace-store.ts`、`src/types.ts`:原子 stats 更新和 scaled aggregate。 | ||
| - `src/viewer/index.html`:完整转义 dropped 动态值。 | ||
| - `eval/recall/runner.ts`:benchmark KV stub 补齐 `state::update` 原子操作语义。 | ||
| - `.env.example` 与生成的 config reference:记录允许 identity roots 配置。 | ||
| - 新增/更新五组 focused regression tests;新增本报告与 CodeRabbit triage 报告。 | ||
|
|
||
| ## 实际测试与 benchmark | ||
|
|
||
| 已通过: | ||
|
|
||
| ```text | ||
| npx vitest run test/recall-core.test.ts test/recall-context-limit.test.ts test/recall-identity.test.ts test/recall-trace-store.test.ts test/viewer-recall-xss.test.ts --reporter=verbose | ||
| 5 files / 17 tests passed | ||
|
|
||
| npx vitest run test/cross-project-isolation.test.ts test/agent-isolation-search.test.ts test/enrich-project-isolation.test.ts test/recall-core.test.ts test/recall-config.test.ts test/circuit-breaker.test.ts test/vector-retrieval-health.test.ts test/recall-context-limit.test.ts test/recall-identity.test.ts test/recall-trace-store.test.ts test/viewer-recall-xss.test.ts --reporter=verbose | ||
| 11 files / 50 tests passed | ||
|
|
||
| npx vitest run test/hybrid-search.test.ts test/vector-retrieval-health.test.ts test/recall-core.test.ts --reporter=verbose | ||
| 3 files / 17 tests passed | ||
|
|
||
| npm run skills:check | ||
| 17 skills checked; passed | ||
|
|
||
| npm run build | ||
| exit code 0; passed | ||
| ``` | ||
|
|
||
| Benchmark command:`npm run bench:recall -- --json`。结果:hit rate `1.0000`、precision `0.8421`、cross-project contamination `0`、budget violation `0`、duplicate injection `0`、stale/superseded injection `0`、average injected tokens `57.07`。首次运行发现并修复 benchmark stub 缺少 `update` 的验收阻断,修复后结果恢复并达到 gate。 | ||
|
|
||
| Scope smoke 的可执行覆盖来自 benchmark fixture 和 focused suites:project 正向命中、cross-project contamination `0`、user scope 跨项目、unknown 不自动注入、explicit recall 可返回 unknown。Vector degraded/BM25 fallback 由 `hybrid-search` 与 `vector-retrieval-health` 定向 smoke 通过。 | ||
|
|
||
| ## Runtime / build-info | ||
|
|
||
| 原有 runtime 在 3111 上保持运行,未停止任何身份不明进程;原实例已验证 `/agentmemory/livez` 200、`/agentmemory/health` 200、`GET /agentmemory/build-info` 200。该实例的旧 build-info 是 `52f7200`,因此不把它冒充为本次修复后的 runtime 验证。 | ||
|
|
||
| 最终 runtime 重启使用本地构建的 acceptance HEAD,接入既有 iii bridge(49134);未停止 Scheduled Task。`/agentmemory/livez`、`/agentmemory/health`、`GET /agentmemory/build-info` 均 HTTP 200,viewer live smoke HTTP 200(端口因 3113 被占用而安全 fallback 到 3116)。build-info 实测 `sourceCommit` 与验收时 HEAD 一致、`sourceDirty=false`、`builtAt` 为 ISO 时间、`artifactHash=f19c526f7bb86c290bad8a95769d8515f1bda393ae6e8544bde4bbc4e4eb45b3`;按 `scripts/build-runtime-assets.mjs` 的 Windows 路径规则重算一致。REST recall context/debug/debug-by-id 均 HTTP 200,最新 trace=`rtr_mrix53u6_f2b4a2bde895`,并验证 `limit=0`。实例只用于验收;停止/重启的进程均为已识别 AgentMemory/iii runtime 进程,不修改 Scheduled Task。 | ||
|
|
||
| ## 全量测试分类 | ||
|
|
||
| 本次 `npm test -- --reporter=dot` 实际为 `1,422 passed / 40 failed`(新增 11 个回归测试,故通过数较原 `1,411` 基线增加 11;失败数保持 40)。40 项逐项豁免保持原分类:connector-environment 15(connect-new-agents 11、copilot-plugin 1、cli-remove 3);windows-path 14(obsidian-export 8、hook-project 6);symlink-capability 5(compress-file 5);env-isolation 5(embedding-provider 3、slots-flag-gate 2);known-preexisting 1(integration-plaintext-http 1)。 | ||
|
|
||
| 最终验收必须确认:`P2-related failures = 0`、`new regressions = 0`,任何超出上述 40 项的失败都必须单独调查,不能归入 baseline。另执行 `git diff --check`,结果必须无 whitespace error。 | ||
|
|
||
| ## 提交与 tag 建议 | ||
|
|
||
| 最终验证代码 commit:`e0c6ce9`(完整 hash `e0c6ce9817a8e6b41e83d469435942385cb91cb4`)。本 acceptance record 的后续 docs-only commit 如产生,需在最终输出中另行记录;工作树最终必须 clean。 | ||
|
|
||
| 本次不创建、删除、移动或 push tag。远端查询未返回 `p2-recall-observability-final*`,所以若最终确认本地 tag 尚未 push,建议用户确认后将本地 tag 从原 `52f7200` 重建到新的最终验收 commit;若发现旧 tag 已 push,则保留旧 tag,建议新建 `p2-recall-observability-final.1`。本次只给建议,不执行 tag 操作。 |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: rohitg00/agentmemory
Length of output: 3480
🏁 Script executed:
Repository: rohitg00/agentmemory
Length of output: 4363
Use the platform path separator here.
src/recall/identity.tssplitsAGENTMEMORY_RECALL_ALLOWED_ROOTSwithpath.delimiter, so this example should say:on Unix and;on Windows (or just refer to the platform delimiter) instead of only mentioning Windows.🤖 Prompt for AI Agents