Skip to content

Match saveAgentColor with its new options argument on Claude Code 2.1.233 - #954

Merged
bl-ue merged 1 commit into
Piebald-AI:mainfrom
VitalyOstanin:fix/session-color-extra-args
Aug 17, 2026
Merged

Match saveAgentColor with its new options argument on Claude Code 2.1.233#954
bl-ue merged 1 commit into
Piebald-AI:mainfrom
VitalyOstanin:fix/session-color-extra-args

Conversation

@VitalyOstanin

Copy link
Copy Markdown
Contributor

Problem

On Claude Code 2.1.233 the whole session-color patch bails out:

patch: sessionColor: failed to patch saveAgentColor

saveAgentColor grew a fourth parameter, which it forwards to the transcript append call:

async function o2n(e,t,r,n){
  let o=r??yj(e);
  try{await Kie(o,{type:"agent-color",agentColor:t,sessionId:e},n)}
  catch(i){/* … */}
  if(e===qt())Cu().currentSessionAgentColor=t;
  O("tengu_agent_color_set",{})
}

The pattern pinned the signature to exactly three parameters and the append call to exactly two arguments, so neither of the two alternatives matched, and writeSessionColor returned null even though its app-state injections were fine.

Fix

Make the extra parameter and the extra argument optional. Capture-group numbering is untouched (both additions are non-capturing), so the extraction of the function name and the session-id getter is unchanged.

Verification

Ran the old and the new implementation over every extracted bundle I have (2.1.88, 2.1.89, 2.1.92, 2.1.98, 2.1.113, 2.1.126, 2.1.144, 2.1.183, 2.1.195, 2.1.201, 2.1.204, 2.1.214, 2.1.219, 2.1.233):

  • On all 13 pre-2.1.233 bundles the new patterns produce a byte-identical result.
  • On 2.1.233 the old patterns produce null; the new ones inject globalThis.__tweakccSaveAgentColor=(c)=>o2n(qt(),c);, which matches the if(e===qt()) check inside that function.
  • Exactly one match per bundle, so the looser patterns cannot latch onto a different function.
  • Cost per bundle: 5–27 ms.

Applied to a real 2.1.233 native binary: the patch reports success, TWEAKCC_SESSION_COLOR and __tweakccSaveAgentColor are present in the patched bundle, and the binary runs (2.1.233 (Claude Code)).

A regression test covers the new shape; the existing tests for the three earlier shapes still pass. Full suite, tsc, ESLint and Prettier are clean.

….233

saveAgentColor grew a fourth parameter that it forwards to the transcript
append call, so the pattern -- pinned to three parameters and a two-argument
append call -- stopped matching and the session-color patch bailed out with
"failed to patch saveAgentColor".

Make both the extra parameter and the extra argument optional so the
pre-2.1.233 forms keep matching.
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

An error occurred during the review process. Please try again later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@bl-ue
bl-ue enabled auto-merge (squash) August 17, 2026 17:49
@bl-ue
bl-ue merged commit c1d394b into Piebald-AI:main Aug 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants