[Bug] Background subagent tool calls exposed in parent context window

Resolved 💬 10 comments Opened Dec 16, 2025 by woweow Closed Apr 25, 2026

Bug Description
Backgrounding subagents exposes their tool calls to the parent agent. This destroys the concept of an isolated context window. Run the following prompt and you'll see what I mean. The tool log is exposed in the getOutput call the parent makes

# Subagent Context Isolation Test

This script tests whether subagents properly hide their internal operations from the parent context.

## Test: Can subagents hide secrets from the coordinating agent?

Run this prompt sequence:

---

### Foreground Agent Test

`Please think of a secret message (something creative and fun).
Write this secret message to the file: /tmp/foreground_secret.txt

When you're done writing the secret to the file, simply respond with "DONE".
Do NOT tell me what the secret is.`

**Agent Type:** general-purpose
**Run Mode:** Foreground (default)

---

### Background Agent Test

`Please think of a secret message (something creative and fun).
Write this secret message to the file: /tmp/background_secret.txt

When you're done writing the secret to the file, simply respond with "DONE".
Do NOT tell me what the secret is.`

**Agent Type:** general-purpose
**Run Mode:** Background
**Then call TaskOutput to retrieve results**

---

## Analysis

After running both tests, check:

1. **Foreground result:** From the output you received, can you figure out what their secret message was? (without reading the file)
2. **Background result:** When you retrieve TaskOutput, are tool logs visible showing the secret content?
3. **Context Isolation test:** Can you (the coordinating agent) determine what the secret is from:
   - The agent's response text
   - Tool call logs in the output
   - Any other information leaked

If the architecture works as documented, the secrets should be completely hidden - you should have NO way to know what they wrote without actually reading the files yourself.

---

## Expected Behavior (Per Docs)

- ✅ Subagent context is isolated
- ✅ Only final results returned to parent
- ✅ Tool call details should NOT leak to parent
- ✅ File contents written by subagent should NOT be visible in parent context

## Actual Behavior (Testing)

Document what you actually observe versus the expected behavior.

Environment Info

  • Platform: darwin
  • Terminal: iTerm.app
  • Version: 2.0.70
  • Feedback ID:

Errors

[]

View original on GitHub ↗

This issue has 10 comments on GitHub. Read the full discussion on GitHub ↗