docs_summarizer.iterate_with_tools method refactoring#2803
docs_summarizer.iterate_with_tools method refactoring#2803blublinsky wants to merge 1 commit intoopenshift:mainfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
contains the same regression as per this comment /hold |
|
|
@blublinsky sorry, forgot to pass the link: #2783 (comment) Upon further inspection, the enrichment regression point is partially invalid - my apologies. The PR replaces Timeout - the old code wraps the entire iterate_with_tools body in timeout. The PR moves the timeout to _collect_round_llm_chunks only, leaving execute_tool_calls unprotected. Deleted test coverage for metadata behavior. I'd still suggest splitting this up for exactly the reasons above. A refactoring PR shouldn't change end behavior - it should be trivial to confirm that inputs and outputs stay the same. Mixing in timeout changes, new duplicate-tool detection, MIN_TOOL_EXECUTION_TOKENS budget skipping, the ChunkType enum, and the eager build_mcp_config in init makes that confirmation much harder than it needs to be. |
180a7ec to
670cb90
Compare
Fixed |
|
Can you try to ask Cursor "split these changes so it will be easier to review"? And let it raise different PRs - we have a skill for that in this repo. |
Sorry. I have wasted soooooo much time keeping everything in sync. Can we please finally merge this - after more than 2 weeks and move on |
|
Then you are a better reviewer than I am. I can't confidentelly ack these changes. |
670cb90 to
7f98fab
Compare
|
/retest |
1 similar comment
|
/retest |
|
/test e2e-ols-cluster |
|
@blublinsky: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
/retest |
| # Phase 2: resolve and execute tool calls for this round. | ||
| tool_token_usage = ToolTokenUsage(used=tool_tokens_used) | ||
| try: | ||
| async with asyncio.timeout(constants.TOOL_CALL_ROUND_TIMEOUT): |
There was a problem hiding this comment.
@blublinsky - tool_call_round_timeout can run twice as long now (worst case), because invoke_llm also using it . How do you plan to manage this ?
Description
Refactoring of
iterate_with_toolsindocs_summarizer.pyto prepare for tools approval support. This splits the existing monolithic method into several smaller, focused helpers while preserving all observable behavior.Changes
_collect_round_llm_chunks– collects one round of LLM streaming chunks_resolve_tool_call_definitions– maps LLM tool calls to executableStructuredToolinstances with duplicate-name detection_tool_result_chunk_for_message– converts aToolMessageinto a streamedtool_resultchunk with metadata enrichment_process_tool_calls_for_round– orchestrates tool execution, approval event forwarding, and result streaming for one round_enrich_with_tool_metadata– static helper that addsserver_nameandtool_metafrom MCP metadata to tool_call/tool_result eventsOther changes in this PR
ChunkTypeenum and updateStreamedChunkand streaming endpoint to use itType of change
Related Tickets & Documents
Checklist before requesting a review
Testing