Skip to content

fix(contrib): reject explicitly empty permission options - #156

Open
monody0007 wants to merge 1 commit into
agentclientprotocol:mainfrom
monody0007:fix/explicit-empty-permission-options
Open

monody0007 wants to merge 1 commit into
agentclientprotocol:mainfrom
monody0007:fix/explicit-empty-permission-options

Conversation

@monody0007

Copy link
Copy Markdown

Summary

PermissionBroker treated an explicitly empty options=[] or default_options=[] like None. An empty per-request sequence therefore fell back to the broker defaults, which could be custom; an empty default sequence was replaced by the standard Approve / Approve for session / Reject choices. The existing MissingPermissionOptionsError guard could not catch either input.

Use defaults only when the argument is None. An explicit empty sequence now raises MissingPermissionOptionsError before the requester callback runs. Omitted and None arguments still use defaults; nonempty custom options, including a reject-only default, still work.

Callers that intentionally want default choices should omit the argument or pass None.

Related issues

No linked issue. Searches of current upstream issues and PRs found no PermissionBroker or empty-options report or competing fix.

Testing

  • Baseline RED in a separate checkout at 9d07d787: uv run --frozen python -m pytest tests/contrib/test_contrib_permissions.py -q — 2 expected failures (DID NOT RAISE for explicit empty per-request and default options), 5 passed controls.
  • Fixed GREEN: same targeted command — 7 passed.
  • Acceptance probe importing the installed acp.contrib.permissions in both checkouts: empty per-request and empty default sources raise before the requester callback; omitted, None, custom-default, and reject-only controls are unchanged.
  • make check — passed (lockfile consistency, pre-commit/Ruff, ty, deptry); the first pass let the repo formatter normalize the new test file, and reruns are clean.
  • make test — 361 passed, 1 skipped (the opt-in Gemini CLI smoke test).

Docs & screenshots

Updated docs/contrib.md to state the None versus empty-sequence behavior. No screenshots apply. No schema regeneration was needed.

Checklist

  • Conventional Commit title: fix: reject explicitly empty permission options.
  • Tests cover the changed behavior and normal defaults/overrides.
  • User-visible behavior documented.
  • Schema regeneration status stated above.

AI assistance: GPT-6 Sol and DeepSeek assisted with implementation, tests and this description. AI tools ran the checks above, and Claude Opus 5.5 independently reviewed the final patch. No human code review is claimed.

This branch has not been deployed

No deployments
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