fix(skill): preserve custom installed instructions#20
Open
NianJiuZst wants to merge 4 commits into
Open
Conversation
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.
What problem this solves
bsk install-skill --source <path>is a documented way to install a customized BrowserSkillSKILL.md. However, the automatic synchronization path did not remember where an installed file came from. Daemon startup,session start, anddoctortreated every existing BrowserSkill installation as a managed copy and rewrote any content that differed from the binary's bundled Skill.That meant a successful custom installation was temporary. A later health check or normal automation session could silently replace the user's instructions with the bundled file. The overwrite happened without
--force, without a confirmation prompt, and without a recoverable backup.The same ambiguity applies to historical installations created before BrowserSkill recorded ownership. Automatically overwriting an unmarked file is unsafe because it may be either an old bundled copy or a user-maintained customization.
How this fixes it
Skill installation now writes a small
.bsk-sourceprovenance marker next toSKILL.md:bundledmeans the file was installed from the binary's embedded Skill and may be automatically updated;custommeans--sourceor another non-bundled payload was used and automatic sync must preserve it.The marker is written only when BrowserSkill actually installs or force-updates the file. A skipped existing installation is not retroactively claimed.
Automatic synchronization now follows a conservative ownership rule:
bundledis atomically updated;customis preserved;The sync report has a separate
protectedoutcome so custom/unmanaged files are distinguishable from missing files and I/O failures.bsk doctorreports this as not applicable rather than failing or claiming that the custom file was synchronized.User impact
Custom Skill instructions survive daemon startup, session creation, and doctor runs. Users can continue to replace a custom file deliberately with
bsk install-skill --force.Bundled installations created after this change continue receiving automatic updates. Historical unmarked installations are deliberately left untouched; users who want BrowserSkill to manage one can re-run the bundled installer with
--force, which writes the managed marker.This migration policy favors preserving user content over guessing provenance.
Validation
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --locked -- -D warningscargo test --workspace --lockedcargo test -p bsk skill_install --lockednode --test scripts/*.test.mjsgit diff --checkRegression tests cover bundled provenance, custom provenance, force updates, custom-install followed by automatic sync, preservation of legacy unmarked files, managed bundled updates, unchanged-file mtimes, and partial I/O failures.
CI Baseline Compatibility
This branch also carries the one-line Biome 2.4 formatter output for
apps/extension/vitest.config.ts. The same formatting mismatch currently fails the Frontend job onupstream/main; this minimal compatibility commit is intentionally separate from the functional fix and lets this PR run the repository CI suite to completion.CI Reliability Follow-up
GitHub Actions exposed a pre-existing test-only port allocation race: integration helpers probed an ephemeral port, released it, and then asked the daemon to bind the same number, allowing another process to claim it in between. The resulting
Address already in usefailure was unrelated to the functional changes. The PR now lets each daemon bind port0directly and reads the assigned address from its handle, removing the TOCTOU window across all affected integration helpers.