Skip to content

feat(permissions)!: refine Ask-mode policy and command approvals - #4008

Closed
wsp1911 wants to merge 0 commit into
openBitFun:mainfrom
wsp1911:dev-mac
Closed

wsp1911 wants to merge 0 commit into
openBitFun:mainfrom
wsp1911:dev-mac

Conversation

@wsp1911

@wsp1911 wsp1911 commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Refine Ask-mode defaults and assign domain actions and resource scopes to built-in tools. Allow routine workspace edits and low-risk operations while retaining approval for deletion, sensitive paths, external directories, publishing, and commands that do not qualify as read-only.
  • Add shell-aware command permission analysis, conservative read-only classification, directory-flow tracking, native PowerShell AST parsing, and bounded workspace glob expansion. Bind saved command approvals to the command, shell, working directory, and TTY.
  • Give approval models the current tool description, input schema, complete arguments, and up to five prior tool inputs. Structure requests with Markdown sections, trim the oldest history below a conservative 30k-token budget, and require decision-only responses for chat approvals.

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 rerun during PR preparation:

  • git diff --check HEAD~3 HEAD - passed.
  • pnpm --dir src/web-ui run test:run src/flow_chat/components/ChatInputApprovalBand.test.tsx - passed: 1 file, 19 tests.
  • pnpm run capabilities:check - passed: verified 24 features and 23 settings; audited 702 Tauri commands and 4,290 UI interaction candidates across 470 files.
  • The branch contains three permission commits; the CLI fixture fix is folded into the approval-context commit. The working tree is clean and origin/dev-mac matches the local HEAD.

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 because this task packages the existing commits without code changes.

CLI CI follow-up:

  • Reproduced the failure on Ubuntu CI and locally on Windows: the mock treated the new Markdown approval prompt as a normal product-control model round.
  • Updated approval-request recognition and the mock response to the current DECISION=ALLOW protocol. 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:rs and git diff --check - passed.
  • The original CLI product-control contract also passes after removing the temporary diagnostic assertions.
    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

  • Breaking change: Migrated built-in tools now use domain permission actions. Existing custom_tool rules and grants for those tools are not migrated and may need to be recreated with the new actions. Legacy bash rules and exact command grants remain readable.
  • Approval-model requests now include complete tool arguments and recent tool inputs. Tool execution results and assistant text are excluded; oversized current requests are rejected rather than silently truncated.
  • Review shell parsing and read-only classification conservatism, context-bound saved approvals, and the interaction with existing file and execution constraints.
  • Includes three permission commits. The approval-context commit also aligns the CLI approval fixture with the current request and response protocol.
  • AI-assisted PR preparation. Testing level: focused automated checks; no full end-to-end or live remote validation. No UI screenshots were captured during PR preparation.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant