Skip to content

feat(assistant): Keiki Face ID approval for write tools, 0.email link as fallback - #2089

Merged
MrgSub merged 1 commit into
mainfrom
devin/1792805817-keiki-verified-approvals
Oct 24, 2026
Merged

MrgSub merged 1 commit into
mainfrom
devin/1792805817-keiki-verified-approvals

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Description

This PR is written by Devin (AI). I reviewed each line.

Zero's mutating assistant tools now use Keiki's approval. Where Keiki can show its Face ID approval card (Keiki Vault, on a direct iMessage chat on a Photon line), the owner approves there. Everywhere else the 0.email review link works as it does today.

  • Write-tool policy (assistantTools): { requiredScopes: ['mail:request_action'], approval: 'ask', approvalProof: 'verified', approvalFallback: 'tool' }.
    • verified: Keiki won't let a chat "yes" approve. Only a Face ID-signed Vault card, a Slack button or the Keiki dashboard can approve.
    • tool: when Keiki can't show a card, it calls the tool unapproved. Zero then returns its 0.email confirmation URL, as before.
  • /hooks/tools/:tool:
    • Keiki adds context.approval = { actionId, decidedVia, decidedBy } to calls that were approved. It sits inside the HMAC-signed body that verifyWebhook already checks.
    • When decidedVia is keiki_vault, slack or dashboard, Zero creates the pending assistantAction as usual (same draft preparation), then claims and runs it straight away. It does not return a second review link.
    • chat, or no approval at all, keeps today's flow.
  • decideAction: the atomic claim-and-run code is moved out of /actions/:id into this helper, so the web approval and the Keiki approval share one path.
  • Prompt and tool descriptions: they now mention the Face ID card. "Saying yes in chat is not approval" still stands.

Depends on Mail-0/sms-kit#1763 (server and SDK fields). apps/server typecheck needs @onkeiki/agents with the new CloudTool.policy fields. 0.1.3 rejects approvalProof/approvalFallback, so the SDK bump lands here once that version is published. After merge, rerun apps/server/scripts/setup-assistant.ts so the Zero Shared Gateway picks up the policies.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🔒 Security enhancement

Areas Affected

  • Authentication/Authorization
  • API Endpoints

Testing Done

  • Unit tests added/updated: assistant.test.ts checks that write tools carry the approval policy and read tools don't (56 pass), and assistant-approval.test.ts passes.
  • Manual testing performed: not yet. The live Photon + iPhone run comes after the SDK bump and setup rerun.

Security Considerations

  • Authentication checks are in place: approval is read only from the signed webhook body, authorizedAssistantContext still resolves the owner, and the claim is atomic (pending → running, once).
  • Input validation is implemented (zod context.approval).

Link to Devin session: https://app.devin.ai/sessions/ad8b701418a840aaad66962915c09059
Open in Devin Desktop: https://app.devin.ai/desktop/session/ad8b701418a840aaad66962915c09059?variant=devin
Requested by: @MrgSub

… as fallback

- write tools set approval: ask, approvalProof: verified, approvalFallback: tool
- a call Keiki signed as approved on a verified surface (keiki_vault, slack, dashboard) runs directly; otherwise the 0.email review link is returned as before
- /actions/:id and the approved webhook share decideAction
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access that start with 'Devin'.

  • Disable automatic comment, CI, and merge conflict monitoring

@MrgSub
MrgSub merged commit 6b45a59 into main Oct 24, 2026
3 of 4 checks passed
@MrgSub
MrgSub deleted the devin/1792805817-keiki-verified-approvals branch October 24, 2026 01:41
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