Analysis of Issue #776
Summary
The --no-extensions flag doesn't prevent extension discovery. Extensions from ~/.pi/agent/extensions/ and .pi/extensions/ are still loaded despite the flag.
Root Cause Analysis (Verified)
The issue's root cause analysis is correct.
Code path:
- main.ts lines 291-293 - In
buildSessionOptions():
-
When --no-extensions is used, extensionsResult.extensions is an empty array [], so:
extensionsResult.extensions.length > 0 → false
preloadedExtensions is not set on the options object
-
sdk.ts lines 274-289 - In createAgentSession():
- Since
preloadedExtensions is undefined, the SDK falls through to the else branch and rediscovers extensions.
Proposed Fix
File: packages/coding-agent/src/main.ts
Change: Remove the .length > 0 condition:
This ensures the empty extensionsResult is passed through, signaling to createAgentSession() that extension loading was already handled (and resulted in zero extensions).