Skip to content

Interactive shell backgrounding can fail due to missing sessionId #25111

@jasonmatthewsuhari

Description

@jasonmatthewsuhari

Interactive shell backgrounding fails with "Session ID is required for background operations"

What happened

While exercising current main, I reproduced a failure when backgrounding a shell execution through the same runtime path used by the interactive UI.

I used the built origin/main code in a clean worktree (5fc8fea8d762d67d3bff14d00307138faff0bca5) and ran a real shell command via ShellExecutionService.execute(...) using the same shape the interactive UI builds in useExecutionLifecycle:

  • start from config.getShellExecutionConfig()
  • override terminalWidth, terminalHeight, defaultFg, defaultBg
  • do not add sessionId

Then I called ShellExecutionService.background(pid) the same way the interactive UI does.

Observed output:

pid 16508
sessionIdInConfig null
background_error Session ID is required for background operations

Expected

Backgrounding an interactive shell execution should succeed and register the task normally.

Actual

It throws:

Session ID is required for background operations

Why this matters

The model-driven shell path appears to pass a sessionId explicitly, but the interactive UI path does not. That makes this look like a UI-specific regression rather than a generic shell backgrounding problem.

Likely area

  • packages/cli/src/ui/hooks/useExecutionLifecycle.ts
  • packages/core/src/services/shellExecutionService.ts

The interactive UI path appears to call ShellExecutionService.execute(...) without a sessionId, then later calls ShellExecutionService.background(pid).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/coreIssues related to User Interface, OS Support, Core Functionalitypriority/p1Important and should be addressed in the near term.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions