Skip to content

fix(ovpack): 修复向量备份校验并补齐 agent/tools 索引 - #8584

Merged
baojun-zhang merged 6 commits into
mainfrom
fix/ovpack-backup-reindex
Nov 27, 2026
Merged

baojun-zhang merged 6 commits into
mainfrom
fix/ovpack-backup-reindex

Conversation

@qin-ctx

@qin-ctx qin-ctx commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Description

在 main 上,新建账号并等初始化完成后,ov backup ./account.ovpack --include-vectors 会把 memories/cases 等分类的预置说明当成缺失的 L0/L1 索引。用户保存设置或隐私配置、安装技能后,部分系统文件也会被判成缺索引,导致带向量备份失败。

应用修复后,新账号的记忆分类先创建空目录。第一次通过 write API 写入案例并完成目录刷新后,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

  • A human participated in the implementation or review loop
  • This PR was generated entirely by AI agents without human participation in the loop

Related Issue

Fixes #8416

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

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:

    • Linux
    • macOS
    • Windows
  • 本地通过 45 项相关测试,覆盖用户初始化、记忆写入后的目录刷新、账号备份和恢复、索引重建。

  • 删除 agent 根目录、tools 及技能目录的 L0。分别使用 vectors_only 和 semantic_and_vectors 做全局重建,确认缺失项归零、带向量备份从 HTTP 400 恢复为 HTTP 200。

  • 本地启动服务,验证合法用户 .alice 和普通点前缀目录中的文件可带向量导出。个人和共享技能的历史文件在跨账号直接恢复已有向量及重算两种模式下均完整保留。

  • 将带向量账号包以 recompute 恢复到另一个账号。用户设置、全局策略、隐私配置和 soul.md 内容完整且没有新建 L2,普通资源文件重新生成了 L2。

  • 新建账号后,通过 write API 写入第一条案例,确认目录摘要和概览生成,L0/L1/L2 均进入向量索引,写入前后的带向量备份均通过。

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

Additional Notes

旧版只包含 resources 和 user 的账号包仍可由新版服务恢复。包含 agent 的账号包需要新版服务。

账号备份仍校验整个 agent。如果自定义子目录缺索引,需要对该目录单独执行 ov reindex <URI>。

读取整个 agent 子树,复用现有的资源和技能索引流程,补齐 tools 和其他子目录缺失的索引。
全局重建给 agent/tools 复用现有资源索引流程,保留 agent 根目录和技能原有的重建方式。
@qin-ctx qin-ctx changed the title fix(ovpack): 修复向量备份校验并重建完整 agent 索引 fix(ovpack): 修复向量备份校验并补齐 agent/tools 索引 Nov 27, 2026
恢复账号包时按同一套路径规则跳过只存文件的内容,避免重新给用户设置、隐私配置和策略文件生成向量。
直接从文件树生成待校验索引,移除单独收集文件和目录候选的代码。
直接将命名空间根目录交给已有重建流程。重建范围只有当前目录时,只使用该目录的 L0/L1 记录。
@baojun-zhang
baojun-zhang merged commit 7ed0008 into main Nov 27, 2026
14 checks passed
@baojun-zhang
baojun-zhang deleted the fix/ovpack-backup-reindex branch November 27, 2026 09:21
@github-project-automation github-project-automation Bot moved this from Backlog to Done in OpenViking project Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Bug]: backup --include-vectors fails permanently — consistency checker expects index records for namespaces that reindex cannot build

2 participants