Skip to content

Merge pull request #96 from CJackHwang/codex/update-ci-line-count-limits-cihke3 ci: ignore test files in line gate and raise frontend limit to 500#97

Merged
CJackHwang merged 8 commits intomainfrom
dev
Mar 17, 2026
Merged

Conversation

@CJackHwang
Copy link
Owner

💻 变更类型 | Change Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 👷 build
  • ⚡️ perf
  • 📝 docs
  • 🔨 chore

🔀 变更说明 | Description of Change

加入历史聊天记录清除相关功能

改进门槛测试

📝 补充信息 | Additional Information

latticeon and others added 8 commits March 16, 2026 00:50
添加会话清除功能,增强安全性,避免账号被盗等情况泄露源代码
账号列表点击测试后显示账号的会话数量
设置页添加自动清除开关,每次调用后清除被调用账号的所有会话
1. 修复无限循环问题
   - DeleteAllSessions/DeleteAllSessionsForToken 添加无进度检测
   - 连续 3 轮删除失败则退出循环
   - DeleteAllSessionsForToken 添加 cursor 推进逻辑

2. 修复字段语义不准确
   - TotalCount 重命名为 FirstPageCount
   - 明确该值仅统计第一页,多页账户需关注 HasMore

3. 修复 defer 执行顺序问题
   - 合并两个 defer,确保先删除会话再释放账号
   - 使用同步删除避免并发截断风险

4. 文件拆分
   - 新建 client_session_delete.go 处理会话删除
   - client_session.go 专注于会话查询
会话管理功能新增接口方法后,同步更新测试 mock 结构体:
- mockOpenAIConfig: 添加 AutoDeleteSessions() 方法
- streamStatusDSStub: 添加 DeleteAllSessionsForToken() 方法
- testingDSMock: 添加 DeleteAllSessionsForToken() 和 GetSessionCountForToken() 方法

同时修复 client_session_delete.go 中 fmt.Errorf 使用非常量格式字符串的编译错误,改用 errors.New()
- 从逐条单个删除改为官方的批量删除接口
- 单个删除函数保留备用
…its-cihke3

ci: ignore test files in line gate and raise frontend limit to 500
@vercel
Copy link

vercel bot commented Mar 17, 2026

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

Project Deployment Actions Updated (UTC)
ds2api Ready Ready Preview, Comment Mar 17, 2026 4:13pm

@CJackHwang CJackHwang merged commit 43cbc4a into main Mar 17, 2026
5 checks passed
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: de50fd3954

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// 2. 新请求可能获取到同一账号并开始使用
// 3. 异步删除仍在进行,会截断新请求正在使用的会话
if h.Store.AutoDeleteSessions() && a.DeepSeekToken != "" {
err := h.DS.DeleteAllSessionsForToken(context.Background(), a.DeepSeekToken)

Choose a reason for hiding this comment

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

P1 Badge Avoid background context for deferred session deletion

With auto_delete.sessions enabled, this deferred call runs synchronously before h.Auth.Release(a), but it uses context.Background() so it cannot be canceled when the request is canceled/disconnected. If DeepSeek is slow/unreachable, each request can block until the HTTP timeout and keep the account checked out, which reduces throughput and can stall queued traffic for that account.

Useful? React with 👍 / 👎.

Comment on lines +237 to +239
if token == "" {
newToken, err := h.DS.Login(r.Context(), acc)
if err != nil {

Choose a reason for hiding this comment

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

P2 Badge Re-authenticate on expired token in delete-all handler

This endpoint only re-logins when the stored token is empty, then immediately calls DeleteAllSessionsForToken. For accounts with a non-empty but expired token, deletion always fails even though valid credentials may exist, so admins cannot reliably clear sessions unless they manually refresh the token elsewhere first.

Useful? React with 👍 / 👎.

CJackHwang added a commit that referenced this pull request Mar 17, 2026
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