Skip to content

feat(engine,policy): human-in-the-loop approvals (issue #106)#128

Merged
leo-aa88 merged 2 commits into
mainfrom
feat/hitl-approvals-106
Jun 2, 2026
Merged

feat(engine,policy): human-in-the-loop approvals (issue #106)#128
leo-aa88 merged 2 commits into
mainfrom
feat/hitl-approvals-106

Conversation

@leo-aa88
Copy link
Copy Markdown
Member

@leo-aa88 leo-aa88 commented Jun 2, 2026

Summary

  • Adds Policy.spec.hitl schema (interruptOn, toolSwitchMap, edit/switch rules, redactKeys) with validation at project load time.
  • Gates tool calls that require approval: persists an interrupted checkpoint with pending HITL state, emits approval.requested / approval.resolved trace events (with actor, edit diffs), and supports approve | reject | edit | switch decisions.
  • CLI: --auto-approve / AGENTCTL_AUTO_APPROVE, --decision (+ --decision-edit-json, --decision-switch-target) on run --resume, and TTY interactive prompt loop. Pre-approval via --approve remains supported.

Closes #106

Test plan

  • make ci (gofmt, vet, race tests)
  • Engine integration tests per decision branch (TestHitl_*)
  • Policy unit tests for edit validation, switch targets, redaction
  • CLI test: interrupt → --resume --decision approve
  • Integration tests updated for interrupted (not hard-denied) gated runs
  • Manual TTY prompt on a gated workflow
  • Example policy YAML with hitl.interruptOn in a demo project

Made with Cursor

Add Policy.spec.hitl configuration and pause gated tool calls at checkpoints
with approve, reject, edit, and switch decisions. Non-interactive runs exit
interrupted; resume via --decision or --auto-approve. Emit approval.requested
and approval.resolved trace events with actor attribution and edit diffs.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

ReviewGate [WARN] WARN

Stats

  • Files changed: 26
  • Raw LOC changed: 2325
  • LOC after §10.4 exclusions (human_loc_changed): 2325
  • PR author class: human (human collaborator account) — login leo-aa88 (§10.4.2).

Warnings (3)

  • medium too_many_files_changed -- PR exceeds warn files_changed threshold: 26 files (threshold 25).
  • medium too_large_human_loc -- PR exceeds warn human_loc_changed threshold: 2325 lines (threshold 800).
  • medium many_config_files -- This PR touches 1 config files, at or above the warning threshold of 1 (config_files_changed).

Suggested labels: reviewability-warn, too-large, config-change

File categories: 26 files (0 risky)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

Automated review

Summary

Significant updates to add human-in-the-loop (HITL) functionality with decision-making capabilities.

Findings

  • No issues found.

Propagate invalid decision kinds from buildEngineHitlOptions, reject
--decision without --resume, and error when interrupted checkpoints
lack pendingHitl. Auto-approve now emits approval trace events; document
interruptOn semantics; validate interruptOn tool refs at load time.

Co-authored-by: Cursor <cursoragent@cursor.com>
@leo-aa88 leo-aa88 merged commit 3954a34 into main Jun 2, 2026
7 checks passed
@leo-aa88 leo-aa88 deleted the feat/hitl-approvals-106 branch June 2, 2026 05:48
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.

feat(engine,policy): human-in-the-loop approvals (approve | reject | edit | switch)

1 participant