Skip to content

feat(tui): persist exact repo-scoped allow grants#4761

Closed
greyfreedom wants to merge 3 commits into
Hmbown:mainfrom
greyfreedom:feat/tui-persist-exact-allow-rules
Closed

feat(tui): persist exact repo-scoped allow grants#4761
greyfreedom wants to merge 3 commits into
Hmbown:mainfrom
greyfreedom:feat/tui-persist-exact-allow-rules

Conversation

@greyfreedom

Copy link
Copy Markdown
Contributor

Summary

  • Add an approval-card action to persist eligible safe calls as exact, repo-scoped allow rules.
  • Keep existing ask-rule saving and typed deny > ask > allow precedence intact.

Scope

  • Add complete-command matching and an absolute workspace scope for remembered shell grants.
  • Persist exact workspace-relative paths for write_file, edit_file, and validated apply_patch touched files.
  • Make dangerous shell commands, critical approvals, and repo-law prompts ineligible.
  • Keep hook asks, non-bypassable tool requirements, auto-review safety floors, repo law, and YOLO semantics unchanged.
  • Update approval copy, rule previews, translations, configuration docs, and changelogs.
  • No rule editing/removal, glob or directory grants, or deny persistence.

Builds on

Issues

Refs #1186 (partial)

Refs #2242 (partial)

Validation

  • cargo fmt --all
  • git diff --check
  • cargo test -p codewhale-execpolicy --locked
  • cargo test -p codewhale-config --locked
  • cargo test -p codewhale-tui --bin codewhale-tui --locked approval
  • cargo test -p codewhale-tui --bin codewhale-tui --locked file_ask_rule
  • Strict clippy passed for codewhale-execpolicy and codewhale-config.
  • TUI clippy passed with only unrelated warnings already present on upstream/main allowed.
  • Full TUI suite reached 8,148 passed and 4 ignored; the only failure was the unrelated underwater_motion_keeps_its_smoother_cadence_during_live_status timing assertion.
  • ./scripts/release/check-versions.sh
  • ./scripts/sync-changelog.sh --check

Add a distinct approval-card action for remembering eligible safe shell and file-write calls as typed allow rules.

Scope remembered grants to the active workspace, require exact shell command matching, preserve platform-correct path boundaries, and keep dangerous, critical, hook, auto-review, and repo-law holds outside the bypass.
@greyfreedom
greyfreedom requested a review from Hmbown as a code owner July 24, 2026 10:28
@github-actions

Copy link
Copy Markdown
Contributor

Thanks @greyfreedom for taking the time to contribute.

This repository is observing a maintainer-managed PR intake gate in dry-run mode, so this pull request is staying open. This note helps maintainers prepare the allowlist before any enforcement is considered.

Please read CONTRIBUTING.md for the expected contribution shape. A maintainer can grant recurring PR access by commenting /lgtm on a pull request.

Update real-PTY approval expectations for the renamed allow-once copy and the additional exact-repo option.

Gate the process-table OnceLock import to Unix so Windows warning-as-error builds remain clean.
Avoid assuming Rust Debug quoting matches TOML output for Windows paths.

Keep the rendered workspace-field check while relying on the typed round-trip assertion for the exact persisted value.
Hmbown pushed a commit that referenced this pull request Jul 26, 2026
Let approval cards remember eligible safe shell and file-write approvals as exact allow rules bound to one repository, without weakening deny, ask, or safety-floor precedence.

Refs #1186 and #2242.

Harvested from PR #4761 by @greyfreedom

Co-authored-by: greyfreedom <11493871+greyfreedom@users.noreply.github.com>
Hmbown pushed a commit that referenced this pull request Jul 26, 2026
Update PTY approval expectations and keep Unix-only process support out of Windows warning builds.

Harvested from PR #4761 by @greyfreedom

Co-authored-by: greyfreedom <11493871+greyfreedom@users.noreply.github.com>
Hmbown pushed a commit that referenced this pull request Jul 26, 2026
Assert persisted workspace scopes without assuming platform-specific leading separators.

Harvested from PR #4761 by @greyfreedom

Co-authored-by: greyfreedom <11493871+greyfreedom@users.noreply.github.com>
Hmbown pushed a commit that referenced this pull request Jul 26, 2026
Run the POSIX case-distinction regression only on Linux; macOS and Windows intentionally fold paths in the production matcher.

Harvested from PR #4761 by @greyfreedom

Co-authored-by: greyfreedom <11493871+greyfreedom@users.noreply.github.com>
@Hmbown

Hmbown commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Superseded by #4863, which has now merged — your work is on main.

To be explicit about what happened, because this is your contribution and the credit matters: #4863 is a harvest of this branch, not a reimplementation. All four substantive commits kept you as author (greyfreedom <11493871+greyfreedom@users.noreply.github.com>), including the Windows/PTY and portable path-scope fixes. The only commit that is not yours is a rebase repair — select_prev needed to pass the request rather than the tool name after order_for's signature changed, plus a crates/tui/CHANGELOG.md resync.

This PR itself had gone CONFLICTING against main and the branch was ~93 commits behind, so rebasing the harvest was the cheaper path to landing than untangling this one. Nothing was dropped: complete-command matching, absolute workspace scope, exact workspace-relative paths for write_file/edit_file/apply_patch, the dangerous-command and repo-law exclusions, and the deny > ask > allow precedence all shipped as you wrote them.

#1186 and #2242 stay open, as you correctly scoped them — rule editing/removal, glob and directory grants, and deny persistence are still unbuilt. Thank you for the careful scoping and for doing the cross-platform work up front.

@Hmbown Hmbown closed this Jul 26, 2026
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.

2 participants