Skip to content

Close the agent capability gaps: approval by default, approvers, key limits, activity audit - #41

Open
ankurmans wants to merge 1 commit into
mainfrom
capability-gaps
Open

ankurmans wants to merge 1 commit into
mainfrom
capability-gaps

Conversation

@ankurmans

Copy link
Copy Markdown
Owner

Closes the capability gaps from section 5.9 of the agent-native newsletter study. The per-gap status, files and tests, the plan report (G9), the behavior changes and the rollout order are in docs/capability-gaps/STATUS.md.

What changes

  • G1: Accounts made from now on start every newsletter with "Ask me before an agent sends" on. That holds sends, deletes, domain changes, large contact changes and now billing changes (change_plan, set_extra_emails_limit, add_dedicated_ip) for every API key, MCP session and OAuth app. Older accounts are unchanged, and the Approvals page offers to turn it on. Switching it is logged with who did it.
  • G2: The owner can name team approvers per newsletter (set_team_approver). Approvers can't approve billing changes or change approval settings. An optional 6-digit code by email is required to approve sends and deletes (set_approval_step_up). Both are dashboard-only and off by default.
  • G3: The owner picks how long activity is kept (30, 90, 180 or 365 days). list_agent_activity can filter by client and actorType. export_agent_activity exports CSV, also from a button on the Agent activity page. An auditRead key permission, never granted by default, lets a key read the whole log. Team members' dashboard changes are logged by name and role.
  • G4/G6: create_api_key takes actions (a list of allowed actions) and allowedIps (addresses or CIDR ranges, checked against Cloudflare's client-IP header; 403 without revealing the list, and the attempt is logged).
  • G5: The OAuth consent page can limit an app to one newsletter, enforced on every call the same way as keys.
  • G7: RateLimit-Policy, -Limit, -Remaining and -Reset headers on every API and MCP answer, plus Retry-After on a 429.
  • G8: Team roles now come from one table (TEAM_ROLE_CLASSES), read by the permission check, the docs and get_agent_brief.
  • New migration: 0051_agent_activity_client.sql, one index.

Behavior change to know

A full access key on a new account's newsletter now gets 202 approval_required for sends, deletes and billing changes. Before the test helper was changed, 186 tests in 52 files failed for exactly this reason. Test accounts are now set up as older accounts, and tests/capability-gaps.test.mjs tests the new default on its own.

Checks

Full suite: 363 files, 4,128 tests passed, 0 failed. Lint: 0 errors (2 warnings that were already there). npm run build passes. The new UI on the Approvals page, the Agent activity page and the consent page was not clicked through in a browser.

Before turning on step-up

The step-up code goes through lib/platform-email.js, which uses Resend if RESEND_API_KEY is set. Leave it unset to keep these emails on SES.

…limits, activity audit

- New accounts start every newsletter with "Ask me before an agent sends" on, which now also holds billing changes, for every key, MCP session and OAuth app; older accounts keep their behavior and the Approvals page offers it.
- Team approvers per newsletter and an optional code by email to approve sends and deletes; the log names who decided and how.
- Activity log: owner-chosen retention (30/90/180/365), filter by client, CSV export, auditRead keys, team members' changes recorded by name and role.
- API keys can be limited to a list of actions and to IP addresses or CIDR ranges; OAuth apps can be limited to one newsletter on the consent page.
- RateLimit-* headers on every API and MCP answer; team roles documented from the table the check reads.

docs/capability-gaps/STATUS.md has the per-gap status, the plan report (G9), behavior changes and the rollout order.
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