feat(desktop): mid-turn steer injection#3360
Conversation
d558c42 to
a9db29a
Compare
- Add Agent steerQueue + Steer/SteerConsumed/consumeSteer methods - Consume queued steer each loop iteration, persist to session, emit Steer event - Defer final-answer return while steer queue has items - Add event.Steer kind with wire mappings (desktop + serve) and tests - Add Controller.Steer/SteerConsumed delegation to executor - Add App.Steer/SteerForTab with per-tab routing - Add Steer/SteerForTab to frontend AppBindings, mock, and useController - Add runningRef + steer dispatch in App.tsx handleSend - Add MCPSurfaceReady gap-fix in wire mappings
a9db29a to
867debb
Compare
|
@SivanCola @esengine 大佬请审核下,已经根据1.5 rebase过 |
esengine
left a comment
There was a problem hiding this comment.
Reviewed end to end. The agent-side design is right: steers consume at the top of each loop iteration, persist to the session (so history replay keeps them), and the post-final-answer steerQueueLen() > 0 → continue covers the race where guidance arrives as the model finishes. The controller fallback — converting to a fresh turn when the frontend's runningRef was stale — closes the other race. Bonus points for catching the unmapped MCPSurfaceReady wire name and extending the completeness test bound to Steer.
One note: the PR description still mentions the tool-result pairing alignment, but that part is no longer in the diff after the rebase (main-v2's historyMessagesToItems is untouched here) — the landed scope is steer only, which is fine by me.
Cache cost is one miss per steer and the comment says so explicitly — acceptable for an explicit user action. An agent-level test for queue→inject→event would be a nice follow-up, but the wire tests cover the contract that bit us before. Merging, thanks!
Summary
SteerForTab).historyMessagesToItemstool-result lookup withSanitizeToolPairing's turn-scoped pairing: position-aware scan instead of a session-global Map to avoid cross-turn ID collisions with synthesizedcall_%dIDs.Changes
Steer (#3263)
internal/event/event.go:Steerevent kindinternal/agent/agent.go:steerQueue+ Run-loop injection + persistenceinternal/control/controller.go:Steer/SteerConsumeddesktop/app.go:App.Steer/App.SteerForTabdesktop/wire.go+internal/serve/wire.gowith testsrunningRef+ steer dispatch inhandleSendTool-result pairing alignment (#3286)
useController.ts: globalresultByIDMap →collectToolResultsAfterinternal/serve/index.html: sameRelated
Closes #3263