Version
2.1.87 (npm @anthropic-ai/claude-code@2.1.87)
Problem
patch.py exits with:
Patch 1 FAILED: found hook_additional_context but couldn't locate insertion point
The critical db8 patch fails even though the target code exists.
Root cause
Patch 1 (db8): The semantic search does source.find('"hook_additional_context"'), which hits the first occurrence in the file — an object constructor like:
vq({type:"hook_additional_context", content:..., hookName:"SessionStart", ...})
There's no return!1} within 300 chars of that. The actual filter function appears much later:
function GH6(q){
if(q.type==="progress")return!1;
if(q.type==="attachment"&&M57()!=="ant"){
if(q.attachment.type==="hook_additional_context"&&n6(process.env.CLAUDE_CODE_SAVE_HOOK_ADDITIONAL_CONTEXT))return!0;
return!1
}
return!0
}
Patch 2 (TTL): The function was renamed from sjY to Eyz in this version. Semantic search also fails here.
Patch 1b: Already present in 2.1.87 — no action needed.
Fix
For Patch 1, search for the more specific string that includes CLAUDE_CODE_SAVE_HOOK_ADDITIONAL_CONTEXT — it only appears in the filter function, not in constructors:
old1 = (
'if(q.attachment.type==="hook_additional_context"'
'&&n6(process.env.CLAUDE_CODE_SAVE_HOOK_ADDITIONAL_CONTEXT))return!0;'
'return!1}'
)
Note: variable names differ from 2.1.81 — parameter is q (not A), helper is n6 (not a6), provider check is M57 (not QA). The regex strategy should handle this if it searches for CLAUDE_CODE_SAVE_HOOK_ADDITIONAL_CONTEXT as the anchor rather than hook_additional_context.
For Patch 2, the TTL function is now Eyz:
old2 = 'function Eyz(q){if(V7()==="bedrock"'
new2 = 'function Eyz(q){return!0;if(V7()==="bedrock"'
The semantic search (find ttl:"1h", walk back to function boundary) should work if the regex fallback is fixed.
Suggestion
For Patch 1's semantic search, anchor on CLAUDE_CODE_SAVE_HOOK_ADDITIONAL_CONTEXT instead of hook_additional_context — it's unique to the filter function and won't match constructors.
Version
2.1.87 (npm
@anthropic-ai/claude-code@2.1.87)Problem
patch.pyexits with:The critical db8 patch fails even though the target code exists.
Root cause
Patch 1 (db8): The semantic search does
source.find('"hook_additional_context"'), which hits the first occurrence in the file — an object constructor like:There's no
return!1}within 300 chars of that. The actual filter function appears much later:Patch 2 (TTL): The function was renamed from
sjYtoEyzin this version. Semantic search also fails here.Patch 1b: Already present in 2.1.87 — no action needed.
Fix
For Patch 1, search for the more specific string that includes
CLAUDE_CODE_SAVE_HOOK_ADDITIONAL_CONTEXT— it only appears in the filter function, not in constructors:Note: variable names differ from 2.1.81 — parameter is
q(notA), helper isn6(nota6), provider check isM57(notQA). The regex strategy should handle this if it searches forCLAUDE_CODE_SAVE_HOOK_ADDITIONAL_CONTEXTas the anchor rather thanhook_additional_context.For Patch 2, the TTL function is now
Eyz:The semantic search (find
ttl:"1h", walk back to function boundary) should work if the regex fallback is fixed.Suggestion
For Patch 1's semantic search, anchor on
CLAUDE_CODE_SAVE_HOOK_ADDITIONAL_CONTEXTinstead ofhook_additional_context— it's unique to the filter function and won't match constructors.