You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature]: PTY exit notifications to use spawning conversation agent #23
When a PTY session is spawned with notifyOnExit: true, the exit notification (<pty_exited>) is posted back to the OpenCode conversation without explicitly setting the agent in the message payload.
In OpenCode, that causes the notification to be sent with the default configured agent, not necessarily the agent currently active in the conversation that launched the PTY session.
This breaks multi-agent workflows. Example: the active conversation agent is agent2, but the default agent is agent1. When the PTY session exits, the notification is emitted through agent1, and the conversation can continue with the wrong agent.
Proposed Solution
Capture the active agent at pty_spawn time.
Store it in PTY session metadata.
Reuse it when sending the exit notification (body.agent).
Keep fallback behavior when no agent metadata exists.
Alternatives Considered
Disable notifyOnExit and poll with pty_read.
Not ideal: worse UX.
Force users to keep default agent = active agent.
Not a real fix.
Use Case
Default agent is agent1.
User runs conversation with agent2 and starts a PTY with notifyOnExit: true.
PTY exits.
<pty_exited> should be posted with agent2, not agent1.
Additional Context
Repro before fix: default agent1, active agent2, PTY exit notification arrives as agent1.
Acceptance criterion: PTY exit notifications must use the same conversation agent that spawned the PTY session.
Activity
Llacoste2000 commentedon Feb 17, 2026
Hello ! I have the code ready to be pushed in a PR, feel free to open it or respond if you feel like something is missing :) Thanks
[-][Feature]:[/-][+][Feature]: PTY exit notifications to use spawning conversation agent[/+]shekohex commentedon Feb 17, 2026
Sure, send a PR! @Llacoste2000
shekohex commentedon Feb 17, 2026
Also check out #22
Llacoste2000 commentedon Feb 17, 2026
@shekohex opened :)