Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(terminal): scope global terminal key per project#915

Open
jschwxrz wants to merge 1 commit intogeneralaction:main from
jschwxrz:emdash/fix-global-terminal-scope-44j
Open

fix(terminal): scope global terminal key per project #915
jschwxrz wants to merge 1 commit intogeneralaction:main from
jschwxrz:emdash/fix-global-terminal-scope-44j

Conversation

@jschwxrz
Copy link

@jschwxrz jschwxrz commented Feb 17, 2026

Issue:

The global terminal doesn't update its working directory when switching between projects. It stays stuck in the previous project's directory.

Fix:

Global terminal key now falls back to projectPath instead of a bare 'global' string, so switching projects gives each project its own global terminals.

fixes #909

greptile-apps[bot] reacted with thumbs up emoji
...ction defaults
Global terminal key now falls back to projectPath instead of a bare
'global' string, so switching projects gives each project its own global
terminals. Terminal selection logic now prefers task terminals when a
task is active and global terminals when no task is selected.
fixes generalaction#909 
Copy link

vercel bot commented Feb 17, 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.

Copy link

greptile-apps bot commented Feb 17, 2026

Greptile Summary

This PR fixes a bug where the global terminal stayed stuck in a previous project's working directory when switching between projects. The root cause was that the global terminal store key was a bare 'global' string, shared across all projects.

  • Global terminal key scoped per project: globalKey now uses `global::${projectPath}` instead of 'global' when no task is active, giving each project its own isolated global terminal instance.
  • Task-less selection guard: Added an early check that redirects stale task:: selections to global terminals when no task is present, preventing the UI from pointing at a now-invalid terminal.
  • Simplified fallback logic: The terminal fallback cascade now checks task presence before preferring worktree terminals, removing a redundant third branch that repeated the task-terminal check.

Confidence Score: 4/5

  • This PR is safe to merge — it's a focused, small fix in a single UI component with no backend or data changes.
  • The change is minimal (one file, ~20 lines net), logically sound, and addresses a clear bug. The projectPath is always defined by the time terminals render (guarded by the early return). The only minor concern is that globalKey could technically be "global::undefined" if projectPath is undefined and task?.path is falsy, but the early return guard on line 450 prevents terminal rendering in that case.
  • No files require special attention.

Important Files Changed

Filename Overview
src/renderer/components/TaskTerminalPanel.tsx Scopes global terminal key by projectPath to fix cross-project terminal stickiness; adds selection fallback guards for task-less views. Changes are clean and well-targeted.

Flowchart

flowchart TD
 A["TaskTerminalPanel renders"] --> B{"task.path exists?"}
 B -- Yes --> C["globalKey scoped to task path"]
 B -- No --> D["globalKey scoped to projectPath"]
 C --> E["useTaskTerminals with globalKey"]
 D --> E
 E --> F{"selectedValue valid?"}
 F -- "No selectedValue" --> G{"task exists?"}
 G -- Yes --> H["Select first task terminal"]
 G -- No --> I["Select first global terminal"]
 F -- "Has value" --> J{"No task but task mode?"}
 J -- Yes --> K["Redirect to global terminal"]
 J -- No --> L{"Terminal still exists?"}
 L -- Yes --> M["Keep current selection"]
 L -- No --> N{"task exists?"}
 N -- Yes --> H
 N -- No --> I
Loading

Last reviewed commit: 3084e62

Copy link
Contributor

Thank you for your contribution! I am not sure the global terminal switching between is desired behaviour. Let's discuss in #909

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[bug]: Global terminal doesn't change directory when switching between projects

Comments

AltStyle によって変換されたページ (->オリジナル) /