Skip to content

Background agents ignore initial prompt - stuck until manually messaged #21211

@shrijit37

Description

@shrijit37

Bug Description

Background agents launched with run_in_background=true ignore their initial prompt and wait indefinitely until manually messaged via session_id.

Steps to Reproduce

  1. Launch a background agent with a prompt:
task(
  run_in_background=true,
  subagent_type="explore",
  prompt="List files in /tmp"
)
  1. Wait for agent completion (it will never complete on its own)

  2. Notice the agent shows status "running" but produces no output

  3. Only when sending a continuation message via session_id does the agent actually work:

task(
  session_id="ses_xxx",
  prompt="Execute your task now"
)

Expected Behavior

  • Agent should process the initial prompt immediately upon launch
  • No manual continuation message should be required

Actual Behavior

  • Agent launches, shows "running" status
  • Never processes initial prompt
  • Stays stuck until explicitly messaged again

Workaround

Use run_in_background=false for synchronous execution, which works correctly.

Environment

  • OpenCode Desktop app (macOS)
  • Model: opencode/big-pickle (parent), nvidia/gemma-4-31b-it (subagent)

Additional Context

This makes background agents unusable for parallel workloads as they effectively become synchronous anyway.

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

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