Repository navigation
fix: clean up deduplicate_levers.py — post PR #203 review fixes - #206
Merged
Merged
Conversation
- Fix broken USER→ASSISTANT alternation when default keep is used - Extract closure to module-level _call_llm with functools.partial - Use dict lookup for decisions instead of O(n²) loop - Remove redundant DeduplicationAnalysis wrapper class - Remove stale PROBLEM docstring (already fixed in PR #203) - Rename reused `decision` variable to `lever_decision` in output loop Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…lity functools.partial objects don't support typing.get_type_hints(), which LLMExecutor._validate_execute_function() calls. This caused every LLM call to raise TypeError, silently caught by the retry logic, resulting in all levers defaulting to "keep" with no actual deduplication. Fix: use a closure defined once before the loop that delegates to _call_llm. The closure captures chat_message_list by variable reference, so rebinding after compaction is visible without redefining the function. Co-Authored-By: Claude Opus 4.6 <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.
Summary
keepdecision now appends a synthetic ASSISTANT message, preventing USER→USER sequences that break strict LLM APIs_call_llmdefined once at module level; loop usesfunctools.partialto bindchat_message_listdecisions_by_iddict for output assemblyDeduplicationAnalysiswrapper: Class only used internally;responseis nowList[LeverDecision]directlyPROBLEM:block described a bug already fixed in PR fix: DeduplicateLeversTask — per-lever decomposition, growing conversation, compact fallback #203lever_decisionto avoid shadowing the per-leverdecision(different types)Follows up on PR #203 code review. The Enum/Literal parity issue was already fixed in PR #205.
Test plan
pytest worker_plan/worker_plan_internal/tests/test_enum_literal_parity.py -v— all 14 tests passpy_compilesyntax check passes🤖 Generated with Claude Code