Skip to content

Conversation

@sisyphus-dev-ai
Copy link
Collaborator

@sisyphus-dev-ai sisyphus-dev-ai commented Jan 6, 2026

Summary

Adds allow_background_agent_subagents experimental flag to enable users to opt-in to recursive background agent spawning via call_omo_agent.

This addresses the use case mentioned in #536 where some users want to call heavy tasks as background_tasks with full agent orchestration capabilities, despite the risk of exponential task cascades (800+ tasks).

Changes

  • ✅ Add allow_background_agent_subagents flag to ExperimentalConfigSchema (src/config/schema.ts)
  • ✅ Update BackgroundManager constructor to accept ExperimentalConfig parameter
  • ✅ Update BackgroundManager.launch() to conditionally apply call_omo_agent restriction based on flag
  • ✅ Pass experimental config from main plugin to BackgroundManager (src/index.ts)
  • ✅ Update all 4 language versions of README with flag documentation:
    • README.md (English)
    • README.ko.md (Korean)
    • README.ja.md (Japanese)
    • README.zh-cn.md (Chinese)
  • ✅ Regenerate JSON schema (assets/oh-my-opencode.schema.json)

Configuration

{
  "experimental": {
    "allow_background_agent_subagents": false
  }
}

Default: false (safe default - prevents recursive spawning)

When enabled: Background agents can call call_omo_agent to spawn subagents recursively.

WARNING: May cause exponential task cascades (800+ tasks). Only enable if you need heavy parallel agent orchestration.

Testing

  • ✅ All 621 tests pass
  • ✅ TypeScript compilation successful
  • ✅ JSON schema regenerated successfully

Related

Closes #536

cc @junhoyeo @code-yeongyu


Summary by cubic

Adds an experimental flag to let background agents spawn subagents via call_omo_agent. Default is off to prevent runaway task cascades; opt-in for heavy parallel orchestration.

  • New Features

    • Added allow_background_agent_subagents to ExperimentalConfigSchema.
    • BackgroundManager now takes experimental config and conditionally allows call_omo_agent.
    • Passed experimental config from the main plugin to BackgroundManager.
    • Updated README (EN/KO/JA/ZH) and regenerated JSON schema.
  • Migration

    • To enable: set experimental.allow_background_agent_subagents to true in config.

Written for commit 05ad2a4. Summary will update on new commits.

Adds 'allow_background_agent_subagents' experimental flag to enable
users to opt-in to recursive background agent spawning via call_omo_agent.

This addresses the use case mentioned in #536 where some users want to
call heavy tasks as background_tasks with full agent orchestration
capabilities, despite the risk of exponential task cascades (800+ tasks).

Changes:
- Add allow_background_agent_subagents flag to ExperimentalConfigSchema
- Update BackgroundManager to accept and respect experimental config
- Conditionally apply call_omo_agent restriction based on flag
- Update all 4 language versions of README with flag documentation
- Regenerate JSON schema

Related: #536
@greptile-apps
Copy link

greptile-apps bot commented Jan 6, 2026

Greptile Summary

Adds opt-in allow_background_agent_subagents experimental flag to enable recursive background agent spawning via call_omo_agent, addressing use cases requiring heavy parallel agent orchestration.

Key changes:

  • Added allow_background_agent_subagents boolean flag to ExperimentalConfigSchema with safe default (false)
  • Updated BackgroundManager to accept and store ExperimentalConfig parameter
  • Conditionally restricts call_omo_agent tool based on flag value in BackgroundManager.launch()
  • Passed experimental config from main plugin to BackgroundManager constructor
  • Updated all 4 language versions of README with comprehensive documentation and warnings
  • Regenerated JSON schema with new experimental flag

Implementation:
The flag defaults to false, preventing recursive subagent spawning by restricting call_omo_agent (matching existing task and background_task restrictions). When enabled, background agents can spawn explore/librarian subagents, enabling complex orchestration but risking exponential task cascades. Clear warnings included in all documentation.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Clean implementation with safe defaults, comprehensive documentation, all tests passing (621), proper TypeScript typing, correct schema regeneration, and consistent updates across all 4 language READMEs. The feature is opt-in with clear warnings about potential risks.
  • No files require special attention

Important Files Changed

Filename Overview
src/config/schema.ts Added allow_background_agent_subagents experimental flag with clear documentation
src/features/background-agent/manager.ts Conditionally restricts call_omo_agent based on experimental flag, with safe default behavior
src/index.ts Passes experimental config to BackgroundManager constructor
assets/oh-my-opencode.schema.json JSON schema correctly regenerated with new experimental flag

Sequence Diagram

sequenceDiagram
    participant User
    participant Plugin as Plugin (index.ts)
    participant BM as BackgroundManager
    participant Session as OpenCode Session
    participant Agent as Background Agent

    User->>Plugin: Launch with experimental config
    Plugin->>BM: new BackgroundManager(ctx, experimental)
    Note over BM: Store experimental config

    User->>BM: launch(input)
    BM->>BM: Check allow_background_agent_subagents flag
    
    alt allow_background_agent_subagents = false (default)
        BM->>BM: Set toolRestrictions = {task: false, background_task: false, call_omo_agent: false}
        Note over BM: Safe mode: prevents recursive spawning
    else allow_background_agent_subagents = true
        BM->>BM: Set toolRestrictions = {task: false, background_task: false}
        Note over BM: Risky mode: allows call_omo_agent
    end

    BM->>Session: promptAsync(agent, tools: toolRestrictions, prompt)
    Session->>Agent: Execute with restricted tools
    
    alt call_omo_agent restricted
        Agent->>Agent: Cannot spawn subagents
        Note over Agent: Safe: no recursive spawning
    else call_omo_agent allowed
        Agent->>Session: Can call call_omo_agent
        Session->>Agent: Spawn explore/librarian subagents
        Note over Agent: Warning: potential task cascade
    end

    Agent-->>BM: Task complete
    BM-->>User: Return result
Loading

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 8 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@junhoyeo
Copy link
Collaborator

junhoyeo commented Jan 6, 2026

hmm actually not yet

@junhoyeo junhoyeo closed this Jan 6, 2026
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.

3 participants