-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[FEATURE]: Unify shell initialization behavior between user shell and agent bash tool #17792
Copy link
Copy link
Open
Labels
coreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)discussionUsed for feature requests, proposals, ideas, etc. Open discussionUsed for feature requests, proposals, ideas, etc. Open discussion
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Summary
There is an inconsistency between the user-invoked shell (!) and the agent bash tool.
At the moment:
- the user
!shell loads shell init files such as~/.bashrc - the agent
bashtool does not
As a result, the same command can work in the user shell but fail in the agent shell because functions, aliases, exports, or PATH changes from shell init are only available in one path.
Reproduction
Example ~/.bashrc:
myfunc() {
echo ok
}
export -f myfuncThen compare:
- Run
myfuncthrough the user shell (!) - Run the equivalent command through the agent
bashtool
Actual behavior
- User
!shell can access definitions and environment initialized by shell startup files - Agent
bashtool cannot
Expected behavior
These two shell execution paths should behave consistently.
Possible acceptable outcomes:
- both load shell init files in the same way, or
- both avoid loading shell init files, or
- a config/flag makes the behavior explicit and shared between both paths
Notes
The current implementation appears to use different logic for these paths:
packages/opencode/src/session/prompt.ts
user shell path explicitly sources shell init files for some shellspackages/opencode/src/tool/bash.ts
agent bash tool usesspawn(..., { shell })without equivalent shell init loading
This creates surprising differences between manual shell usage and agent-executed shell commands.
Request
Please unify the shell initialization logic between:
- user
!shell - agent
bashtool
If exact unification is not desired, please provide a documented configuration option that controls shell init behavior consistently for both paths.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
coreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)discussionUsed for feature requests, proposals, ideas, etc. Open discussionUsed for feature requests, proposals, ideas, etc. Open discussion
Type
Fields
Give feedbackNo fields configured for issues without a type.