Repository navigation
fix: refresh the AI decompilation when a predicted name is accepted - #182
Merged
Merged
Conversation
Accepting a predicted name renamed the function in IDA and then only called refresh_disassembly_view(), which refreshes the disassembly, not the AI decompilation panel. update_function_name and apply_deduped_name are pure ida_name.set_name calls, so nothing reached the platform and the panel kept rendering its cached result -- the body still read FUN_<addr> after the rename. Route both rename paths through _after_function_renamed, which reuses the refresh button's own logic. When the token map is loaded it writes the local name as a user override on the own_function placeholder, exactly as an in-panel rename does, so the re-rendered decompilation uses the name the function now has in IDA. Before the tokens land there is no placeholder to override, so it falls back to refresh_current(). Adds own_function_placeholder() to locate the token that names the function itself; own_function is a distinct RenderedToken kind alongside function and funcptr. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack: #178 → #179 → #180 → #181 → this.
The bug
Accepting a predicted name renames the function in IDA, then calls only
refresh_disassembly_view()— which refreshes the disassembly, not the AI-decomp panel. So the panel keeps rendering its cached result and the body still readsFUN_140004780after the rename.Two things make it stick:
update_function_name/apply_deduped_nameare pureida_name.set_namecalls (base_service.py:46,94). Nothing reaches the platform, so a refetch alone would still return the server's name._rerender()rendersDecompilationData.decompilation— a server-rendered string. The only client-side lever on it is the user-override map, which an in-panel rename already writes viav3_upsert_ai_decompilation_overrides.The fix
Both rename paths now go through
_after_function_renamed, which reuses the refresh button's own logic. When the token map is loaded it writes the local name as a user override on theown_functionplaceholder — exactly what an in-panel rename does — so the re-rendered decompilation uses the name the function now has in IDA. Before the tokens land there is no placeholder to override, so it falls back torefresh_current().Adds
own_function_placeholder();own_functionis a distinctRenderedToken.kindalongsidefunctionandfuncptr.Note this makes "use suggested name" consistent with the in-panel rename: both write an override, so the portal shows the same name. If you'd rather the local rename stay local, the alternative is a local-name branch in
effective_values()instead — say the word and I'll swap it.Verification
Separately: gaps found against the portal
Diffed the plugin's SSE handling against the Dashboard's (
apps/dashboard/utils/v3/aiDecompilation/). Not fixed here — flagging for triage:types_appliedtriggers no refetch. The Dashboard invalidates three caches on it, guarded ontypes !== 0: the decompilation tokens, the type suggestions, and the analysis data-type list. Its comment: "everydata_type_idthe page is holding for this function is one revision behind." The plugin only increments a counter, so its tokens go stale after a type-apply.rename_appliedis parsed and dropped.StreamState.renamesis appended to atstream.py:141and read nowhere. The Dashboard applies each one to the buffered source as a whole-word replace — word boundaries are load-bearing there, sincevar_1is a prefix ofvar_10.seqgap detection. The Dashboard tracks two independentseqspaces (decomp-phase and naming-phase), drops duplicates, and stops accumulatingsource_deltaonce it sees a hole. The plugin ignoresseqentirely, so a dropped frame silently corrupts the streamed preview.StreamState.applyresets onevent.attempt > self.attemptfor every event. The Dashboard excludes the naming events anddecomp_failedfrom attempt tracking because they carry sentinel attempt numbers — if a sentinel is higher than the real attempt, the plugin clearssourceright beforenames_finished.decomp_finishedis correctly non-terminal in both — worth keeping that way; the spec is explicit that identifiers are rewritten after it.🤖 Generated with Claude Code