Skip to content

feat: add manual approval policy action#172

Merged
guyb1 merged 1 commit intomainfrom
feat/manual-approval-policy
Apr 9, 2026
Merged

feat: add manual approval policy action#172
guyb1 merged 1 commit intomainfrom
feat/manual-approval-policy

Conversation

@guyb1
Copy link
Copy Markdown
Contributor

@guyb1 guyb1 commented Apr 9, 2026

Summary

Add a new manual_approval policy action alongside block and rate_limit. When a request matches a manual approval rule, the gateway holds the agent's HTTP connection while an external consumer (via the SDK) polls for pending approvals and submits approve/deny decisions.

Gateway (Rust)

  • ApprovalStore trait with in-memory implementation (DashMap + tokio channels)
  • ManualApproval variant in PolicyAction/PolicyDecision with priority ordering (Block > ManualApproval > RateLimit > Allow)
  • Two new API endpoints: GET /api/approvals/pending (long-poll with exclude param for in-flight dedup), POST /api/approvals/{id}/decision (typed enum deserialization, O(1) account ownership check)
  • Body preview: peeks first 4KB via stream chaining — no full-body buffering, no size limits
  • ApprovalGuard RAII cleanup on agent disconnect (spawns async remove on drop)
  • ProxyContext with Arc sharing across MITM sessions
  • Unified forwarding path shared between ManualApproval (after approve) and Allow

Web app

  • GET /api/gateway-url endpoint for SDK gateway discovery
  • "Manual Approval" option in policy rule creation dialog
  • Updated validation and service to accept manual_approval action

Add a new "manual_approval" policy action alongside block and rate_limit.
When a request matches a manual approval rule, the gateway holds the
agent's HTTP connection while an external consumer polls for pending
approvals and submits approve/deny decisions via the gateway API.

Gateway:
- ApprovalStore trait with in-memory implementation (DashMap + tokio channels)
- ManualApproval variant in PolicyAction/PolicyDecision with priority ordering
- Two new endpoints: GET /api/approvals/pending (long-poll with exclude param),
  POST /api/approvals/{id}/decision (typed enum deserialization)
- Body preview: peeks first 4KB via stream chaining, no full-body buffering
- ApprovalGuard RAII cleanup on agent disconnect
- ProxyContext with Arc sharing across MITM sessions

Web app:
- GET /api/gateway-url endpoint for SDK gateway discovery
- Manual Approval option in policy rule dialog, validation, and service

Database:
- Add responses JSON column to onboarding_surveys (migration)
@guyb1 guyb1 force-pushed the feat/manual-approval-policy branch from a2ee39b to d50c1f9 Compare April 9, 2026 19:53
@guyb1 guyb1 merged commit 632ccab into main Apr 9, 2026
1 check passed
@guyb1 guyb1 deleted the feat/manual-approval-policy branch April 9, 2026 20:01
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