Repository navigation
fix(ovpack): 修复向量备份校验并补齐 agent/tools 索引 - #8584
Merged
Merged
Conversation
读取整个 agent 子树,复用现有的资源和技能索引流程,补齐 tools 和其他子目录缺失的索引。
全局重建给 agent/tools 复用现有资源索引流程,保留 agent 根目录和技能原有的重建方式。
恢复账号包时按同一套路径规则跳过只存文件的内容,避免重新给用户设置、隐私配置和策略文件生成向量。
直接从文件树生成待校验索引,移除单独收集文件和目录候选的代码。
直接将命名空间根目录交给已有重建流程。重建范围只有当前目录时,只使用该目录的 L0/L1 记录。
baojun-zhang
approved these changes
Nov 27, 2026
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.
Description
在
main上,新建账号并等初始化完成后,ov backup ./account.ovpack --include-vectors会把memories/cases等分类的预置说明当成缺失的 L0/L1 索引。用户保存设置或隐私配置、安装技能后,部分系统文件也会被判成缺索引,导致带向量备份失败。应用修复后,新账号的记忆分类先创建空目录。第一次通过
writeAPI 写入案例并完成目录刷新后,memories/cases的 L0/L1 和案例正文的 L2 都会进入索引。首次写入前后的带向量备份均可成功,普通记忆正文缺 L2 时仍会报告缺失。在 #8555 的实现中,如果
viking://agent/tools/.abstract.md还在而目录 L0 丢失,ov reindex viking:// --wait true会返回成功,但下次带向量备份仍会报缺。这个 PR 把agent/tools纳入全局重建,补齐后同一条备份命令可成功。Changes Made
settings/、privacy/、memories/soul.md和GLOBAL_POLICY.md随包保存。带向量备份的校验和恢复时的重算共用路径规则,两处都跳过这些文件。main的规则。文件名以点开头时跳过 L2 校验和恢复重算,父目录或用户 ID 的点前缀不影响已有向量的打包与恢复。skills/.skill-history/继续备份和恢复文件内容,跳过向量校验、打包和重算。该例外按技能历史的实际路径识别。memories/目录的 L0/L1 完整性校验,已有向量仍会入包。agent。普通导入和导出允许agent与resources使用相同的范围规则。agent根目录及预建的skills和tools。技能沿用现有重建流程,tools复用资源重建流程。用户根目录以及skills、peers根目录的索引也能补齐。一致性检查按命名空间规则跳过只存文件的system。Human Involvement
Related Issue
Fixes #8416
Type of Change
Testing
I have added tests that prove my fix is effective or that my feature works
New and existing unit tests pass locally with my changes
I have tested this on the following platforms:
本地通过 45 项相关测试,覆盖用户初始化、记忆写入后的目录刷新、账号备份和恢复、索引重建。
删除
agent根目录、tools及技能目录的 L0。分别使用vectors_only和semantic_and_vectors做全局重建,确认缺失项归零、带向量备份从 HTTP 400 恢复为 HTTP 200。本地启动服务,验证合法用户
.alice和普通点前缀目录中的文件可带向量导出。个人和共享技能的历史文件在跨账号直接恢复已有向量及重算两种模式下均完整保留。将带向量账号包以
recompute恢复到另一个账号。用户设置、全局策略、隐私配置和soul.md内容完整且没有新建 L2,普通资源文件重新生成了 L2。新建账号后,通过
writeAPI 写入第一条案例,确认目录摘要和概览生成,L0/L1/L2 均进入向量索引,写入前后的带向量备份均通过。Checklist
Screenshots (if applicable)
Additional Notes
旧版只包含
resources和user的账号包仍可由新版服务恢复。包含agent的账号包需要新版服务。账号备份仍校验整个
agent。如果自定义子目录缺索引,需要对该目录单独执行ov reindex <URI>。