-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: prevent background agents from spawning recursive subagents via call_omo_agent #536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…call_omo_agent Add call_omo_agent: false to background agent tool restrictions to prevent recursive subagent spawning. This aligns with the existing restrictions for task and background_task tools and addresses issues introduced after the OpenCode 1.1.1 permission system changes. Fixes #535
Greptile SummaryAdded Key Changes:
Design Rationale: Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Main as Main Agent (Sisyphus)
participant BG as Background Agent (librarian/explore)
participant SubAgent as Recursive Subagent
Note over Main,BG: BEFORE FIX - Recursive spawning possible
Main->>BG: call_omo_agent (run_in_background: true)
activate BG
BG->>SubAgent: call_omo_agent (spawn another agent)
activate SubAgent
SubAgent->>SubAgent: call_omo_agent (spawn more...)
Note over SubAgent: Exponential cascade (800+ tasks)
deactivate SubAgent
deactivate BG
Note over Main,BG: AFTER FIX - Restriction applied
Main->>BG: call_omo_agent (run_in_background: true)
activate BG
Note over BG: call_omo_agent: false<br/>Cannot spawn subagents
BG->>BG: Use direct tools<br/>(context7, grep_app, gh, webfetch)
BG-->>Main: Task completed
deactivate BG
|
There was a problem hiding this 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 1 file
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
|
I approve this but sometimes I like calling heavy tasks as background_tasks, maybe we can make some users override this config with experimental flags? cc @code-yeongyu |
@sisyphus-dev-ai can you do this and open a new pr? ulw (Add to |
|
@sisyphus-dev-ai Quick confirm for this PR: under v1.1.1 spec, explore/librarian must NOT be able to invoke |
Confirmation@junhoyeo Confirmed! Here's the breakdown: ✅ Question 1: explore/librarian must NOT invoke
|
| Restriction Point | File | Line | Mode |
|---|---|---|---|
| Agent config | config-handler.ts | 240, 246 | All modes |
| PreToolUse hook | index.ts | 428 | All invocations |
| Sync execution | call-omo-agent/tools.ts | 144 | run_in_background: false |
| Background execution | manager.ts | 119 | run_in_background: true (This PR) |
This prevents the exponential cascade (800+ tasks) that was happening when agents spawned more agents recursively.
✅ Question 2: task/background execution can still invoke call_omo_agent
YES, correct. The restrictions only apply to explore/librarian agents themselves.
What still works:
- ✅ Main agent (Sisyphus) →
call_omo_agent(to spawn explore/librarian) - ✅ Main agent →
background_task(to run explore/librarian in background) - ✅ Other agents (oracle, frontend-ui-ux-engineer, etc.) →
call_omo_agent
What's blocked:
- ❌ explore/librarian agents →
call_omo_agent(recursive spawning) - ❌ explore/librarian agents →
background_task(also blocked) - ❌ multimodal-looker →
call_omo_agent(also blocked)
Design principle: Sisyphus orchestrates, workers execute directly using their tools (context7, grep_app, gh CLI, webfetch).
TL;DR: Your understanding is 100% correct. The PR completes the restriction pattern by adding the missing piece for background mode. 🎯
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
|
✅ Implemented! I've created PR #539 that adds the experimental flag you requested. What's NewAdded Configuration: {
"experimental": {
"allow_background_agent_subagents": false
}
}Default: When enabled ( Implementation Details
DocumentationIncluded WARNING in all README versions about potential exponential task cascades. Users who enable this know the risks and need the heavy parallel agent capabilities. |
Summary
call_omo_agent: falseto background agent tool restrictions inBackgroundManager.launch()taskandbackground_tasktoolsProblem
After OpenCode 1.1.1 breaking changes to the permission system, background agents were missing the
call_omo_agentrestriction. This allowed them to spawn explore/librarian subagents recursively, creating unwanted nesting:Solution
Added
call_omo_agent: falseto the tools restriction insrc/features/background-agent/manager.tsat line 119:This matches the pattern used in
src/tools/call-omo-agent/tools.tsfor sync mode execution.Testing
Fixes #535
Summary by cubic
Prevent background agents from spawning recursive subagents by disallowing call_omo_agent in BackgroundManager. Stops explore/librarian nesting and aligns with task/background_task restrictions; fixes #535.
Written for commit 3a701ce. Summary will update on new commits.