[Reborn] Centralize snippet display hashing - #3507
Conversation
There was a problem hiding this comment.
Code Review
This pull request centralizes the FNV-1a hashing logic for model-visible snippet references into a new snippet_ref module, replacing duplicate implementations in memory_context.rs and skill_context.rs. Feedback indicates that the new centralized helper introduces a subtle change in hash calculation by appending a trailing field separator, which may break backward compatibility for existing or persisted LoopMessageRef strings.
| let ordinal = ordinal.to_string(); | ||
| let hash = stable_snippet_display_hash([snippet_ref, safe_summary, &ordinal]); |
There was a problem hiding this comment.
The centralization of the hashing logic here introduces a subtle change in the resulting hash value for skill snippets. The previous implementation (stable_snippet_ref_hash) did not include a trailing field separator after the final ordinal field, whereas the new stable_snippet_display_hash appends a separator after every field in the iterator.
While these hashes are documented as opaque display identifiers, this change will break any existing or persisted LoopMessageRef strings that were generated using the old logic. If backward compatibility for transcript resolution or in-flight runs is required, this should be addressed by either adjusting the centralized helper or explicitly handling the trailing separator in the call site.
References
- Prioritize backward compatibility for existing data and logic when modifying centralized helpers or established formats.
|
Paranoid review found a Medium issue at head
|
* fix(reborn): centralize snippet display hashing * fix(reborn): preserve skill snippet display refs * fix(reborn): harden snippet display ref API
Summary
Scope
Follow-up to #3476/#3470. Addresses the #3492 comment item: snippet-ref hash derivation should not be duplicated across prompt/context paths.
Verification
CARGO_TARGET_DIR=/Users/firatsertgoz/Documents/ironclaw/target cargo test -p ironclaw_turns -p ironclaw_host_runtimeCARGO_TARGET_DIR=/Users/firatsertgoz/Documents/ironclaw/target cargo test -p ironclaw_architectureDoes not close #3492.