AOSSIE-Org / AOSSIE-Org/Devr.AI

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

Abierto
#223 5 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
102
Forks
137
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### 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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.