Skip to content

fix(database): add error handling to getRemoteAgents and getRemoteAgent#1922

Merged
piorpua merged 1 commit intomainfrom
fix/sentry-ELECTRON-FG
Mar 30, 2026
Merged

fix(database): add error handling to getRemoteAgents and getRemoteAgent#1922
piorpua merged 1 commit intomainfrom
fix/sentry-ELECTRON-FG

Conversation

@kaizhou-lab
Copy link
Copy Markdown
Collaborator

Summary

  • Add try-catch to getRemoteAgents() and getRemoteAgent() in AionUIDatabase to gracefully handle cases where the remote_agents table doesn't exist (e.g. when migration v16 fails)
  • Returns safe defaults ([] / null) instead of throwing unhandled SqliteError, consistent with other database methods like createRemoteAgent, updateRemoteAgent, deleteRemoteAgent
  • Fixes Sentry ELECTRON-FGSqliteError: no such table: remote_agents (9 events, last seen 6 hours ago)

Test plan

  • Added tests in remoteAgentBridge.test.ts verifying safe defaults when methods return []/null
  • All 21 existing tests pass
  • bunx tsc --noEmit clean
  • bun run lint clean

Wrap getRemoteAgents() and getRemoteAgent() in try-catch blocks to
gracefully handle missing remote_agents table (e.g. when migration v16
fails). Returns safe defaults (empty array / null) instead of throwing
unhandled SqliteError, consistent with other database methods.

Fixes Sentry ELECTRON-FG (9 events).
@kaizhou-lab kaizhou-lab marked this pull request as ready for review March 30, 2026 08:27
@piorpua piorpua added the bot:reviewing Review in progress (mutex) label Mar 30, 2026
@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 30, 2026

Code Review:fix(database): add error handling to getRemoteAgents and getRemoteAgent (#1922)

变更概述

本 PR 为 AionUIDatabase 中的 getRemoteAgents()getRemoteAgent() 添加 try-catch,在 remote_agents 表不存在(migration v16 未执行)时返回安全默认值([] / null),而非抛出未捕获的 SqliteError。同时在 remoteAgentBridge.test.ts 补充了两个 bridge 层测试用例。


方案评估

结论:✅ 方案合理

createRemoteAgentupdateRemoteAgentdeleteRemoteAgent 的错误处理模式完全一致,改动最小且准确定位了 Sentry 报告的根因。返回安全默认值([] / null)符合调用方预期,不会导致级联崩溃。


问题清单

✅ 未发现明显问题,代码质量良好,建议批准合并。


汇总

无问题。

结论

批准合并 — 无阻塞性问题。修复精准、模式一致、有测试覆盖。


本报告由本地 pr-review skill 生成,包含完整项目上下文,无截断限制。

CONCLUSION: APPROVED
IS_CRITICAL_PATH: true
PR_NUMBER: 1922

@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 30, 2026

✅ 已自动 review,代码无阻塞性问题。

⚠️ 本 PR 涉及核心路径(src/process/services/database/),请人工确认后合并。

@piorpua piorpua added bot:ready-to-merge Bot done, code is clean — human just needs to confirm and merge and removed bot:reviewing Review in progress (mutex) labels Mar 30, 2026
@piorpua piorpua merged commit b293d6e into main Mar 30, 2026
17 checks passed
@piorpua piorpua deleted the fix/sentry-ELECTRON-FG branch March 30, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:ready-to-merge Bot done, code is clean — human just needs to confirm and merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants