Skip to content

refactor: isolate frontend sessions and stabilize async lifecycle tests - #66

Merged
CSCITech merged 24 commits into
mainfrom
sqlite-operations-acceptance
Oct 20, 2026
Merged

CSCITech merged 24 commits into
mainfrom
sqlite-operations-acceptance

Conversation

@CSCITech

@CSCITech CSCITech commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ 提交说明 / PR Notice

📝 变更描述 / Description

完成该分支剩余的前端状态和异步生命周期整理:登录会话或读取范围改变时使旧响应失效,弹窗切换与表单草稿按当前实体恢复,避免过期读取覆盖当前状态。

合入当前 main 后,PR 差异集中在前端及测试维护。保留 main 已有的 SQLite 运维、TLS 和插件校验实现;三处新增夹具修正分别隔离模型指标 API、确认真实请求取消状态,以及保持元数据测试流开启至清理,消除人为 EOF 与 watchdog 的竞争。产品超时和资金结算断言保持。

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix)
  • ✨ 新功能 (New feature)
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

延续 sqlite-operations-acceptance 分支验收;后端 SQLite 功能已包含于 main。本 PR 聚焦剩余前端与测试维护。

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有 Issues 与 PRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 Bug fix,已关联对应 Issue。
  • 变更理解: 变更范围和失败原因已结合当前调用路径核查。
  • 范围聚焦: 本 PR 聚焦前端生命周期与测试稳定性。
  • 本地验证: 已完成匹配范围验证;完整 Windows 后端仍有失败,见下方证据。
  • 安全合规: 保留现有许可、署名与 NOTICE;不包含内部调查资料和临时产物。

📸 运行证明 / Proof of Work

本地环境:Windows、Go 1.25.1、Bun 1.3.14。验证候选 tree:aefb3bbaebed2a0646a824de7bc411c0cc329493。

  • 前端完整测试:576 pass / 0 fail;typecheck 通过。
  • 三处新增夹具均有修复前后的可重复证据:指标读取原候选/main 均 RED,修正后 GREEN;取消竞争由 3 pass/5 fail 到 8/8 pass;EOF 竞争由 3/3 fail 到 3/3 pass。禁用 watchdog 的负向控制仍按预期失败。
  • 无 overlay 的两个 Go 测试族:46 个组合全部通过。
  • 完整 vet、JSON policy、ESLint、Go 格式、测试目录同步均通过。完整 Go JSON 命令为 58 包通过 / service 失败 / 36 包无测试:子进程未到达屏障,随后触发包预算;保留该失败,不称全套通过。
  • 当前 relay / OpenAI 整包通过(375.762 / 17.809 秒);service 失败单项、32 组合家族、前序 10 项加家族的隔离计时探针均通过,尚未确认全套失败根因。service 测试和生产实现未被本轮修改;需现有 Ubuntu CI 交叉核验。
  • 前端生产构建与 Tailwind 校验通过,此后仅修改三处测试源。

未覆盖真实 MySQL/PostgreSQL、Redis 故障、外部支付/真实渠道与浏览器 E2E;本 PR 没有相关数据库或资金 mutation 改动。

验收标准:维护者已明确同意使用当前 PR HEAD 的仓库现有 Ubuntu CI 完整后端结果继续本轮验收、全量复审和稳定观察;该标准不覆盖或关闭上述 Windows 失败。

Ubuntu CI(当前 HEAD 59acb855b89ccc01a7f51d1d669f3f9d7d0d2750)已通过:CI #39396489407。包括完整 go test ./...、vet、JSON policy,以及前端测试、typecheck 和生产构建;PR Check 也已通过。Windows 全套失败继续保持未解决状态。

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 598e6edb-87a4-4f8c-8bb7-4403c1cb167e
📥 Commits

Reviewing files that changed from the base of the PR and between b30233f and 59acb85.

📒 Files selected for processing: 91
  • relay/channel/openai/first_result_test.go
  • relay/helper/stream_scanner_test.go
  • relay/responses_first_result_settlement_test.go
  • web/default/scripts/run-tests.mjs
  • web/default/src/components/ai-elements/web-preview.tsx
  • web/default/src/components/long-text.tsx
  • web/default/src/components/risk-acknowledgement-dialog.tsx
  • web/default/src/features/auth/hooks/use-oauth-login.ts
  • web/default/src/features/auth/lib/app-session-verifier.ts
  • web/default/src/features/auth/secure-verification/components/secure-verification-provider.tsx
  • web/default/src/features/auth/secure-verification/hooks/use-api-token-verification.ts
  • web/default/src/features/auth/secure-verification/hooks/use-secure-verification-gate.ts
  • web/default/src/features/auth/secure-verification/hooks/verification-context.runtime.test.tsx
  • web/default/src/features/auth/secure-verification/index.ts
  • web/default/src/features/auth/secure-verification/lib/verification-context.ts
  • web/default/src/features/channels/components/dialogs/balance-query-dialog.tsx
  • web/default/src/features/channels/components/dialogs/codex-oauth-dialog.runtime.test.tsx
  • web/default/src/features/channels/components/dialogs/codex-oauth-dialog.tsx
  • web/default/src/features/channels/components/dialogs/edit-tag-dialog.tsx
  • web/default/src/features/channels/components/dialogs/fetch-models-dialog.tsx
  • web/default/src/features/channels/components/dialogs/multi-key-manage-dialog.tsx
  • web/default/src/features/channels/components/dialogs/read-dialog-lifecycle.runtime.test.tsx
  • web/default/src/features/channels/components/dialogs/tag-batch-edit-dialog.runtime.test.tsx
  • web/default/src/features/channels/components/dialogs/tag-batch-edit-dialog.tsx
  • web/default/src/features/channels/components/drawers/channel-mutate-drawer.tsx
  • web/default/src/features/dashboard/components/models/consumption-distribution-chart.tsx
  • web/default/src/features/dashboard/components/models/model-charts.tsx
  • web/default/src/features/dashboard/components/users/user-charts.tsx
  • web/default/src/features/keys/components/api-key-routing-editor.test.tsx
  • web/default/src/features/models/components/dialogs/extend-deployment-dialog.tsx
  • web/default/src/features/models/components/dialogs/rename-deployment-dialog.tsx
  • web/default/src/features/models/components/dialogs/sync-wizard-dialog.runtime.test.tsx
  • web/default/src/features/models/components/dialogs/sync-wizard-dialog.tsx
  • web/default/src/features/pricing/components/model-details.runtime.test.tsx
  • web/default/src/features/profile/components/checkin-calendar-card.tsx
  • web/default/src/features/profile/components/language-preferences-card.tsx
  • web/default/src/features/profile/components/sidebar-modules-card.tsx
  • web/default/src/features/profile/components/tabs/account-bindings-tab.tsx
  • web/default/src/features/profile/components/tabs/notification-tab.tsx
  • web/default/src/features/profile/hooks/use-profile.ts
  • web/default/src/features/profile/hooks/use-two-fa.ts
  • web/default/src/features/smart-ops/alerts.test.tsx
  • web/default/src/features/smart-ops/channel-health/index.runtime.test.tsx
  • web/default/src/features/smart-ops/channel-health/index.tsx
  • web/default/src/features/subscriptions/components/dialogs/subscription-purchase-dialog.tsx
  • web/default/src/features/system-settings/auth/passkey-section.tsx
  • web/default/src/features/system-settings/components/settings-page-context.tsx
  • web/default/src/features/system-settings/components/settings-section.tsx
  • web/default/src/features/system-settings/components/settings-submit.runtime.test.tsx
  • web/default/src/features/system-settings/content/announcements-section.tsx
  • web/default/src/features/system-settings/content/api-info-section.tsx
  • web/default/src/features/system-settings/content/chat-settings-section.tsx
  • web/default/src/features/system-settings/content/faq-section.tsx
  • web/default/src/features/system-settings/content/json-toggle-section.tsx
  • web/default/src/features/system-settings/content/uptime-kuma-section.tsx
  • web/default/src/features/system-settings/general/channel-affinity/index.tsx
  • web/default/src/features/system-settings/hooks/use-suppress-settings-section-header.ts
  • web/default/src/features/system-settings/lib/settings-page-context.ts
  • web/default/src/features/system-settings/models/claude-settings-card.tsx
  • web/default/src/features/system-settings/models/tiered-pricing-editor.runtime.test.tsx
  • web/default/src/features/system-settings/models/tiered-pricing-editor.tsx
  • web/default/src/features/system-settings/models/tool-price-settings.tsx
  • web/default/src/features/system-settings/models/upstream-ratio-sync.tsx
  • web/default/src/features/usage-logs/components/common-logs-filter-bar.tsx
  • web/default/src/features/usage-logs/components/dialogs/user-info-dialog-race.runtime.test.tsx
  • web/default/src/features/usage-logs/components/dialogs/user-info-dialog.runtime.test.tsx
  • web/default/src/features/usage-logs/components/dialogs/user-info-dialog.tsx
  • web/default/src/features/usage-logs/components/quota-filter-select.tsx
  • web/default/src/features/usage-logs/components/task-logs-filter-bar.tsx
  • web/default/src/features/usage-logs/lib/quota-filter.ts
  • web/default/src/features/users/components/dialogs/user-binding-dialog.tsx
  • web/default/src/features/wallet/components/recharge-form-card.tsx
  • web/default/src/features/wallet/components/subscription-plans-card.tsx
  • web/default/src/features/wallet/hooks/use-affiliate.ts
  • web/default/src/features/wallet/hooks/use-topup-info.ts
  • web/default/src/features/wallet/index.tsx
  • web/default/src/features/wallet/wallet-lifecycle.runtime.test.tsx
  • web/default/src/hooks/state-lifecycle.runtime.test.tsx
  • web/default/src/hooks/use-minimum-loading-time.ts
  • web/default/src/hooks/use-mobile.ts
  • web/default/src/hooks/use-read-scope.ts
  • web/default/src/hooks/use-resettable-state.ts
  • web/default/src/lib/api-session.runtime.test.ts
  • web/default/src/lib/api.ts
  • web/default/src/lib/auth-errors.ts
  • web/default/src/lib/theme-radius.ts
  • web/default/src/main.tsx
  • web/default/src/stores/auth-store.ts
  • web/default/src/test/react.test.ts
  • web/default/src/test/react.tsx
  • web/default/tests/secure-verification-continuation.test.tsx
💤 Files with no reviewable changes: 3
  • web/default/src/features/dashboard/components/users/user-charts.tsx
  • web/default/src/features/system-settings/models/tool-price-settings.tsx
  • web/default/src/components/long-text.tsx

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout: 2
  • GitHub Check: Frontend checks
  • GitHub Check: Backend checks
🧰 Additional context used
📚 Code guidelines: 2
CLAUDE.md — auto-discovered
AGENTS.md — auto-discovered
📓 Path-based instructions: 1
Source excerpt: Use `bun` as the preferred package manager and script runner for the frontend (`web/default/` directory):

📄 CodeRabbit inference engine (CLAUDE.md)

Files:

  • web/default/src/features/dashboard/components/models/model-charts.tsx
  • web/default/src/features/channels/components/drawers/channel-mutate-drawer.tsx
  • web/default/src/features/auth/secure-verification/hooks/verification-context.runtime.test.tsx
  • web/default/tests/secure-verification-continuation.test.tsx
  • web/default/src/features/smart-ops/channel-health/index.tsx
  • web/default/src/features/channels/components/dialogs/fetch-models-dialog.tsx
  • web/default/src/features/models/components/dialogs/extend-deployment-dialog.tsx
  • web/default/src/features/system-settings/models/tiered-pricing-editor.tsx
  • web/default/src/features/subscriptions/components/dialogs/subscription-purchase-dialog.tsx
  • web/default/src/features/system-settings/components/settings-section.tsx
  • web/default/src/features/auth/secure-verification/hooks/use-secure-verification-gate.ts
  • web/default/src/features/system-settings/models/claude-settings-card.tsx
  • web/default/src/features/dashboard/components/models/consumption-distribution-chart.tsx
  • web/default/src/features/system-settings/hooks/use-suppress-settings-section-header.ts
  • web/default/src/features/models/components/dialogs/rename-deployment-dialog.tsx
  • web/default/src/features/system-settings/content/chat-settings-section.tsx
  • web/default/src/test/react.tsx
  • web/default/src/features/auth/secure-verification/hooks/use-api-token-verification.ts
  • web/default/src/features/system-settings/content/json-toggle-section.tsx
  • web/default/src/hooks/use-mobile.ts
  • web/default/src/features/profile/components/language-preferences-card.tsx
  • web/default/scripts/run-tests.mjs
  • web/default/src/features/channels/components/dialogs/codex-oauth-dialog.runtime.test.tsx
  • web/default/src/features/models/components/dialogs/sync-wizard-dialog.runtime.test.tsx
  • web/default/src/features/usage-logs/components/task-logs-filter-bar.tsx
  • web/default/src/features/auth/secure-verification/index.ts
  • web/default/src/features/wallet/wallet-lifecycle.runtime.test.tsx
  • web/default/src/features/usage-logs/components/common-logs-filter-bar.tsx
  • web/default/src/features/system-settings/lib/settings-page-context.ts
  • web/default/src/features/profile/hooks/use-profile.ts
  • web/default/src/features/profile/components/checkin-calendar-card.tsx
  • web/default/src/features/auth/secure-verification/lib/verification-context.ts
  • web/default/src/features/profile/hooks/use-two-fa.ts
  • web/default/src/lib/api-session.runtime.test.ts
  • web/default/src/features/channels/components/dialogs/tag-batch-edit-dialog.runtime.test.tsx
  • web/default/src/lib/auth-errors.ts
  • web/default/src/features/usage-logs/lib/quota-filter.ts
  • web/default/src/components/ai-elements/web-preview.tsx
  • web/default/src/features/auth/hooks/use-oauth-login.ts
  • web/default/src/test/react.test.ts
  • web/default/src/features/wallet/hooks/use-affiliate.ts
  • web/default/src/features/wallet/components/recharge-form-card.tsx
  • web/default/src/features/system-settings/content/uptime-kuma-section.tsx
  • web/default/src/features/usage-logs/components/quota-filter-select.tsx
  • web/default/src/features/system-settings/auth/passkey-section.tsx
  • web/default/src/features/usage-logs/components/dialogs/user-info-dialog.runtime.test.tsx
  • web/default/src/hooks/use-read-scope.ts
  • web/default/src/features/models/components/dialogs/sync-wizard-dialog.tsx
  • web/default/src/features/smart-ops/channel-health/index.runtime.test.tsx
  • web/default/src/features/system-settings/content/faq-section.tsx
  • web/default/src/features/system-settings/general/channel-affinity/index.tsx
  • web/default/src/hooks/use-minimum-loading-time.ts
  • web/default/src/main.tsx
  • web/default/src/features/wallet/hooks/use-topup-info.ts
  • web/default/src/features/channels/components/dialogs/read-dialog-lifecycle.runtime.test.tsx
  • web/default/src/features/users/components/dialogs/user-binding-dialog.tsx
  • web/default/src/lib/api.ts
  • web/default/src/features/profile/components/tabs/account-bindings-tab.tsx
  • web/default/src/features/channels/components/dialogs/edit-tag-dialog.tsx
  • web/default/src/features/system-settings/components/settings-submit.runtime.test.tsx
  • web/default/src/components/risk-acknowledgement-dialog.tsx
  • web/default/src/features/system-settings/models/upstream-ratio-sync.tsx
  • web/default/src/features/system-settings/models/tiered-pricing-editor.runtime.test.tsx
  • web/default/src/features/usage-logs/components/dialogs/user-info-dialog-race.runtime.test.tsx
  • web/default/src/features/keys/components/api-key-routing-editor.test.tsx
  • web/default/src/hooks/use-resettable-state.ts
  • web/default/src/features/system-settings/content/api-info-section.tsx
  • web/default/src/stores/auth-store.ts
  • web/default/src/features/auth/lib/app-session-verifier.ts
  • web/default/src/features/auth/secure-verification/components/secure-verification-provider.tsx
  • web/default/src/features/channels/components/dialogs/balance-query-dialog.tsx
  • web/default/src/features/system-settings/components/settings-page-context.tsx
  • web/default/src/features/profile/components/tabs/notification-tab.tsx
  • web/default/src/lib/theme-radius.ts
  • web/default/src/features/channels/components/dialogs/multi-key-manage-dialog.tsx
  • web/default/src/features/profile/components/sidebar-modules-card.tsx
  • web/default/src/features/pricing/components/model-details.runtime.test.tsx
  • web/default/src/features/smart-ops/alerts.test.tsx
  • web/default/src/features/system-settings/content/announcements-section.tsx
  • web/default/src/hooks/state-lifecycle.runtime.test.tsx
  • web/default/src/features/channels/components/dialogs/tag-batch-edit-dialog.tsx
  • web/default/src/features/wallet/components/subscription-plans-card.tsx
  • web/default/src/features/wallet/index.tsx
  • web/default/src/features/channels/components/dialogs/codex-oauth-dialog.tsx
  • web/default/src/features/usage-logs/components/dialogs/user-info-dialog.tsx
🪛 golangci-lint (2.14.0)
relay/helper/stream_scanner_test.go

[error] 351-351: Function StreamScannerHandler->StreamScannerHandler$4->StreamScannerHandler$4$1 should pass the context parameter

(contextcheck)

[error] 328-328: Error return value of pw.Close is not checked

(errcheck)

[error] 337-337: Error return value of fmt.Fprint is not checked

(errcheck)

🔇 Additional comments: 88
relay/channel/openai/first_result_test.go: 1

4-4: LGTM!

Also applies to: 20-27, 36-36, 62-64

relay/helper/stream_scanner_test.go: 1

306-389: LGTM!

relay/responses_first_result_settlement_test.go: 1

138-140: LGTM!

web/default/src/features/channels/components/dialogs/fetch-models-dialog.tsx: 1

148-148: LGTM!

web/default/src/features/keys/components/api-key-routing-editor.test.tsx: 1

32-32: LGTM!

Also applies to: 91-91, 151-181, 199-200, 202-202, 205-205, 258-259, 261-261, 267-267, 270-270, 273-279

web/default/src/features/usage-logs/components/common-logs-filter-bar.tsx: 1

49-49: LGTM!

Also applies to: 59-59

web/default/src/features/usage-logs/components/quota-filter-select.tsx: 1

29-30: LGTM!

web/default/src/features/usage-logs/components/task-logs-filter-bar.tsx: 1

27-27: LGTM!

Also applies to: 36-36

web/default/src/features/usage-logs/lib/quota-filter.ts: 1

1-25: LGTM!

web/default/src/features/smart-ops/alerts.test.tsx: 1

136-136: LGTM!

Also applies to: 666-687, 690-690, 761-763, 1201-1201, 1203-1225, 1234-1236, 1238-1239, 1241-1241, 1244-1246, 1248-1248, 1277-1277, 1279-1279, 1298-1301, 1306-1307, 1318-1318, 1326-1326

web/default/src/features/smart-ops/channel-health/index.runtime.test.tsx: 1

1-87: LGTM!

web/default/src/features/smart-ops/channel-health/index.tsx: 1

400-400: LGTM!

web/default/src/features/pricing/components/model-details.runtime.test.tsx: 1

24-24: LGTM!

Also applies to: 26-27, 34-36, 40-61, 63-70, 297-299, 323-323, 532-534

web/default/src/stores/auth-store.ts: 1

55-55: LGTM!

Also applies to: 64-84, 88-88

web/default/src/lib/api.ts: 1

30-31: LGTM!

Also applies to: 60-62, 70-70, 110-116, 175-188

web/default/src/lib/auth-errors.ts: 1

1-35: LGTM!

web/default/src/main.tsx: 1

32-35: LGTM!

Also applies to: 41-44, 63-66, 81-81, 94-99

web/default/src/features/auth/lib/app-session-verifier.ts: 1

21-21: LGTM!

Also applies to: 24-50, 53-55

web/default/src/features/auth/hooks/use-oauth-login.ts: 1

44-47: LGTM!

Also applies to: 58-58, 81-81, 90-90, 104-104, 117-117

web/default/src/lib/api-session.runtime.test.ts: 1

1-324: LGTM!

web/default/src/features/auth/secure-verification/components/secure-verification-provider.tsx: 1

19-19: LGTM!

Also applies to: 21-22, 33-34, 39-39, 45-45, 47-47

web/default/src/features/auth/secure-verification/lib/verification-context.ts: 1

19-26: LGTM!

Also applies to: 28-30

web/default/src/features/auth/secure-verification/hooks/use-secure-verification-gate.ts: 1

1-33: LGTM!

web/default/src/features/auth/secure-verification/hooks/use-api-token-verification.ts: 1

21-21: LGTM!

Also applies to: 30-30, 34-34, 39-39

web/default/src/features/auth/secure-verification/index.ts: 1

23-24: LGTM!

web/default/src/features/auth/secure-verification/hooks/verification-context.runtime.test.tsx: 1

1-184: LGTM!

web/default/tests/secure-verification-continuation.test.tsx: 1

107-107: LGTM!

web/default/src/hooks/use-resettable-state.ts: 1

1-66: LGTM!

web/default/src/hooks/use-read-scope.ts: 1

1-60: LGTM!

web/default/src/hooks/use-minimum-loading-time.ts: 1

29-42: LGTM!

Also applies to: 44-58

web/default/src/hooks/use-mobile.ts: 1

22-34: LGTM!

Also applies to: 36-36

web/default/src/lib/theme-radius.ts: 1

19-19: LGTM!

Also applies to: 40-72, 77-86

web/default/src/hooks/state-lifecycle.runtime.test.tsx: 1

1-736: LGTM!

web/default/src/test/react.test.ts: 1

19-19: LGTM!

Also applies to: 24-52

web/default/src/test/react.tsx: 1

189-189: LGTM!

web/default/scripts/run-tests.mjs: 1

277-277: LGTM!

Also applies to: 285-292

web/default/src/features/profile/hooks/use-profile.ts: 1

22-25: LGTM!

Also applies to: 38-44, 47-77, 101-101, 128-131, 143-144

web/default/src/features/profile/hooks/use-two-fa.ts: 1

19-20: LGTM!

Also applies to: 22-24, 38-45, 47-72, 74-75

web/default/src/features/profile/components/sidebar-modules-card.tsx: 1

25-26: LGTM!

Also applies to: 51-62, 68-72, 143-158, 160-168, 170-170

web/default/src/features/profile/components/tabs/account-bindings-tab.tsx: 1

34-35: LGTM!

Also applies to: 66-69, 83-95, 127-129

web/default/src/features/wallet/components/subscription-plans-card.tsx: 1

23-23: LGTM!

Also applies to: 26-27, 103-105, 107-121, 123-126, 140-177, 179-185, 187-187, 189-201, 203-206

web/default/src/features/wallet/hooks/use-affiliate.ts: 1

22-22: LGTM!

Also applies to: 24-24, 26-27, 36-46, 50-75, 105-106

web/default/src/features/wallet/hooks/use-topup-info.ts: 1

19-23: LGTM!

Also applies to: 169-223, 225-234, 236-237

web/default/src/features/wallet/index.tsx: 1

21-21: LGTM!

Also applies to: 23-25, 65-78, 85-94, 106-107, 132-155, 157-158, 168-168, 175-175

web/default/src/features/wallet/wallet-lifecycle.runtime.test.tsx: 1

1-459: LGTM!

web/default/src/features/channels/components/dialogs/balance-query-dialog.tsx: 1

19-19: LGTM!

Also applies to: 26-27, 57-66, 68-70, 72-94, 96-96, 98-98, 100-101, 106-107, 111-117, 141-141, 146-146

web/default/src/features/channels/components/dialogs/codex-oauth-dialog.tsx: 1

19-19: LGTM!

Also applies to: 23-23, 26-26, 44-44, 51-51, 56-62, 64-73, 82-86, 90-90, 104-104, 106-106, 110-110, 115-115, 120-124, 128-128, 142-142, 145-145

web/default/src/features/channels/components/drawers/channel-mutate-drawer.tsx: 1

2335-2335: LGTM!

web/default/src/features/channels/components/dialogs/codex-oauth-dialog.runtime.test.tsx: 1

1-119: LGTM!

web/default/src/features/channels/components/dialogs/multi-key-manage-dialog.tsx: 1

19-19: LGTM!

Also applies to: 24-25, 88-90, 92-97, 99-109, 112-115, 117-117, 120-120, 122-164, 166-166

web/default/src/features/channels/components/dialogs/read-dialog-lifecycle.runtime.test.tsx: 1

1-372: LGTM!

web/default/src/features/channels/components/dialogs/tag-batch-edit-dialog.tsx: 1

19-19: LGTM!

Also applies to: 39-39, 50-67, 70-77, 80-80, 84-84, 99-103, 105-121, 124-128

web/default/src/features/channels/components/dialogs/tag-batch-edit-dialog.runtime.test.tsx: 1

1-193: LGTM!

web/default/src/features/usage-logs/components/dialogs/user-info-dialog-race.runtime.test.tsx: 1

1-84: LGTM!

web/default/src/features/usage-logs/components/dialogs/user-info-dialog.tsx: 1

19-19: LGTM!

Also applies to: 24-25, 43-56, 63-67, 69-71, 73-91

web/default/src/features/usage-logs/components/dialogs/user-info-dialog.runtime.test.tsx: 1

1-173: LGTM!

web/default/src/features/users/components/dialogs/user-binding-dialog.tsx: 1

19-25: LGTM!

Also applies to: 41-42, 176-192, 195-208, 210-210, 212-243, 245-245, 247-248

web/default/src/components/ai-elements/web-preview.tsx: 1

32-32: LGTM!

Also applies to: 165-165

web/default/src/components/risk-acknowledgement-dialog.tsx: 1

19-19: LGTM!

Also applies to: 22-22, 92-93, 95-95, 97-98, 100-101, 115-124

web/default/src/features/channels/components/dialogs/edit-tag-dialog.tsx: 1

19-19: LGTM!

Also applies to: 24-24, 70-77, 105-122

web/default/src/features/models/components/dialogs/extend-deployment-dialog.tsx: 1

19-19: LGTM!

Also applies to: 24-24, 54-54

web/default/src/features/models/components/dialogs/rename-deployment-dialog.tsx: 1

19-19: LGTM!

Also applies to: 24-24, 50-53

web/default/src/features/models/components/dialogs/sync-wizard-dialog.tsx: 1

19-19: LGTM!

Also applies to: 26-26, 69-86

web/default/src/features/models/components/dialogs/sync-wizard-dialog.runtime.test.tsx: 1

1-78: LGTM!

web/default/src/features/subscriptions/components/dialogs/subscription-purchase-dialog.tsx: 1

19-19: LGTM!

Also applies to: 25-25, 79-86

web/default/src/features/profile/components/language-preferences-card.tsx: 1

19-19: LGTM!

Also applies to: 28-28, 57-60

web/default/src/features/profile/components/tabs/notification-tab.tsx: 1

19-19: LGTM!

Also applies to: 24-24, 59-75, 77-77, 93-104

web/default/src/features/profile/components/checkin-calendar-card.tsx: 1

19-19: LGTM!

Also applies to: 125-125, 128-128

web/default/src/features/wallet/components/recharge-form-card.tsx: 1

23-23: LGTM!

Also applies to: 113-120, 124-124

web/default/src/features/system-settings/content/announcements-section.tsx: 1

19-19: LGTM!

Also applies to: 27-27, 148-161

web/default/src/features/system-settings/content/api-info-section.tsx: 1

19-19: LGTM!

Also applies to: 27-27, 123-133

web/default/src/features/system-settings/content/chat-settings-section.tsx: 1

131-133: LGTM!

Also applies to: 135-135

web/default/src/features/system-settings/content/faq-section.tsx: 1

19-19: LGTM!

Also applies to: 26-26, 97-107

web/default/src/features/system-settings/content/json-toggle-section.tsx: 1

165-167: LGTM!

Also applies to: 169-169

web/default/src/features/system-settings/content/uptime-kuma-section.tsx: 1

19-19: LGTM!

Also applies to: 26-26, 105-115

web/default/src/features/system-settings/general/channel-affinity/index.tsx: 1

23-24: LGTM!

Also applies to: 98-98, 100-102, 104-106, 108-110, 112-114, 116-118, 120-122, 126-133, 135-135, 138-139, 149-163, 165-166, 168-169

web/default/src/features/system-settings/components/settings-page-context.tsx: 1

29-29: LGTM!

Also applies to: 98-101, 122-122

web/default/src/features/system-settings/components/settings-section.tsx: 1

20-20: LGTM!

web/default/src/features/system-settings/hooks/use-suppress-settings-section-header.ts: 1

1-24: LGTM!

web/default/src/features/system-settings/lib/settings-page-context.ts: 1

1-31: LGTM!

web/default/src/features/system-settings/auth/passkey-section.tsx: 1

190-192: LGTM!

Also applies to: 194-194

web/default/src/features/system-settings/components/settings-submit.runtime.test.tsx: 1

1-328: LGTM!

web/default/src/features/system-settings/models/claude-settings-card.tsx: 1

184-186: LGTM!

Also applies to: 188-188

web/default/src/features/system-settings/models/tiered-pricing-editor.runtime.test.tsx: 1

126-150: LGTM!

Also applies to: 559-559, 561-564, 566-566, 587-589, 778-781, 783-783

web/default/src/features/system-settings/models/tiered-pricing-editor.tsx: 1

288-292: LGTM!

web/default/src/features/system-settings/models/upstream-ratio-sync.tsx: 1

19-19: LGTM!

Also applies to: 148-148, 163-170, 547-547

web/default/src/features/dashboard/components/models/consumption-distribution-chart.tsx: 1

76-78: LGTM!

Also applies to: 80-80

web/default/src/features/dashboard/components/models/model-charts.tsx: 1

74-76: LGTM!

Also applies to: 78-78

📝 Summary

Summary by CodeRabbit

  • Bug Fixes

    • Prevented stale responses from overwriting current dialog, profile, wallet, subscription, and usage-log data.
    • Improved session handling so outdated authentication errors no longer sign users out or display incorrect expiration messages.
    • Dialog drafts and selections now reset reliably when switching records, sessions, or reopening dialogs.
    • Improved OAuth, balance, verification, and loading behavior during cancellation, refreshes, and delayed responses.
    • Preserved user-entered values, including zero and empty inputs, across rerenders.
  • Accessibility

    • Added an accessible label to the system settings editor-mode control.
  • Tests

    • Expanded coverage for lifecycle handling, stale responses, authentication sessions, dialogs, wallet flows, and settings forms.

The pull request updates relay stream tests and web application state handling. It adds session-aware API behavior, reusable hooks for resettable state and scoped reads, and lifecycle protections across dialogs, profile data, and wallet data. It also adds runtime tests and smaller UI, accessibility, and test-runner updates.

Changes: Relay stream test coordination

Layer / File(s) Summary
Deterministic stream and timeout tests
relay/channel/openai/first_result_test.go, relay/helper/stream_scanner_test.go, relay/responses_first_result_settlement_test.go
Stream tests replace fixed sleeps with coordinated release, bounded request contexts, and cancellation checks. The scanner test verifies read-ahead, ordered delivery of 50 chunks, and normal stream completion.

Web application session and UI lifecycle

Layer / File(s) Summary
Authentication session and verification
web/default/src/stores/auth-store.ts, web/default/src/lib/api.ts, web/default/src/lib/auth-errors.ts, web/default/src/main.tsx, web/default/src/features/auth/*
Authentication state tracks a session revision. API requests record that revision, and stale 401 responses do not reset authentication. Verification identity and secure-verification context access use the updated session and hook contracts.
Shared state and subscription hooks
web/default/src/hooks/*, web/default/src/lib/theme-radius.ts, web/default/src/test/react*, web/default/scripts/run-tests.mjs
New hooks provide resettable state and read-scope guards. External-store subscriptions replace effect-managed mobile and theme-radius values, and minimum loading uses cycle tracking. Tests cover the hooks and React test environment; the test runner emits stage timing metadata.
Profile and wallet read lifecycles
web/default/src/features/profile/hooks/*, web/default/src/features/profile/components/*, web/default/src/features/wallet/*, web/default/src/hooks/state-lifecycle.runtime.test.tsx
Profile and wallet reads are scoped to the active user or authentication session. Stale responses do not update active state. Wallet subscription status also uses a shared reactive time value and expiry-boundary timers.
Dialog reads and async results
web/default/src/features/channels/components/dialogs/*, web/default/src/features/channels/components/drawers/channel-mutate-drawer.tsx, web/default/src/features/usage-logs/components/dialogs/*, web/default/src/features/users/components/dialogs/user-binding-dialog.tsx
Dialog state resets when its scope changes, and guarded reads ignore stale results. Codex OAuth operations check dialog lifecycle and session revision. Runtime tests cover delayed and out-of-order responses.
Resettable forms and settings
web/default/src/components/ai-elements/web-preview.tsx, web/default/src/components/risk-acknowledgement-dialog.tsx, web/default/src/features/models/components/dialogs/*, web/default/src/features/profile/components/*, web/default/src/features/subscriptions/components/dialogs/*, web/default/src/features/system-settings/*
Form drafts reset from their current inputs through resettable state. Settings context and its header hook move to dedicated modules. Form submission callbacks, settings initialization, channel-affinity reads, and endpoint derivation are updated, with runtime tests for submission and editor behavior.
Filter, chart, and test updates
web/default/src/features/usage-logs/*, web/default/src/features/dashboard/components/*, web/default/src/features/keys/components/api-key-routing-editor.test.tsx, web/default/src/features/smart-ops/*, web/default/src/features/pricing/components/model-details.runtime.test.tsx, web/default/src/components/long-text.tsx, web/default/src/features/channels/components/dialogs/fetch-models-dialog.tsx
Quota-filter types and validation move to a shared module. Chart prop synchronization and test queries are updated. SmartOps tests scope controls to their dialogs, and channel-health error handling uses a fixed fallback message.

Priority: ⬇️ Low

Estimated code review effort: 5 (Critical) | ~120 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant AuthStore
  participant api.ts
  participant API
  participant main.tsx
  AuthStore->>api.ts: Provide current session revision
  api.ts->>API: Send request with recorded session revision
  API-->>api.ts: Return response or 401
  api.ts->>api.ts: Compare request revision with current revision
  api.ts-->>main.tsx: Reject stale 401 without resetting auth
  main.tsx->>AuthStore: Reset auth for handled current-session 401
Loading
Merge Risk: ⚪ Minimal · up to 59acb

This change makes the web app discard responses from a previous login session or a previously selected item, so outdated data no longer overwrites what the user is viewing. It also resets dialog and form drafts when the underlying item changes. Relay stream tests become deterministic, and no production relay code changed. No concrete defect was identified, so the change appears ready to merge after normal CI, including the Ubuntu cross-check the author noted for service tests.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 6.35% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 63 functions across 50 files. (38 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly summarizes the primary changes: isolating frontend sessions and stabilizing asynchronous lifecycle tests.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The pull request description directly matches the changeset. It describes frontend session and asynchronous lifecycle handling, stale-response prevention, dialog and form state resets, and test-fixtur…
Full details: Description check

Explanation

The pull request description directly matches the changeset. It describes frontend session and asynchronous lifecycle handling, stale-response prevention, dialog and form state resets, and test-fixture stabilization.

Full details: Docstring Coverage

Explanation

Docstring coverage is 6.35% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 63 functions across 50 files. (38 skipped: 38 over the file limit.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

I’m a rabbit watching drafts reset,
While old replies are gently checked.
The stream runs on; each chunk arrives,
Fresh session state keeps reads in line.
I twitch my nose and hop away.

Comment @coderabbitai help to get the list of available commands.

@CSCITech

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@CSCITech
CSCITech marked this pull request as ready for review October 20, 2026 08:54
@CSCITech
CSCITech merged commit 4856e5e into main Oct 20, 2026
4 checks passed
@CSCITech
CSCITech deleted the sqlite-operations-acceptance branch October 20, 2026 09:49
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.

1 participant