Repository navigation
feat(skills): record skill install state in agent.db - #786
Merged
Merged
Conversation
Add a `skills` table (schema v3) to agent.db tracking each skill's name, current version and a deleted flag. The row for an uninstalled skill is kept as a tombstone so builtin bootstrap (`future init`) does not re-install skills the user removed; an explicit install clears the tombstone again. - agent: skills::registry module owns the canonical DDL, guard protocol (application_id/user_version) and maintenance functions; the session schema batch includes the table and migrates v2 - cli: install/uninstall/update/builtin paths record outcomes; the tombstone is written before the directory is removed so a crash cannot lose the mark; bootstrap filters tombstoned ids - desktop: mirrored write-only helper (the desktop must not link the agent crate) wired into install_and_refresh/uninstall_and_refresh Also fixes a latent flake in the skill_commit test: a concurrently spawned child process can hold a forked copy of a dropped flock for an instant, so the final commit retries briefly instead of treating the transient window as a competing installer.
ace331
enabled auto-merge (squash)
September 22, 2026 23:26
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.
概要
在 agent.db 新增
skills表(schema v2 → v3),记录 skill 元数据:名称、当前版本号、是否已删除。删除后记录保留为墓碑(tombstone),使future init的内置技能自动安装不再把用户已删除的技能装回来;显式安装会清除墓碑。安装、删除、升级时自动维护。表结构
deleted = 0deleted = 1,行与最后版本保留各进程接入
skills::registry模块持有权威 DDL、守卫协议(application_id / user_version 校验,拒绝陌生库)和维护函数;session schema 批次纳入该表,v2 库打开时自动迁移到 v3。registry 新建的库(agent 从未启动过的机器)会被 agent 接受并补齐其余表。install_skill成功后记录;uninstall_skill先写墓碑再删目录(两步之间崩溃不会丢失标记,失败时文件原样可重试);install_builtin_skills过滤墓碑。读 registry 失败只告警不阻断安装。replace_skill_dir的"同协议双实现"模式),接入install_and_refresh/uninstall_and_refresh(sqlite 操作走spawn_blocking)。跨进程安全:WAL + busy_timeout,registry 打开 agent.db 遵循与 agent 相同的识别规则;对已存在的 v2 库只加表不动版本号(新旧 agent 均可打开),由 agent 的 schema 批次负责迁移。
顺带修复
skill_commit_rolls_back…测试存在既有竞态:drop(lock)后立即重新 flock,而并行测试 spawn 的子进程(unzip)在 fork 瞬间持有锁 fd 副本,try_lock会短暂误报冲突。已加 2 秒有界重试(已用独立探针程序复现确认根因,非本 PR 功能引入)。测试
cargo fmt+clippy干净。