Skip to content

fix(chat): fail closed when agent credits cannot be verified#87

Merged
dhairyashiil merged 3 commits into
mainfrom
fix/chat-agent-credit-gate
May 4, 2026
Merged

fix(chat): fail closed when agent credits cannot be verified#87
dhairyashiil merged 3 commits into
mainfrom
fix/chat-agent-credit-gate

Conversation

@dhairyashiil
Copy link
Copy Markdown
Member

@dhairyashiil dhairyashiil commented May 1, 2026

Fixes - ENG-1169

Summary

  • Add a shared fail-closed agent credit gate before starting LLM-backed chat flows.
  • Apply the gate to Telegram/Slack agent handlers, Slack /cal natural-language fallback, and retry responses.
  • Remove fail-open behavior when /v2/credits/available rejects third-party OAuth tokens.

Test plan

  • pnpm --filter @calcom/chat typecheck
  • Verified Telegram freeform now blocks before runAgentStream when credits check returns 403 insufficient_scope.

Open in Devin Review

@vercel
Copy link
Copy Markdown

vercel Bot commented May 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
cal-companion-chat Ignored Ignored May 1, 2026 3:18pm

Request Review

@vercel
Copy link
Copy Markdown

vercel Bot commented May 1, 2026

Deployment failed with the following error:

You don't have permission to create a Preview Deployment for this Vercel project: cal-companion-mcp.

View Documentation: https://vercel.com/docs/accounts/team-members-and-roles

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@dhairyashiil dhairyashiil enabled auto-merge (squash) May 1, 2026 15:29
Copy link
Copy Markdown
Contributor

@volnei volnei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@dhairyashiil dhairyashiil merged commit a6739dd into main May 4, 2026
13 of 15 checks passed
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.

2 participants