gabriel / muse public
feat patch #192 feat/192-musehooks-phase5-dogfood #1 / 1
AI Agent gabriel · 2 days ago · Sep 11, 2026 · Diff

feat(#192): Phase 5 — --fail-if-out-of-sync + HK_ACCEPT_01 acceptance test

The dogfood phase: adds the exact flag musehub#192's plan specified for wiring agent-config drift detection into a real pre-commit hook, and proves the whole mechanism (Phases 1-5) end-to-end against this session's actual incident.

Added: - muse/cli/commands/agent_config.py: `muse agent-config status --fail-if-out-of-sync` — exits 1 only when an adapter that actually exists on disk is out of sync with .museagent.md (out_of_sync_count > 0). Never fails on missing/unconfigured adapters -- this checks for drift, not completeness, matching the exact incident this ticket exists to prevent (a real, generated AGENTS.md silently going stale). Opt-in: the flag's absence never changes exit code, so existing scripts relying on `status` always exiting 0 are unaffected. - tests/test_cmd_commit_hooks_acceptance.py (HK_ACCEPT_01): reproduces this session's real .museagent.md drift incident end-to-end against a real disposable repo -- init, agent-config init/set/sync, commit, wire up the dogfood hook (`muse agent-config status --fail-if-out-of-sync`), install it, edit .museagent.md without re-syncing an embed adapter, confirm the commit is blocked (naming the exact failing command), confirm --no-verify still gets it through visibly, then confirms re-syncing before committing is what actually fixes it (not just bypassing the check). Runs the hook against *this checkout's* source via a PATH shim + PYTHONPATH, not the separately installed stable `muse` binary -- otherwise the hook would silently exercise old code lacking the new flag (confirmed by first running this without the shim: it failed with "unrecognized arguments: --fail-if-out-of-sync" against the real installed CLI, which is exactly the muse-vs-muse-dev distinction this same ticket's investigation surfaced).

Tests: tests/test_cmd_agent_config.py::TestFailIfOutOfSync (6 tests, HK_40) -- exits 0 when nothing configured/in sync, exits 1 only on a real embed-adapter drift (not a plain missing adapter), --json still prints before the failing exit, flag's absence never changes exit code. Both written and confirmed red (argparse "unrecognized arguments") before implementation.

Full regression: tests/test_cmd_agent_config.py + test_agent_config_envelope.py (144 tests) + all hooks test files + tests/test_app.py = 244/244 passed.

This closes out the muse-side implementation of musehub#192. Remaining work: wire .musehooks.toml + `muse hooks install` into the real ~/ecosystem and ~/ecosystem/musehub repos (not test fixtures) as the actual dogfood deployment, and close the ticket.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

sha256:4407cfcab2133159237fd72a5d5fb98724ef53e6d36324695c3885626e3797c0 sha
+21 ~2 symbols
3 changed · 1184 in snapshot files
sha256:859f7b7e344df36fa0b39c602ae39146c42f3538d2d1ad9cac97f871d38ee74c snapshot
+21
symbols added
~2
symbols modified
3
files changed
1184
files in snapshot
0
dead code introduced
Semantic Changes 23 symbols
+ TestAgentConfigDriftAcceptance class class TestAgentConfigDriftAcceptance L68–120
+ test_reproduces_agent_config_drift_incident method method test_reproduces_agent_config_drift_incident L69–120
+ _invoke function function _invoke L26–32
+ _muse_shim_on_path function function _muse_shim_on_path L36–65
+ CliRunner import import CliRunner L21–21
+ InvokeResult import import InvokeResult L21–21
+ annotations import import annotations L11–11
+ json import import json L13–13
+ os import import os L14–14
+ pathlib import import pathlib L15–15
+ pytest import import pytest L19–19
+ stat import import stat L16–16
+ sys import import sys L17–17
+ runner variable variable runner L23–23
~ tests/test_cmd_agent_config.py .py 7 symbols added
+ TestFailIfOutOfSync class class TestFailIfOutOfSync L659–710
+ test_exits_0_when_in_sync method method test_exits_0_when_in_sync L671–676
+ test_exits_0_when_no_agent_md_at_all method method test_exits_0_when_no_agent_md_at_all L660–663
+ test_exits_0_when_nothing_configured_yet method method test_exits_0_when_nothing_configured_yet L665–669
+ test_exits_1_when_out_of_sync method method test_exits_1_when_out_of_sync L678–688
+ test_flag_absent_never_changes_exit_code method method test_flag_absent_never_changes_exit_code L701–710
+ test_json_still_printed_before_failing_exit method method test_json_still_printed_before_failing_exit L690–699
Files Changed
+1 ~2
1184 in snapshot
← Older Oldest on feat/192-musehooks-phase5-dogfood
All commits
Newer → Latest on feat/192-musehooks-phase5-dogfood

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:4407cfcab2133159237fd72a5d5fb98724ef53e6d36324695c3885626e3797c0 --body "your comment"