Skip to content

Conversation

@github-actions
Copy link
Contributor

Closes #6236

Summary

Issue #6236 Fix Summary

Problem

When calling Goose CLI with session resume (-r flag) from a Python subprocess (non-interactive mode), the CLI panicked with:

thread 'main' panicked at crates/goose-cli/src/session/builder.rs:387:33:
Failed to get user input: Kind(NotConnected)

This occurred because cliclack::confirm().interact() tries to read from stdin, which is not connected when running in a subprocess.

Root Cause

The build_session() function in builder.rs had two locations that used cliclack::confirm() without checking if the session is interactive:

  1. A prompt asking whether to change back to the original working directory when resuming a session
  2. A prompt in check_missing_extensions_or_exit() asking about missing extensions

Solution

Modified crates/goose-cli/src/session/builder.rs to skip interactive prompts when session_config.interactive is false:

Change 1: Working directory prompt (line ~405)

Added && session_config.interactive to the condition so the prompt is only shown when running interactively. When non-interactive, the CLI stays in the current working directory.

Change 2: Missing extensions prompt (function check_missing_extensions_or_exit)

Added an interactive: bool parameter to the function. When non-interactive, the prompt is skipped and the session continues with whatever extensions are available.

Change 3: Updated call site

Updated the call to check_missing_extensions_or_exit() to pass session_config.interactive.

Behavior After Fix

  • Interactive mode: Unchanged - prompts still appear as before
  • Non-interactive mode (subprocess):
    • Working directory: Stays in current directory (no prompt)
    • Missing extensions: Silently continues (no prompt)
    • No panics from stdin being disconnected

Files Changed

  • crates/goose-cli/src/session/builder.rs

Verification

  • cargo check - PASSED
  • cargo fmt - PASSED
  • ./scripts/clippy-lint.sh - PASSED

Generated by goose Issue Solver

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error when calling Goose CLI with session resume from Python subprocess

2 participants