opencode
opencode copied to clipboard
refactor: simplify task tool subagent filtering
Summary
Small cleanup to align the task tool's filtering approach with how skill.ts handles it, plus simplification of the userInvokedAgents mechanism.
Self-contained filtering:
- Move subagent filtering into
task.tsitself (usingctx?.agentfrom #7042) - Remove the post-hoc regeneration in
prompt.ts
Simplify bypass logic:
- Replace
userInvokedAgentsarray withbypassAgentCheckboolean - Only check the current turn's user message (not all messages in session)
- Prevents bypass from persisting across the entire session
Test cleanup:
- Remove redundant
filterSubagentstests (already covered byPermissionNext.evaluatetests)
Changes
-
task.ts: Filter during description generation + simplify permission check -
prompt.ts: Remove regeneration block + usebypassAgentCheckboolean -
test: Remove redundant tests (~130 lines)
No functional changes to permission behavior - just cleaner code!