Skip to content

feat(desktop): make diagnostics context-aware and available on demand #3425

Description

@M4n5ter
English

Problem

Maka's complete, redacted Desktop diagnostic report is available from error surfaces, but silent failures have no reliable collection path. The existing Copy environment info actions omit the bounded main-process logs and Runtime Host evidence that support usually needs.

The renderer-dependent actions are also unreachable when startup fails before the main window opens, even though Electron may already be showing a native error or recovery dialog.

Multi-Host operation also makes “the current Host” insufficient as a diagnostic authority. If the selected/default Host changes between an operation failing and its report being copied, the report can collect an unrelated Host. Renderer-local failures should not be attributed to any Runtime Host at all.

Desired outcome

Provide one context-aware diagnostic pipeline for both manual and error-triggered capture:

  • Upgrade the About and command-palette actions to Copy diagnostics.
  • Make the action globally available through Cmd/Ctrl+Shift+D, with a quiet shortcut hint beside the About action and matching entries in the command palette and keyboard-shortcut help.
  • Add a bilingual Copy diagnostics action to fatal startup failures and startup-blocking native dialogs; copying must preserve the dialog's original repair, retry, wait, or exit decision.
  • Bind manual capture to the visible task or selected Runtime Host when that authority is known, and otherwise capture the current default Host.
  • Capture the profile, Session, or Turn that owns a Host-scoped failure when the error is created, rather than inferring it later from UI state.
  • Produce Desktop-only evidence when no Host authority exists or the intended Host is unavailable; never fall back to an unrelated Host.
  • Include the environment, bounded and redacted main-process logs, Runtime Host state and logs when available, and bounded Turn evidence for execution failures.
  • Retain longer redacted log tails within explicit byte budgets that remain practical for clipboard reports, without weakening per-entry bounds or the Runtime Host wire contract.
  • Keep capture available while About metadata is loading or unavailable, surface copy success or failure, and ensure Host evidence reads cannot leave copying pending indefinitely.
  • Preserve secret redaction, clipboard-only behavior, and the error-toast and Renderer-crash actions established by feat(desktop): copy diagnostics from error toasts #2540; all report components remain bounded.
  • Keep startup-dialog reports Desktop-only because no renderer-established Host authority exists yet; do not guess a Host from mutable default state.

This is a scope clarification from the original manual-entry proposal: manual and error-triggered reports share the same authority boundary, so multi-Host correctness is part of the feature rather than a separate reporting system.

Non-goals

  • No new log store, automatic upload, telemetry, or crash-reporting backend.
  • No raw or unbounded log export.
  • No fallback from a missing targeted Host to the default Host.

AI use

Codex assisted with drafting this scope clarification.

简体中文

问题

Maka 完整且经过脱敏的 Desktop 诊断报告可以从错误界面复制,但静默故障没有可靠的主动采集入口。现有的复制环境信息不包含支持排障通常需要的有界主进程日志和 Runtime Host 证据。

如果主窗口打开前启动失败,依赖 renderer 的入口同样不可达,即使 Electron 此时已经显示原生错误或恢复弹窗,用户仍无法复制诊断信息。

在多 Host 场景中,“当前 Host”也不足以作为诊断权威。如果操作失败后、复制报告前选中或默认 Host 发生变化,报告可能采集到无关 Host;纯 Renderer 本地故障则不应归因到任何 Runtime Host。

期望结果

为主动采集和错误触发建立一条统一、上下文感知的诊断链路:

  • 将“关于”页和命令面板中的入口升级为复制诊断信息
  • 通过 Cmd/Ctrl+Shift+D 在全局提供该操作,并在“关于”页操作旁弱提示该快捷键,同时同步显示在命令面板与快捷键帮助中。
  • 为致命启动失败和阻塞启动的原生弹窗增加中英文复制诊断信息操作;复制后必须保留弹窗原有的修复、重试、等待或退出决策。
  • 已知上下文时,主动采集绑定到当前可见任务或选中的 Runtime Host;否则采集当前默认 Host。
  • Host 操作发生错误时立即保存其 profile、Session 或 Turn,而不是复制时再从 UI 状态推断。
  • 没有 Host authority 或目标 Host 已不可用时只生成 Desktop 证据,绝不回退到无关 Host。
  • 报告包含环境信息、经过有界限制和脱敏的主进程日志、可用时的 Runtime Host 状态与日志,以及执行故障对应的有界 Turn 证据。
  • 在明确且适合剪贴板报告的字节预算内保留更长的脱敏日志尾部,不放宽单条日志边界或 Runtime Host 线协议契约。
  • “关于”元数据加载中或不可用时仍可采集,明确反馈复制成功或失败,并保证 Host 证据读取不会让复制无限等待。
  • 保持 feat(desktop): copy diagnostics from error toasts #2540 已有的敏感信息脱敏、仅写入剪贴板,以及错误 Toast 和 Renderer 崩溃入口;报告所有组成部分仍保持有界。
  • 启动弹窗尚无 renderer 建立的 Host authority,因此报告保持 Desktop-only,不从可变的默认状态猜测 Host。

这是对最初“增加主动入口”方案的范围澄清:主动报告和错误报告共享同一条 authority 边界,因此多 Host 正确性属于本功能本身,而不是另一套报告系统。

非目标

  • 不增加新的日志存储、自动上传、遥测或崩溃上报后端。
  • 不导出原始或无界日志。
  • 目标 Host 缺失时不回退到默认 Host。

AI 使用

Codex 协助起草了本次范围澄清。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions