Repository navigation
Conversation
A managed [[hooks]] block ran until the next table header or the end of the file, so the comments after it were removed with it on every events refresh and teardown. A comment there usually introduces the user hook that follows it. End the block after its last line of TOML and the blank lines right after it. Lines inside a multiline string or array still belong to the value. Refs github#5079 Assisted-by: Claude Code (model: claude-opus-5-5, autonomous)
This branch has not been deployed
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
VibeIntegration._managed_hook_spanstreats a managed[[hooks]]block in.vibe/hooks.tomlas running until the next table header or the end of the file, so cleanup removes any comments after the block along with it. Every events refresh and teardown goes through this code. A note a user writes above their own hook is deleted the next time an extension is added, enabled, disabled or removed, while the hook itself stays.Copilot flagged this on #4646 ("Exclude trailing standalone comments from managed spans, while still including complete multiline values"), and #4646 merged without that change. The regex cleanup before #4646 stopped at
speckit_marker = trueand kept these comments.With this PR, a managed block ends after its last line of TOML and the blank lines right after it. A standalone comment after that stays with whatever follows it. Lines inside a multiline string or array still belong to the value, so a managed hook whose value has comment-like lines is still removed whole.
Repro with the real CLI.
ext-demoandext-demo2are minimal project extensions that each declare one event inextension.yml(events:, as indocs/reference/extensions.md):main(67e0f72)specify extension add ../ext-demo2 --devspecify extension disable demoThe PR says
Refs #5079because it doesn't change the issue's second case: when removal leaves only comments,remove_vibe_event_hooksstill deletes the file. The shared TOML cleanup does the same for Codex'sconfig.toml(_remove_toml_entries, pinned bytest_owned_only_config_still_deleted_on_teardown), and the rule predates #4646. Changing it only for Vibe would make the two integrations disagree.Testing
uv run specify --helpuv sync && uv run pytestNew tests in
tests/integrations/test_integration_vibe.py:test_refresh_and_teardown_keep_comments_after_a_managed_hook, throughinstall_integration_eventsandremove_integration_events, with a comment above a user hook and with a comment at the end of the file.test_removal_keeps_a_comment_that_follows_a_managed_hookchecks the exact bytes: the blank line after the managed block goes with it, and the comment stays.test_removal_still_takes_comment_like_lines_inside_managed_valuesis a control: a managed multiline string and array whose lines look like comments are still removed whole. It passes onmaintoo.With only
vibe/__init__.pyreverted tomain, the first three fail. With the fix, all four pass.Full suite on Linux, Python 3.13: 12805 passed, 435 skipped (
uv sync --extra test, thenpytest -n 3, 6 min). Ruff 0.15.0 (ruff check src tests) passes. I haven't run it on Windows.AI Disclosure
AI disclosure: Claude Code (model: claude-opus-5-5, autonomous) reproduced the issue on
mainwith the real CLI, wrote the fix and the tests, ran them againstmainand the fix, ran the full suite and lint, and drafted this description. The commit carries anAssisted-by:trailer.