Repository navigation
fix(server): drop all superseded routed experts across multi-turn trajectories - #653
Open
Hardik K (hardikkaurani) wants to merge 1 commit into
Conversation
Author
|
Hi Zhiyuan He (@hzy46), could you please take a look at this PR when you have a moment? It fixes an issue where superseded route tensors in multi-turn trajectories could be retained due to an early return in |
This branch has not been deployed
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
In
_drop_superseded_routed_experts(agentlightning/server/routes/events.py), an unconditionalreturnstatement was located at the end of the backwards event loop. This caused the loop to terminate immediately upon inspecting the firstmodel_request:model_requestlackedrouted_experts(or did not extend context, e.g. an unrouted turn or alternate step), the function returned early without checking earlier ancestor turns that hadrouted_experts.routed_experts, only the immediately preceding turn was updated, leaving earlier turns with outdated route tensors.[]),prompt_ids[:len(previous_context)] == previous_contextcould evaluate toTrueeven when no prompt tokens were present.Changes
returninside the event iteration loop in_drop_superseded_routed_expertsso that all superseded ancestor turns in the mergeable trajectory have theirrouted_expertsdropped as intended.bool(prompt_ids)andbool(previous_context)) before comparing prompt and context prefix matches.tests/server/test_endpoints.pyverifying:include_routed_experts=Falsecorrectly excludes route tensors.