fix: hash reference lookup failures with Codex models
Four fixes for "Hash reference not found" errors:
1. Normalize hash refs — trim whitespace, strip trailing "|",
handle spaces around ":" (models may format refs loosely)
2. Line truncation consistency — computeFileHashes now truncates
lines >2000 chars before hashing, matching OpenCode's read tool
output. Previously produced different hashes for long lines.
3. Recompute hashes after edits — instead of clearing, recompute
from the new file content so subsequent stale-ref errors show
"line N now has hash X" instead of generic "not found"
4. Diagnostic error messages — when hash isn't found, shows what
hash IS at that line number (or that the line doesn't exist),
helping the model recover by re-reading
Also adds explicit system prompt guidance on hash ref format
("copy exactly, don't include | separator").
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> A
ASidorenkoCode committed
0cf6a2aed2e10fda0bbd077d88bb6f24518bccea
Parent: ade39ec