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 摘要。