You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Make bash arity dictionary (BashArity) configurable #46250
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Context: The permission system's "always allow" whitelist pattern is computed by BashArity.prefix(tokens) (packages/opencode/src/permission/arity.ts), using a hardcoded ARITY dictionary keyed by known command prefixes (e.g. git: 2, gh: 3, npm: 2). When a command starts with an unknown wrapper/alias, the lookup fails and prefix() falls back to the first token only.
Concrete problem: For users who wrap shell commands (e.g. the rtk CLI rewrites git push --force origin main into rtk git push --force origin main), the permission request for the rewritten command produces an over-broad "always" whitelist:
BashArity.prefix(["rtk","git","push","--force","origin","main"]) → falls back to ["rtk"] → "rtk *"
Clicking Allow always on that request whitelists everyrtk ... command, silently defeating per-command permission rules. For example a future rtk gh pr review --comment 123 — which the user's "rtk gh pr review*": "ask" rule was meant to gate — becomes auto-approved, because the approved rtk * rule is matched after the config ruleset via findLast in packages/opencode/src/permission/index.ts.
Request: Make the arity dictionary configurable so users can teach prefix() about wrapper commands/aliases:
A config knob to extend/override the built-in ARITY map, e.g. "rtk git": 3, "rtk gh": 4, so prefix() yields rtk git push * / rtk gh pr review *; or
A smarter prefix() that skips unknown leading tokens and resolves arity from the first known command, producing the same scoped patterns without config.
This issue might be a duplicate of existing issues. Please check:
[FEATURE]: add rtk to bash arity dictionary #29311: Directly addresses adding rtk to the bash arity dictionary (now closed, but covers the same core problem of rtk * being too broad on "Always allow")
Your request for a configurable arity dictionary (option 1) or smarter prefix resolution (option 2) overlaps significantly with both of those. It may be worth commenting on #35882 or re-opening #29311 with your expanded proposal rather than filing separately.
Consolidating into #35882, which covers the root cause (permission rules matching rewritten commands after hooks). I've posted the arity-specific proposal there. Closing as duplicate.
Activity
github-actions commentedon Aug 30, 2026
This issue might be a duplicate of existing issues. Please check:
rtkto the bash arity dictionary (now closed, but covers the same core problem ofrtk *being too broad on "Always allow")tool.execute.beforehooks — explicitly references [FEATURE]: add rtk to bash arity dictionary #29311 and covers the samertk/arity mismatch scenario from a different angleYour request for a configurable arity dictionary (option 1) or smarter prefix resolution (option 2) overlaps significantly with both of those. It may be worth commenting on #35882 or re-opening #29311 with your expanded proposal rather than filing separately.
7emotions commentedon Aug 30, 2026
Consolidating into #35882, which covers the root cause (permission rules matching rewritten commands after hooks). I've posted the arity-specific proposal there. Closing as duplicate.