Skip to content

feat(permission)!: scope path rules to native file tools - #835

Merged
hakula139 merged 13 commits into
mainfrom
refactor/native-permission-scope
Nov 7, 2026
Merged

hakula139 merged 13 commits into
mainfrom
refactor/native-permission-scope

Conversation

@hakula139

@hakula139 hakula139 commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Summary

Scope read and edit path rules to native file tools and search walks. Bash uses explicit exec rules and the selected permission mode, including the automatic classifier from #833.

Remove reader option grammars, wrapper peeling, nested script analysis, directory tracking, and inferred filesystem effects. Keep literal command words, quote handling, leading assignments, simple-command boundaries, and explicit deny and ask matching. Command-specific allow rules must cover every component. The whole-class exec rule * permits calls after deny and ask checks.

Update the permission guide and security model, including migration guidance for wrapper, assignment, and dynamic exec patterns. Native path matching and file-integrity contracts remain in place. Remove workspace-zone metadata and accept explicitly configured home, filesystem-root, and ancestor anchors. Preserve the separate boundary for automatically loading checkout-supplied config and instruction files.

Uses the classifier from #833. Closes #131. Related to #658 and #664.

Test plan

  • New scope regressions have failing baseline or mutation evidence.
  • Dependency checks passed. Mandatory hooks passed across the full PR range.
  • The complete required verification block passed on the final head: cargo fmt --check, cargo build, cargo clippy --all-targets, cargo clippy, cargo doc --no-deps, cargo llvm-cov, pnpm format, pnpm lint, and pnpm spellcheck. Workspace coverage ran 3,381 passing tests with no failures and 99.24% line coverage. Five existing integration tests remain ignored.
  • Independent review findings are resolved. The ANSI-C control escape regression failed with the old decoder and now matches Bash. Focused permission and approval-output tests passed.

Migration

Native read and edit path rules no longer inspect Bash commands. Configure explicit exec rules for fixed command policy or use auto classification and manual approval. Shell wrappers and literal script arguments match their actual command text without filesystem inference.

@hakula139 hakula139 added this to the v0.1.0-alpha.11 milestone Nov 7, 2026
@hakula139 hakula139 added refactor Behavior-preserving restructuring area: permission Touches permission rules, modes, or the approval gate area: tools Touches the built-in tools such as bash, read, edit, grep, and glob area: engine Touches the engine, its protocol, or the drivers that run it labels Nov 7, 2026
@hakula139 hakula139 self-assigned this Nov 7, 2026
@hakula139 hakula139 removed the refactor Behavior-preserving restructuring label Nov 7, 2026
@hakula139 hakula139 changed the title refactor(permission): scope path rules to native file tools feat(permission): scope path rules to native file tools Nov 7, 2026
@hakula139 hakula139 added the enhancement New capability label Nov 7, 2026
@hakula139
hakula139 force-pushed the refactor/native-permission-scope branch from 76ae2ca to f00dae1 Compare November 7, 2026 14:38
@hakula139
hakula139 force-pushed the refactor/native-permission-scope branch from 45ff7ad to 89abc8d Compare November 7, 2026 14:56
@hakula139
hakula139 force-pushed the feat/auto-permission-classifier branch from 308192d to d95e96e Compare November 7, 2026 15:11
@hakula139 hakula139 changed the title feat(permission): scope path rules to native file tools feat(permission)!: scope path rules to native file tools Nov 7, 2026
@hakula139
hakula139 force-pushed the feat/auto-permission-classifier branch from 4f3fead to 21e8d11 Compare November 7, 2026 15:22
@hakula139
hakula139 force-pushed the refactor/native-permission-scope branch from d00f81b to b597862 Compare November 7, 2026 15:25
hakula139 added a commit that referenced this pull request Nov 7, 2026
## Summary

Make `auto` the default permission mode and use a configurable
Haiku-class model to allow unmatched actions or request user approval.
Explicit deny and ask rules, read-only plan mode, and session grants
take precedence. Operations confined to session state run after
configured deny and ask checks.

The classifier uses the existing endpoint and credentials, full
validated action input, and user-authored context. Failures and invalid
decisions ask for approval. Classifier usage is billed under its own
model without changing the main model's context estimate.

Remove shipped discretionary rules, protected-name groups, and implicit
read or workspace-edit approvals. User configuration gains
`permission.auto.model` and `permission.auto.instructions`.

This PR implements the classifier and policy defaults. The dependent
#835 removes the remaining shell-effect inference and limits Bash
matching to explicit exec rules and classification.

Refs #131.

## Test plan

- The required local checks passed: `cargo fmt --check`, `cargo build`,
`cargo clippy --all-targets`, `cargo clippy`, `cargo doc --no-deps`,
`cargo llvm-cov`, `pnpm format`, `pnpm lint`, and `pnpm spellcheck`.
- On the current head, workspace coverage ran 3,491 passing tests with
no failures and 99.24% line coverage. Five existing integration tests
remain ignored. Seven classifier regressions were checked with failing
mutations.
- A live Haiku test before the compaction-context fix, through the
configured gateway, emitted an automatic approval reason, executed a
fixed-output Bash command, and reported classifier usage.
- Mandatory commit and push hooks passed.
- Independent review findings are resolved. A full-engine regression
retains original and queued user intent after mid-turn compaction while
excluding generated context. Restoring the former transcript extraction
makes it fail. The required local checks passed again on the current
head.
- Resuming a compacted session uses visible user text and the new
follow-up. Earlier prompts replaced by the summary are unavailable to
classification.

## Migration

The default mode changes to `auto`. Set `permission.mode = "manual"` to
keep manual approval. Removed `permission.defaults` entries must be
deleted from existing config. Configure explicit deny, ask, and allow
rules for desired fixed policy.
Base automatically changed from feat/auto-permission-classifier to main November 7, 2026 15:41
@codecov

codecov Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.60000% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/ox-core/src/permission/shell/walk.rs 92.30% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@hakula139
hakula139 force-pushed the refactor/native-permission-scope branch from c17a46a to 1da81ca Compare November 7, 2026 15:45
@hakula139
hakula139 marked this pull request as ready for review November 7, 2026 15:49
@hakula139
hakula139 merged commit 2a6c26e into main Nov 7, 2026
19 checks passed
@hakula139
hakula139 deleted the refactor/native-permission-scope branch November 7, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: engine Touches the engine, its protocol, or the drivers that run it area: permission Touches permission rules, modes, or the approval gate area: tools Touches the built-in tools such as bash, read, edit, grep, and glob enhancement New capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use a cheap model classifier to decide ambiguous calls in auto mode

1 participant