feat(vscode): add calculated permissions display and subagent visibility to agent details#8505
Conversation
LLM Code Review
Overall AssessmentThis is a well-structured feature addition that surfaces CLI-computed permission rulesets in the VS Code extension's Agent Behaviour settings. The approach of forwarding the already-resolved data from the backend (rather than duplicating permission resolution logic in the frontend) is the right call. Positives
Issues & Suggestions
VerdictThe feature is solid, well-scoped, and follows existing patterns. The issues above are minor and none are blockers. The most actionable improvement would be item #2 (eliminating the non-null assertion with SolidJS's |
|
All items addressed in dfed296:
Item 1 (inline styles) was noted as not a blocker and consistent with existing patterns, so left as-is. |
Show the resolved permission ruleset for each agent in the Agent Behaviour settings tab. The section is collapsed by default and expands to show an effective-action summary plus the full ordered rule table (last match wins). Changes: - Forward all agents (including subagents) with their CLI-calculated permission rulesets to the webview via a new allAgents field - Add collapsible PermissionRuleset component in ModeEditView - Show subagents in the Agent Behaviour agent list with a badge - Add PermissionRuleItem type mirroring the backend PermissionNext.Rule Ref: #8331
- Derive defaultAgentOptions from session.agents() (visible agents only) so subagents/hidden agents cannot be selected as default_agent - Add i18n translations for the new permissions UI to all 18 locale files (ar, br, bs, da, de, es, fr, ja, ko, nl, no, pl, ru, th, tr, uk, zh, zht)
Forward the hidden flag in the allAgents mapping so the webview can distinguish internal modes (compaction, title, summary). Filter them out of the Agent Behaviour settings list to prevent leaking backend-only modes into the UI.
…display - Replace non-null assertion with SolidJS Show callback pattern - Add 'unknown' color fallback for unrecognized permission actions - Document wildcard pattern assumption in summary computation - Move mapAgent helper to module scope for better code organization
The AgentBehaviourTab now uses session.allAgents() but the story mocks only provided agents(), causing 'Cannot read properties of undefined (reading length)' errors in storybook.
c959e1e to
69754b8
Compare
Adds a copy icon button in the Calculated Permissions header that copies the agent name and full permission ruleset as formatted JSON to the clipboard, making it easy to share in issues or discussions.
| files: ["src/KiloProvider.ts"], | ||
| rules: { | ||
| "max-lines": ["error", 3200], | ||
| "max-lines": ["error", 3300], |
There was a problem hiding this comment.
we should probably refactor?
There was a problem hiding this comment.
Yeah, @imanolmzd-svg indicated he was looking into it, but I don't think this specific pr is a big offender
| return | ||
| } | ||
| setAgents(message.agents) | ||
| setAllAgents(message.allAgents ?? message.agents) |
There was a problem hiding this comment.
Is the fallback correct here?
|
@markijbema would this always be shown to users? |
| const tools = new Map<string, PermissionRuleItem["action"]>() | ||
| for (const rule of props.rules) { | ||
| if (rule.pattern === "*") { | ||
| tools.set(rule.permission, rule.action) |
There was a problem hiding this comment.
WARNING: Wildcard permission rules render a misleading summary
The CLI already emits catch-all rules like { permission: "*", pattern: "*", action: "allow" }. In that case this memo records a single * entry, so the new "Effective summary" shows *: allow instead of the effective action for each tool. That makes the summary disagree with the runtime ruleset for agents whose defaults come from wildcard permissions.
Code Review SummaryStatus: 2 Issues Found | Recommendation: Address before merge Overview
Fix these issues in Kilo Cloud Issue Details (click to expand)WARNING
Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Files Reviewed (27 files)
Reviewed by gpt-5.4-20260305 · 3,287,890 tokens |
yes, but it is folded by default |
Summary
default_agentvalues)What it looks like
When you click an agent in the Agent Behaviour tab, a new "Calculated Permissions" section appears (collapsed by default). Expanding it shows:
Why
This helps debug permission-related issues by making it easy to inspect what the CLI backend actually computes for a given agent's permissions, without having to use the
kilo debug agentCLI command.Ref: #8331
Key design decisions
setAllAgents(message.allAgents ?? message.agents)handles older CLI versions that don't sendallAgentsallAgentssignal stores a few extra agent objects (subagents + hidden modes) beyond whatagentsalready holds; the data was already being transmitted over postMessage, just not retaineddefaultAgentOptionsonly includes visible primary agents since the CLI rejects subagents/hidden modes asdefault_agentvaluesChanged files
packages/kilo-vscode/src/KiloProvider.tsallAgentsfield; extractmapAgenthelper to module scopepackages/kilo-vscode/webview-ui/src/types/messages.tsPermissionRuleItemtype andpermissionfield toAgentInfo, addallAgentstoAgentsLoadedMessagepackages/kilo-vscode/webview-ui/src/context/session.tsxallAgentssignal and expose on contextpackages/kilo-vscode/webview-ui/src/components/settings/AgentBehaviourTab.tsxallAgents()for full agent list (shows subagents with badge), scopedefaultAgentOptionsto visible primary agents onlypackages/kilo-vscode/webview-ui/src/components/settings/ModeEditView.tsxPermissionRulesetcomponent with SolidJSShowcallback pattern, distinct "unknown" color for unrecognized actionspackages/kilo-vscode/webview-ui/src/stories/StoryProviders.tsxallAgentsto mock session valuepackages/kilo-vscode/webview-ui/src/stories/settings.stories.tsxallAgentsto all story session mockspackages/kilo-vscode/webview-ui/src/i18n/*.tsalso added a copy button so people can just drop the json in issues:
