fix(permission): forward permission requests from subagent sessions (#129)#131
Merged
Merged
Conversation
…rinev#129) Permission requests from sub-agent (child) sessions were dropped by two session-ID filters, so the user never saw the approval prompt and the sub-agent hung until OpenCode timed it out. - aggregator: handlePermissionAsked now accepts events from tracked child sessions, matching the existing pattern in handleSessionIdle and handleSessionError. Exposes isSubagentSession() for consumers. - bot: setOnPermission callback no longer requires sessionID to equal the current root session; tracked sub-agent sessions are accepted. - tests: regression coverage for both the subagent-permission path and the unrelated-session rejection path.
Owner
|
@MysticCoss thanks for contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #129.
Problem
When a sub-agent (Task tool / ULW delegation) requests permission for a
write/edit/bash call, the bot never showed the approval prompt and the
sub-agent hung until OpenCode timed it out.
Root cause
Two
sessionID !== currentSessionIdfilters dropped the event:summary/aggregator.ts—handlePermissionAskedignored all eventswhose
sessionIDwasn't the current root session.bot/index.ts— thesetOnPermissioncallback re-applied the samestrict check before showing the Telegram message.
A sub-agent runs in its own child session (
session.createdwithparentID = root), so itssessionIDnever matched.Fix
aggregator:handlePermissionAskednow also accepts events fromtracked child sessions (the pattern already used by
handleSessionIdle/handleSessionError). Adds publicisSubagentSession(id)for consumers.bot:setOnPermissioncallback accepts the current session or anytracked sub-agent session.
requestID+directory), no change needed there.
Tests
Two new regression tests in
tests/summary/aggregator.test.ts:permission.askedfrom a tracked subagent child sessionpermission.askedfrom unrelated sessionsFull suite: 916/916 passing.
tsc --noEmitclean.