[PR #7937] Fix: keep original pattern when no rule matches #12566

Open
opened 2026-02-16 18:17:28 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/7937

State: open
Merged: No


Summary

This change preserves the original requested pattern when PermissionNext.evaluate() falls back to the default ask rule.

Previously, the fallback rule always returned pattern: "*", which could lead to misleading logs, debugging output, and UI display.

Changes

  • Keep the caller-provided pattern when no permission rule matches
  • No behavior change in permission decisions (still defaults to ask)

What does this PR do?

This PR improves the fallback behavior of PermissionNext.evaluate() when no permission rule matches.

Previously, when the evaluation logic fell back to the default ask rule, the returned result always used pattern: "*", regardless of the actual pattern requested by the caller. While the permission decision itself was correct, this behavior could lead to confusing or misleading information in logs, debugging output, and any UI components that rely on the evaluated permission result.

With this change, the fallback path now preserves the original caller-provided pattern, ensuring that the evaluation result more accurately reflects the real request context. Importantly, this PR does not change any permission decision logic — the system still defaults to ask when no rule matches — it only improves the correctness and clarity of the returned metadata.

How did you verify your code works?

When no permission rule matches, the evaluation result now returns the original input pattern instead of "*".

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/7937 **State:** open **Merged:** No --- ### Summary This change preserves the original requested `pattern` when `PermissionNext.evaluate()` falls back to the default `ask` rule. Previously, the fallback rule always returned `pattern: "*"`, which could lead to misleading logs, debugging output, and UI display. ### Changes - Keep the caller-provided `pattern` when no permission rule matches - No behavior change in permission decisions (still defaults to `ask`) ### What does this PR do? This PR improves the fallback behavior of PermissionNext.evaluate() when no permission rule matches. Previously, when the evaluation logic fell back to the default ask rule, the returned result always used pattern: "*", regardless of the actual pattern requested by the caller. While the permission decision itself was correct, this behavior could lead to confusing or misleading information in logs, debugging output, and any UI components that rely on the evaluated permission result. With this change, the fallback path now preserves the original caller-provided pattern, ensuring that the evaluation result more accurately reflects the real request context. Importantly, this PR does not change any permission decision logic — the system still defaults to ask when no rule matches — it only improves the correctness and clarity of the returned metadata. ### How did you verify your code works? When no permission rule matches, the evaluation result now returns the original input pattern instead of "*".
yindo added the pull-request label 2026-02-16 18:17:28 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12566