Skip to content

hitl: spectrum remember (allow pattern) and reject-with-feedback - #195

Merged
github-actions[bot] merged 1 commit into
mainfrom
hitl-remember-spectrum-and-reject-feedback
Aug 3, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
hitl-remember-spectrum-and-reject-feedback

Conversation

@mohitranka

Copy link
Copy Markdown
Contributor

Summary

  • Phase 3 of the HITL/permission-model redesign (see docs/hitl-permission-model-research.md).
  • Expands the approval card's decisions from (allow once / remember exact / deny) to (allow once / remember exact / allow pattern going forward / deny / deny with feedback).
  • Allow pattern going forward (p): generalizes the call into a pattern via a new forge_governance::suggest_pattern (command-prefix for shell tools, path-glob for file tools, host for fetch tools), shows the literal pattern text in a confirmation sub-stage (ConfirmPattern) before committing — per opencode's "Allow always" stage — then persists it to the personal permissions.toml and adds it to the session's in-memory pattern-allow list so it applies immediately without a restart. Offered for Shell-mode calls too (unlike "remember exact", which only makes sense for Direct-mode calls with stable arguments).
  • Deny with feedback (f): a new DenyFeedback card stage collects a short note that reaches the agent as tool-result content alongside the denial (AgentSession::resolve_hitl_with_feedback), modeled on opencode's CorrectedError — no more re-explaining the same thing next turn.
  • Mouse hit-regions for the card's buttons are now located by searching the actual rendered lines (approval_card_action_row) instead of hand-maintained row-offset arithmetic, so a future content/layout change can't silently desync clicks from what's on screen.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --locked -- -D warnings
  • cargo test --workspace --all-targets --locked (0 failures across all 18 crates; 691 in forge-tui, up from 684; 133 in forge-core, up from 131)
  • New tests: suggest_pattern correctness + "always matches its own call" property (forge-governance), resolve_hitl_with_feedback (forge-core), and the full card flow — pattern eligibility on shell calls, confirm/cancel, session auto-approval of matching-but-different calls, deny-with-feedback confirm/cancel/blank (forge-tui).
  • One test (allow_pattern_confirm_approves_and_auto_allows_matching_calls_this_session) exercises the real append_user_allow_rule disk write; it redirects HOME/XDG_CONFIG_HOME to a tempdir first so it never touches the developer's real config directory.

Expand the approval card's decision set from (allow once / remember
exact / deny) to (allow once / remember exact / allow pattern going
forward / deny / deny with feedback):

- "Allow pattern going forward" generalizes the call (suggest_pattern in
  forge-governance) into a command-prefix/path-glob/host pattern, shows
  the literal text for confirmation before committing (a new ConfirmPattern
  card stage), then persists it to the personal permissions.toml and adds
  it to the session's in-memory pattern-allow list so it takes effect
  immediately without a restart. Unlike "remember exact", this is offered
  for Shell-mode calls too, since a command prefix is exactly what makes
  sense there (every invocation differs in its trailing args).
- "Deny with feedback" collects a short note (a new DenyFeedback card
  stage) that reaches the agent as tool-result content alongside the
  denial (AgentSession::resolve_hitl_with_feedback in forge-core), so it
  doesn't have to be re-explained next turn. Modeled on opencode's
  CorrectedError.

Mouse hit-regions for the card's buttons are now found by searching the
actual rendered lines instead of hand-maintained row offsets, so a future
layout change can't leave the two out of sync.

Phase 3 of the HITL/permission-model redesign in
docs/hitl-permission-model-research.md.
@github-actions
github-actions Bot enabled auto-merge (squash) August 3, 2026 07:17
@github-actions
github-actions Bot merged commit 523c671 into main Aug 3, 2026
7 checks passed
mohitranka added a commit that referenced this pull request Aug 21, 2026
Expand the approval card's decision set from (allow once / remember
exact / deny) to (allow once / remember exact / allow pattern going
forward / deny / deny with feedback):

- "Allow pattern going forward" generalizes the call (suggest_pattern in
  forge-governance) into a command-prefix/path-glob/host pattern, shows
  the literal text for confirmation before committing (a new ConfirmPattern
  card stage), then persists it to the personal permissions.toml and adds
  it to the session's in-memory pattern-allow list so it takes effect
  immediately without a restart. Unlike "remember exact", this is offered
  for Shell-mode calls too, since a command prefix is exactly what makes
  sense there (every invocation differs in its trailing args).
- "Deny with feedback" collects a short note (a new DenyFeedback card
  stage) that reaches the agent as tool-result content alongside the
  denial (AgentSession::resolve_hitl_with_feedback in forge-core), so it
  doesn't have to be re-explained next turn. Modeled on opencode's
  CorrectedError.

Mouse hit-regions for the card's buttons are now found by searching the
actual rendered lines instead of hand-maintained row offsets, so a future
layout change can't leave the two out of sync.

Phase 3 of the HITL/permission-model redesign in
docs/hitl-permission-model-research.md.
mohitranka added a commit that referenced this pull request Sep 11, 2026
Expand the approval card's decision set from (allow once / remember
exact / deny) to (allow once / remember exact / allow pattern going
forward / deny / deny with feedback):

- "Allow pattern going forward" generalizes the call (suggest_pattern in
  forge-governance) into a command-prefix/path-glob/host pattern, shows
  the literal text for confirmation before committing (a new ConfirmPattern
  card stage), then persists it to the personal permissions.toml and adds
  it to the session's in-memory pattern-allow list so it takes effect
  immediately without a restart. Unlike "remember exact", this is offered
  for Shell-mode calls too, since a command prefix is exactly what makes
  sense there (every invocation differs in its trailing args).
- "Deny with feedback" collects a short note (a new DenyFeedback card
  stage) that reaches the agent as tool-result content alongside the
  denial (AgentSession::resolve_hitl_with_feedback in forge-core), so it
  doesn't have to be re-explained next turn. Modeled on opencode's
  CorrectedError.

Mouse hit-regions for the card's buttons are now found by searching the
actual rendered lines instead of hand-maintained row offsets, so a future
layout change can't leave the two out of sync.

Phase 3 of the HITL/permission-model redesign in
docs/hitl-permission-model-research.md.
mohitranka added a commit that referenced this pull request Sep 11, 2026
Expand the approval card's decision set from (allow once / remember
exact / deny) to (allow once / remember exact / allow pattern going
forward / deny / deny with feedback):

- "Allow pattern going forward" generalizes the call (suggest_pattern in
  forge-governance) into a command-prefix/path-glob/host pattern, shows
  the literal text for confirmation before committing (a new ConfirmPattern
  card stage), then persists it to the personal permissions.toml and adds
  it to the session's in-memory pattern-allow list so it takes effect
  immediately without a restart. Unlike "remember exact", this is offered
  for Shell-mode calls too, since a command prefix is exactly what makes
  sense there (every invocation differs in its trailing args).
- "Deny with feedback" collects a short note (a new DenyFeedback card
  stage) that reaches the agent as tool-result content alongside the
  denial (AgentSession::resolve_hitl_with_feedback in forge-core), so it
  doesn't have to be re-explained next turn. Modeled on opencode's
  CorrectedError.

Mouse hit-regions for the card's buttons are now found by searching the
actual rendered lines instead of hand-maintained row offsets, so a future
layout change can't leave the two out of sync.

Phase 3 of the HITL/permission-model redesign in
docs/hitl-permission-model-research.md.
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