feat: Allow users to restrict workflow activation to specific agents - #259
Merged
Merged
Conversation
… filtering ## Intent Allow users to restrict workflow activation to specific agents via the WORKFLOW_AGENTS environment variable. This prevents subagents (Tasks) from being interrupted by workflow instructions when they are not expected to follow the workflow. ## Major changes ### opencode-plugin - New WORKFLOW_AGENTS env var: comma-separated list of agent names (e.g., 'general,architect') - If unset (default), workflows are active for all agents (backward compatible) - If set, only agents in the list can use workflows - Agent filter evaluated on every chat.message hook - Tools throw clear error if agent not in whitelist: 'Workflows are not enabled for this agent' - Removed WORKFLOW=off global toggle (no longer needed with per-agent filtering) - Removed /workflow on|off command (YAGNI) ### opencode-tui-plugin - Parse and respect WORKFLOW_AGENTS environment variable - Widget visibility derived from agent whitelist + current agent - Automatically hide/show widget on agent switches (reactive, no session state) - If agent not in filter, widget returns null (no DOM footprint) ### Tests - Updated test suite to validate agent filtering instead of global on/off toggle - All 53 tests passing - New tests: agent not in filter throws error, agent in filter works, handles whitespace ### Documentation - Updated opencode-plugin README with Configuration section - Updated TUI plugin README with agent-based visibility explanation - Removed .opencode/commands/workflow.md (command no longer exists) ## Side effects - Backward compatible: workflows default to all agents when WORKFLOW_AGENTS is unset - Simpler codebase: removed all session-state caching for per-session toggles - Cleaner semantics: agent filter is now the single source of truth - Better UX: users get clear error messages instead of silent failures Co-authored-by: udondan <udondan@users.noreply.github.com>
Collaborator
Author
|
superseeds #257 |
Collaborator
Author
|
thanks for all the proposals, @udondan . That made it easier to find a (simpler) solution. YAGNI |
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.
… filtering
Intent
Allow users to restrict workflow activation to specific agents via the WORKFLOW_AGENTS environment variable. This prevents subagents (Tasks) from being interrupted by workflow instructions when they are not expected to follow the workflow.
Major changes
opencode-plugin
opencode-tui-plugin
Tests
Documentation
Side effects