AOSSIE-Org / AOSSIE-Org/Devr.AI

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

未關閉
#223 5 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
102
分支
137
PR 合併指標
30 天內沒有已合併 PR

描述

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

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。