Repository navigation
Let a running parent take a sub-agent's result without a reload - #302
Merged
Merged
Conversation
Delivering a background sub-agent's result waits until its spawn_agent call is stored, and looked for the call in the session instance. A running agent stores to persistence only, so the instance knew of the call only after something reloaded it, such as a view loading the session. Until then delivery kept retrying, and the result reached the session only after the run ended, as a new turn. Look in persistence when the instance doesn't know the call. This also fixes a flaky test, which failed the release run 41593054062. It released the parent as soon as the agent showed as queued, which happens just before the result is: the parent could end its run, the result then started a turn, and that turn's provider waited forever. It now releases the child once the parent is at its gate and the parent once the result is queued. Its waits also ran out under load, so they get 30 s instead of 5 s.
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.
The release run 41593054062 failed on
a_queued_result_stays_listed_until_the_parent_takes_it, which also failed in two earlier Build runs. Looking into it turned up a bug in the code under test as well.The bug
Delivering a background sub-agent's result waits until its
spawn_agentcall is stored, and checkedinstance.session. A running agent writes to persistence only, so the instance learned of the call only when something reloaded it, such as a view loading the session. Until then delivery retried every 200 ms, and the result arrived only after the run ended, as a new turn, while the UI already showed "Result queued". Results were late, not lost.SessionManager::is_tool_call_storednow reads persistence when the instance doesn't know the call. A failed read counts as not stored, so the next attempt reads again.The test
GatedProviderwaited forever. It now releases the child once the parent is at its gate, and the parent once the result is in the queue.The CI log doesn't show which wait ran out, so what exactly failed the release run is not established. Both candidates are addressed.
Checks
load_sessionfails without the fix and passes with it.cargo test -p code_assistant_core,cargo fmt --checkand clippy forcode_assistant_corepass.Left as is
"Result queued" still shows just before the result is queued, because
mark_result_queuedruns beforesink.finished. The window is now normally very short and only affects the display.