Skip to content

feat(desktop): mid-turn steer injection#3360

Merged
esengine merged 1 commit into
esengine:main-v2from
JesonChou:fix/mid-turn-steer
Jun 11, 2026
Merged

feat(desktop): mid-turn steer injection#3360
esengine merged 1 commit into
esengine:main-v2from
JesonChou:fix/mid-turn-steer

Conversation

@JesonChou

Copy link
Copy Markdown
Contributor

Summary

  • Implement mid-turn steer injection with tab-scoped routing, addressing reviewer feedback from feat(desktop): mid-turn steer injection and tool-call details in history #3263 (wire mappings + SteerForTab).
  • Align historyMessagesToItems tool-result lookup with SanitizeToolPairing's turn-scoped pairing: position-aware scan instead of a session-global Map to avoid cross-turn ID collisions with synthesized call_%d IDs.

Changes

Steer (#3263)

  • internal/event/event.go: Steer event kind
  • internal/agent/agent.go: steerQueue + Run-loop injection + persistence
  • internal/control/controller.go: Steer/SteerConsumed
  • desktop/app.go: App.Steer/App.SteerForTab
  • Wire mappings in desktop/wire.go + internal/serve/wire.go with tests
  • Frontend: bindings, runningRef + steer dispatch in handleSend

Tool-result pairing alignment (#3286)

  • useController.ts: global resultByID Map → collectToolResultsAfter
  • internal/serve/index.html: same

Related

Closes #3263

@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) agent Core agent loop (internal/agent, internal/control) and removed v2 Go rewrite (1.x) — main-v2 branch, active development labels Jun 6, 2026
@JesonChou JesonChou changed the title feat(desktop): mid-turn steer injection and fix cross-turn tool-result pairing feat(desktop): mid-turn steer injection Jun 6, 2026
@github-actions github-actions Bot added the v2 Go rewrite (1.x) — main-v2 branch, active development label Jun 6, 2026
@JesonChou JesonChou changed the title feat(desktop): mid-turn steer injection fix(desktop): mid-turn steer injection Jun 6, 2026
@JesonChou JesonChou changed the title fix(desktop): mid-turn steer injection feat(desktop): mid-turn steer injection Jun 7, 2026
@JesonChou JesonChou force-pushed the fix/mid-turn-steer branch from d558c42 to a9db29a Compare June 9, 2026 15:04
- 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
@JesonChou JesonChou force-pushed the fix/mid-turn-steer branch from a9db29a to 867debb Compare June 10, 2026 11:27
@JesonChou

JesonChou commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

@SivanCola @esengine 大佬请审核下,已经根据1.5 rebase过

@esengine esengine left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@esengine esengine merged commit c8f2a3b into esengine:main-v2 Jun 11, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Core agent loop (internal/agent, internal/control) desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants