gabriel / muse public
fix patch task/prompt-hash-prefix #1 / 1
AI Agent gabriel · 134 days ago · May 5, 2026 · Diff

fix: normalize MUSE_PROMPT_HASH to sha256: prefix at commit boundary

Add _normalize_prompt_hash() in commit.py: accepts bare 64-char hex (adds sha256: prefix via long_id) or an already-prefixed sha256:<64-hex> value (passes through unchanged). Any other input — including short strings like 'abc123' — is rejected and stored as empty string.

Three tests written first (TDD): bare hex gets prefixed, already-prefixed unchanged, invalid string stored as empty. All 97 commit tests pass.

sha256:1def881ee8aec0d990c12ff2ab8f4ad28e17060a561cd35fa67bdba461fa49e9 sha
+7 ~3 −1 symbols
sha256:bb3027ed397b69d345ff99a6ea99ff0791755ae162bc616fd37584d593098193 snapshot
+7
symbols added
~3
symbols modified
−1
symbol removed
0
dead code introduced
Semantic Changes 11 symbols
~ muse/cli/commands/commit.py .py 4 symbols added, 2 symbols modified
+ _HEX64_RE variable variable _HEX64_RE L129–129
+ _normalize_prompt_hash function function _normalize_prompt_hash L131–144
+ long_id import import long_id L40–40
+ re import import re L36–36
~ run
~ tests/test_cmd_commit.py .py 3 symbols added, 1 symbol removed, 1 symbol modified
test_prompt_hash_from_env method method test_prompt_hash_from_env L802–812
+ test_prompt_hash_already_prefixed_unchanged method method test_prompt_hash_already_prefixed_unchanged L815–826
+ test_prompt_hash_bare_hex_gets_prefixed method method test_prompt_hash_bare_hex_gets_prefixed L802–813
+ test_prompt_hash_invalid_not_stored method method test_prompt_hash_invalid_not_stored L828–838
← Older Oldest on task/prompt-hash-prefix
All commits
Newer → Latest on task/prompt-hash-prefix

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:1def881ee8aec0d990c12ff2ab8f4ad28e17060a561cd35fa67bdba461fa49e9 --body "your comment"