Skip to content

fix: focus agent cli after task creation#1222

Merged
arnestrickmann merged 1 commit intogeneralaction:mainfrom
jschwxrz:emdash/fix-focus-agent-after-task-creation-7gk
Mar 2, 2026
Merged

fix: focus agent cli after task creation#1222
arnestrickmann merged 1 commit intogeneralaction:mainfrom
jschwxrz:emdash/fix-focus-agent-after-task-creation-7gk

Conversation

@jschwxrz
Copy link
Collaborator

@jschwxrz jschwxrz commented Mar 2, 2026

summary:

  • after creating a new task, the agent cli terminal was not focused
  • the auto-focus useEffect in ChatInterface fired before conversationsLoaded was true

fix:

  • added conversationsLoaded to the dependency array of terminal focus useEffect
  • added early return guard so the effect skips when conversations haven't loaded yet

fixes #1221

@vercel
Copy link

vercel bot commented Mar 2, 2026

@jschwxrz is attempting to deploy a commit to the General Action Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 2, 2026

Greptile Summary

Fixed terminal focus issue when creating new tasks by ensuring the auto-focus effect waits for conversations to load before attempting to focus the terminal.

  • Added early return guard to skip focus attempt when conversationsLoaded is false
  • Added conversationsLoaded to dependency array to trigger focus when conversations finish loading
  • Prevents race condition where focus was attempted before TerminalPane was rendered (TerminalPane is conditionally rendered based on conversationsLoaded)

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Clean, minimal bug fix that properly addresses a timing issue by adding a standard React hook dependency and guard clause. The fix aligns with existing patterns in the codebase (TerminalPane already uses conversationsLoaded as a render guard). No side effects or breaking changes.
  • No files require special attention

Important Files Changed

Filename Overview
src/renderer/components/ChatInterface.tsx Added conversationsLoaded guard to terminal auto-focus effect to prevent focus attempts before TerminalPane renders

Last reviewed commit: d6b6260

Copy link
Contributor

@yashdev9274 yashdev9274 left a comment

Choose a reason for hiding this comment

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

hey @jschwxrz i've tested this but focus still goes to chat/agent instead of terminal.
It seems the terminal focus code runs, but something else (may be another useEffect or chat autoFocus) overwrites it afterward.

if you may, please investigate:

  1. Search for other .focus() calls in ChatInterface.tsx
  2. Check if chat input has autoFocus that triggers after
  3. Consider adding terminal focus as the FINAL focus action (after all other effects settle)

@arnestrickmann arnestrickmann merged commit c28baff into generalaction:main Mar 2, 2026
3 of 4 checks passed
@jschwxrz jschwxrz deleted the emdash/fix-focus-agent-after-task-creation-7gk branch March 3, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug]: agent cli not focused after task creation

3 participants