fix(skills): require background-review forks to read before writing skills (#55647) - #55906
Merged
Conversation
This was referenced Jun 30, 2026
This was referenced Jul 11, 2026
This was referenced Aug 3, 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.
Summary
The per-session background-review fork can no longer patch a skill it never read.
skill_manage(patch/edit/write_file/remove_file)now refuses to mutate a skill during a background-review turn unless that exact file was loaded viaskill_viewfirst — closing the silent skill-corruption path in #55647 where a single review pass shrank an 807-line module to a 186-line stub.Salvage of #55657 by @kyssta-exe, cherry-picked onto current
mainwith authorship preserved.Changes
tools/skill_manager_tool.py: per-forkContextVarrecords which skill files the review fork has read;_background_review_read_before_write_guard()refusespatch/edit/write_file/remove_fileon a skill (or support file) not loaded this turn. Gated onis_background_review()— zero effect on normal sessions.tools/skills_tool.py:skill_viewmarks the loaded file as read so a subsequent targeted patch is allowed.agent/background_review.py: reset the read-marks when the review fork tears down.tests/tools/test_skill_manager_tool.py: read-before-write blocked, then allowed afterskill_view; support-file overwrite requires reading that specific file.scripts/release.py: AUTHOR_MAP entry for the salvaged commit's noreply email.Note on the issue's premise
Root cause #1 (no read-before-write invariant) is confirmed and is what this PR fixes. Root cause #2 (the fork inherits the full parent toolset) does not hold on current
main—agent/background_review.pyalready builds a runtime tool whitelist from["memory", "skills"]viaset_thread_tool_whitelist(...), so the fork cannot callterminal/patch/execute_code. The bug survived that whitelist only becauseskill_viewis whitelisted yet was never required beforeskill_manage. This PR adds that requirement.Validation
_read_before_write_requiredskill_viewtests/tools/test_skill_manager_tool.py: 107 passed.HERMES_HOME, 2912-char SKILL.md): unread patch blocked with the flag →skill_view→ patch allowed. PASS.Closes #55647.
Infographic