Repository navigation
feat(permissions)!: refine Ask-mode policy and command approvals - #4013
Merged
Merged
Conversation
Allow ordinary workspace edits and routine tool operations without confirmation while retaining approval for deletion, sensitive paths, external directories, publishing, and command execution. Define domain actions and concrete resource scopes for built-in tools. Separate Agent process control from user terminal control, update the rules editor and permission copy, and refresh generated documentation. Validation: 76 focused Rust tests, 9 frontend tests, check:web, i18n:audit, and capability catalog checks. BREAKING CHANGE: Migrated built-in tools use domain permission actions. Existing custom_tool rules and grants for those tools are not migrated.
Analyze commands using the selected shell and evaluate argument patterns per command, preserving file permissions and independent constraints. Add conservative read-only classification, directory flow tracking, native PowerShell AST parsing and bounded workspace glob expansion. Bind saved approvals to the command, shell, working directory and TTY. Update permission settings and command approval labels, and hide command analysis reasons from confirmation prompts. Keep legacy bash rules and exact grants readable. Validation: focused Rust permission, parser and pipeline tests; native PowerShell parsing; frontend tests and check:web; i18n and capability checks; repository hygiene and core boundaries. Remote behavior was covered with mocks, without live SSH, relay, peer or dispatch testing.
Give approval models the current tool description, input schema, complete arguments, and up to five prior tool inputs. Organize review requests with Markdown sections and one trust rule. Trim the oldest history to stay below a conservative 30k-token budget, and use decision-only output for chat approvals. Align CLI approval mocks with the Markdown review request and the decision-only response protocol. Validation: - 13 AI adapter permission tests. - 3 focused core approval and history tests. - CLI command contracts: 45 passed, 1 ignored. - Original CLI product-control test passes after diagnostic cleanup.
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.
Replaces #4008 after rebasing its three commits onto
main.Summary
Related issues: None linked.
Type and Areas
Type: Feature, breaking permission-policy change, and UI/UX.
Areas: Product permission contracts, Agent Runtime, core tool execution and approval pipeline, shell analysis, AI adapters, Web UI permission settings and prompts, locales, and generated capability documentation.
Motivation / Impact
Ask mode currently interrupts ordinary development operations and gives approval models limited context. This change reduces routine confirmations, evaluates shell commands in their execution context, and supplies richer inputs for model-assisted approval. Explicit rules, file permissions, and independent execution constraints remain authoritative.
Permission settings and command approval labels are updated in English, Simplified Chinese, and Traditional Chinese where applicable. Command-analysis reasons are hidden from confirmation prompts.
Verification
Checks on the rebased branch:
git diff --check HEAD~3 HEADpassed.agent-runtime,tools-miniappenabled.ChatInputApprovalBand.test.tsxpassed all 19 tests.pnpm run capabilities:checkverified 24 features and 23 settings, covering 701 Tauri commands and 4,411 UI interaction candidates across 476 files.pnpm run i18n:auditpassed with zero warnings.The rebase preserves the upstream removal of the GenerativeUI tool. Its permission action and test references were dropped, and the capability catalogs were regenerated.
The three commit messages also record focused Rust permission/parser/pipeline tests, native PowerShell parsing, frontend tests,
pnpm run check:web,pnpm run i18n:audit, capability checks, repository hygiene, and core boundary checks. Those prior results are reported from commit metadata; the full Rust and repository suites were not rerun during PR preparation after the rebase.CLI CI follow-up from #4008 (before the rebase):
DECISION=ALLOWprotocol. Temporary diagnostic assertions were removed after confirming the root cause; the original persisted-config assertion remains.cargo test --locked -p openbitfun-cli --test cli_command_contracts exec_cli_contracts::cli_agent_controls_its_own_isolated_config_through_openbitfun_control -- --exact --nocapture- passed locally after failing before the fix.cargo test --locked -p openbitfun-cli --test cli_command_contracts- passed locally on Windows: 45 passed, 1 existing graphical-environment test ignored.pnpm run fmt:rsandgit diff --check- passed.Remote coverage: The command-approval commit reports mock-based remote coverage. Live Remote Workspace (SSH/container), Remote Control (relay/bots), Peer Device Mode, and Detached Dispatch scenarios have not been exercised for this PR.
Reviewer Notes
custom_toolrules and grants for those tools are not migrated and may need to be recreated with the new actions. Legacybashrules and exact command grants remain readable.Checklist