Skip to content

Conversation

@michaelneale
Copy link
Collaborator

@michaelneale michaelneale commented Nov 23, 2025

Building on: #5847

Some small tweaks, naming session, aliases, and more. Doens't use session DB to catch up on missed terminal entries keeping things cleanerl

Also - you can use gt type anything you want - no quotes necessary.
also just type in any command you want and it will send it to goose

This also doesn't use changes to schema or session manager - an alternative approach.

baxen and others added 8 commits November 22, 2025 12:18
Term command is a new way to use goose without the builtin REPL
- instead the session is tied right into your terminal
- Fix bash/zsh: properly quote goose binary path to handle spaces
- Extract session creation logic to ensure_terminal_session helper
- Reduces code duplication between handle_term_log and handle_term_run
@michaelneale
Copy link
Collaborator Author

some small enhancements: #5852 will take a look at other feedback

@michaelneale michaelneale marked this pull request as ready for review November 23, 2025 23:46
Copilot AI review requested due to automatic review settings November 23, 2025 23:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the terminal integration feature by making terminal sessions less visible (using SessionType::Hidden), simplifying command syntax to not require quotes, and adding an optional command-not-found handler for bash/zsh shells.

  • Changed terminal sessions from SessionType::User to SessionType::Hidden so they don't appear in session lists
  • Updated goose term run to accept multiple arguments without quotes (e.g., gt list files instead of gt "list files")
  • Added --with-command-not-found flag to goose term init for bash/zsh that automatically sends unknown commands to goose

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
crates/goose-cli/src/commands/term.rs Changed session type to Hidden, added command_not_found_handler for bash/zsh, updated prompt parameter to accept Vec and join with spaces, added zsh prompt indicator
crates/goose-cli/src/cli.rs Removed non_empty_string validator, updated Run command to accept multiple arguments, added with_command_not_found CLI flag, updated help text and examples

@michaelneale michaelneale changed the title Term mic nit: enhancing new term feature Nov 23, 2025
@michaelneale michaelneale requested a review from a team as a code owner November 24, 2025 00:54
@michaelneale michaelneale changed the base branch from baxen/term to main November 24, 2025 00:56
@github-actions
Copy link
Contributor

github-actions bot commented Nov 24, 2025

PR Preview Action v1.6.0
Preview removed because the pull request was closed.
2025-11-27 01:06 UTC

Copy link
Contributor

@blackgirlbytes blackgirlbytes left a comment

Choose a reason for hiding this comment

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

good on the docs side. approving so i dont block you

Copy link
Collaborator

@DOsinga DOsinga left a comment

Choose a reason for hiding this comment

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

I like this better. not entirely sure why we need the json file though, or is that just as an extra way to override the session ids? something something projects

@michaelneale
Copy link
Collaborator Author

@DOsinga

{
  "terminal_sessions": {
    "/Users/micn/Development/goose": "20251124_2",
    "/Users/micn/Documents/code/goose": "20251124_3"
  }
}
``` yeah it just glues it to session id. 

Copilot AI review requested due to automatic review settings November 25, 2025 04:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

@michaelneale michaelneale changed the title nit: enhancing new term feature feat: enhancing new terminal feature Nov 25, 2025
Copilot AI review requested due to automatic review settings November 25, 2025 06:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 7 comments.

@michaelneale
Copy link
Collaborator Author

@DOsinga @baxen how is this looking?

I note that gt is often used by graphite (a growing popular tool) so I augmented it with "@goose" or "@g" which felt more natural. This is functionally equivalent otherwise, but doesn't change what is in the session.

Copilot AI review requested due to automatic review settings November 25, 2025 07:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.

Comment on lines +28 to +33
SessionManager::update_session(&session.id)
.user_provided_name(session_name)
.apply()
.await?;

Ok(session.id)
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

Lines 24-26 call create_session with session_name, then lines 28-31 immediately call update_session to set the same session_name via user_provided_name. This appears redundant - verify if create_session already sets the user_provided_name field from the session_name parameter, or if this update is actually necessary.

Suggested change
SessionManager::update_session(&session.id)
.user_provided_name(session_name)
.apply()
.await?;
Ok(session.id)
Ok(session.id)

Copilot uses AI. Check for mistakes.
Comment on lines +41 to +43
let goose_bin = std::env::current_exe()
.map(|p| p.to_string_lossy().into_owned())
.unwrap_or_else(|_| "goose".to_string());
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

The goose_bin path is interpolated into shell scripts without proper escaping. If the executable path contains spaces or special shell metacharacters, the generated shell initialization scripts will be malformed or could be exploited. Consider using shell-safe escaping for the path before interpolation, or wrap it in quotes with proper escaping.

Copilot uses AI. Check for mistakes.
Comment on lines +5 to +6

The `goose term` commands let you talk to goose directly from your shell prompt. Instead of switching to a separate REPL session, you stay in your terminal and call goose when you need it.
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

The documentation doesn't mention the gt alias that is created by the shell initialization scripts. Consider adding this to the documentation since the PR description specifically mentions this feature ("you can use gt type anything you want"). The missing documentation could confuse users who see this alias but don't know what it does.

Copilot uses AI. Check for mistakes.
Comment on lines +181 to +195
fn read_and_clear_shell_history(session_id: &str) -> Result<Vec<String>> {
let path = shell_history_path(session_id)?;

if !path.exists() {
return Ok(Vec::new());
}

let content = fs::read_to_string(&path)?;
let commands: Vec<String> = content
.lines()
.filter(|line| !line.trim().is_empty())
.map(|s| s.to_string())
.collect();

fs::write(&path, "")?;
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

Potential race condition: read_and_clear_shell_history performs a non-atomic read-then-write operation. If multiple @goose commands run concurrently, commands could be lost between the read and clear operations. Consider using file locking or atomic operations to ensure commands aren't dropped.

Copilot uses AI. Check for mistakes.
@michaelneale
Copy link
Collaborator Author

work has shifted over here: #5887

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.

5 participants