Skip to content

patch.py fails on v2.1.87 — db8 pattern hits wrong occurrence, TTL function renamed #1

@arsinoeii

Description

@arsinoeii

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions