refactor: extract callModel, unify tool handlers, add sessionCompactor#2761
Open
dgageot wants to merge 4 commits into
Open
refactor: extract callModel, unify tool handlers, add sessionCompactor#2761dgageot wants to merge 4 commits into
dgageot wants to merge 4 commits into
Conversation
|
❌ PR Review Failed — The review agent encountered an error and could not complete the review. View logs. |
112cb2e to
448ca8a
Compare
…ndler Remove ToolHandlerFunc type and the per-batch adapter loop in processToolCalls. Built-in handlers (transfer_task, handoff, change_model, revert_model, run_skill) now match toolexec.ToolHandler directly and access events through r.toolSink, set for the duration of each processToolCalls call.
Move compactWithReason, compactIfNeeded, preCompactSourceFor, and joinPrompts into a sessionCompactor struct. The LocalRuntime holds a *sessionCompactor and delegates all compaction calls to it. This concentrates compaction reasoning (previously spread across runtime.go, loop.go, loop_steps.go, and session_compaction.go) in one place.
448ca8a to
b3e7935
Compare
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.
Three runtime refactors stacked on #2759 and #2760:
Extract callModel method — Pulls the before-hooks → transforms → LLM call → error handling → after-hooks pipeline out of
runTurninto a standalonecallModelmethod.Unify tool handler registration — Removes
ToolHandlerFunctype. Built-in handlers now matchtoolexec.ToolHandlerdirectly, eliminating the per-batch adapter loop inprocessToolCalls.sessionCompactor collaborator — Moves compaction logic (previously scattered across 4 files) into a self-contained
sessionCompactorstruct.Depends on #2759 and #2760. Pure refactor, no behaviour change.