Repository navigation
fix(session): publish the operator's prompt as the turn starts - #663
Merged
Merged
Conversation
In supervised mode the conversation is painted from the actor's snapshot, and the actor published nothing between appending the operator's message and the turn's closing refresh. The transcript therefore lagged a whole turn: the answer streamed in with no question above it, and the message only appeared once the response landed. Publish the snapshot as soon as the session records the prompt, matching what ResolveQuestion, SetModel and Refresh already do. Regression test: crates/forge-tui/src/app/tests/multi_task.rs holds the model on a gate and requires the operator's message on screen while no assistant message exists yet.
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.
Problem
In supervised (repository multi-session) mode the TUI holds no direct session handle, so the conversation is painted from the actor's published snapshot.
run_one_innerappended the operator's prompt to the session but published nothing until the turn's closingrefresh_actor.The transcript therefore lagged a whole turn: the reply streamed in with no question above it, and the operator's own message only appeared once the response landed.
The direct single-session path already paints the
YOUmessage immediately (drain_pending_prompt_with_terminal), so this was supervised-only.Fix
crates/forge-session/src/supervisor.rs: publish the snapshot as soon as the session records the prompt, before the model is asked anything. This is the same patternResolveQuestion,SetModeland theRefreshcommand already use, and callingrefresh_actorwhile holding the session lock is already precedented byRefresh.Queued prompts are unaffected: while a session is busy the prompt is shown from
queued_prompts, and the new publish fires when the driver claims it and records it.Test
the_operator_message_shows_before_the_answer_landsincrates/forge-tui/src/app/tests/multi_task.rs: a gate holds the model open, and the test requires the operator's message in the transcript (and in the rendered frame) while the turn isRunningand no assistant message exists yet.timed out waiting for 1 user messages (got 0)Validation
cargo test --package forge-session --locked: 70 passed, 1 pre-existing failure (primary_and_managed_actors_share_hitl_question_and_continue_commandsneeds a workingsandbox-exec, which this environment refuses; it fails identically without this change)cargo test --package forge-tui --locked app::tests: 421 passed, 4 pre-existing failures, allsandbox-exec: sandbox_apply: Operation not permittedon the direct-pathbash/background-tool testscargo fmt --all -- --checkcleancargo clippy --package forge-session --package forge-tui --all-targets --locked -- -D warningsclean