AOSSIE-Org / AOSSIE-Org/Devr.AI

BUG: GitHub verification gets stuck in “Verification Pending” state

Aberta
#223 5 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Python
Estrelas
102
Forks
137
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

### Is there an existing issue for this?

- [x] I have searched the existing issues

### What happened?

## 📌 Issue Overview
While setting up the project locally and testing the Discord → GitHub verification flow, I noticed that the verification process can get stuck in a “Verification Pending” state indefinitely, even after the verification session has expired.

This prevents users from re-initiating GitHub verification via `/verify_github.`

## 🎯 Expected Behavior
Verification sessions should expire after 5 minutes
Once expired:
- The user should be able to re-run `/verify_github`
- A new verification session should be created

## 🚨 Actual Behavior
After the initial verification session expires:

- The user still receives “Verification Pending”
- `/verify_github` does not generate a new verification link
- The flow remains blocked until manual cleanup or restart

## Root Cause :
The issue appears to be related to expired verification state not being cleared at the right time.

Key observations:
Verification sessions are stored in:
- In-memory _verification_sessions
Database fields:
- verification_token, verification_token_expires_at

Cleanup logic exists, but :
It is not guaranteed to run before /verify_github checks for an existing pending verification. As a result, an expired token can still block new verification attempts.

## Suggested Fix :
Without changing the existing verification logic, this can be resolved by ensuring expired verification state is cleared before checking for a pending verification.

- Ensure cleanup runs before creating a new session :
In `create_verification_session(...)`, explicitly run cleanup before creating a new session:
`await cleanup_expired_tokens()`
`_cleanup_expired_sessions()`

### Record

- [x] I agree to follow this project's Code of Conduct
- [x] I want to work on this issue

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.