Skip to content

feat(desktop): add shell-ball direct error intake prompt#470

Open
liche719 wants to merge 4 commits into
1024XEngineer:mainfrom
liche719:feat/issue-389-shell-ball-error-intake-upstream-clean
Open

feat(desktop): add shell-ball direct error intake prompt#470
liche719 wants to merge 4 commits into
1024XEngineer:mainfrom
liche719:feat/issue-389-shell-ball-error-intake-upstream-clean

Conversation

@liche719
Copy link
Copy Markdown
Collaborator

@liche719 liche719 commented May 8, 2026

Summary

  • surface a standalone shell-ball error opportunity when the foreground window title contains an actionable failure signal
  • turn that opportunity into an explicit local bubble with Analyze error and Not now actions
  • route accepted error prompts through formal agent.task.start(trigger = error_detected) and reuse the existing bubble/runtime/delivery task flow
  • keep selected-text and clipboard opportunities ahead of the new error intake path so the existing near-field priority stays intact

Scope

Validation

  • corepack pnpm --dir apps/desktop typecheck
  • corepack pnpm --dir apps/desktop lint (existing react-refresh/only-export-components warnings only)
  • corepack pnpm --dir apps/desktop test:shell-ball is currently blocked by an unrelated baseline error at apps/desktop/src/features/shell-ball/components/floating-pet/FloatingPet.tsx:152 (repeatType implicitly has any)

Copy link
Copy Markdown
Contributor

@fennoai fennoai Bot left a comment

Choose a reason for hiding this comment

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

Found 2 noteworthy issues after code quality, performance, security, and documentation passes.

|| isShellBallClipboardPromptActive(clipboardPrompt)
|| isShellBallErrorPromptActive(errorPrompt);

const refreshErrorPromptFromForegroundWindow = useCallback(async () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Medium: getActiveWindowContext() resolves asynchronously, but this callback always commits the result. If the pointer leaves the shell-ball, the visual state changes, or a higher-priority selection/clipboard prompt appears before the promise settles, the stale response still calls setErrorPrompt(...) and resurrects an error opportunity that should already be suppressed. Please add a cancellation/request-token guard so only the latest eligible refresh can update state.

* Error opportunities should stay as an explicit shell-ball-local prompt
* until the user confirms that the current failure context should become a
* formal `error_detected` task.
*/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Low: this PR wires the missing near-field error_detected UI path into the real shell-ball flow, but docs/work-priority-plan.md still leaves the corresponding checklist items unchecked (P0-B line 160 and the atomic task at line 324). The repo rules require updating that source-of-truth document in the same change once the feature is actually implemented.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@gdemonc
Copy link
Copy Markdown
Collaborator

gdemonc commented May 8, 2026

@xgopilot 目前悬浮球是怎么识别错误信息的?

@fennoai
Copy link
Copy Markdown
Contributor

fennoai Bot commented May 8, 2026

回复

目前这版悬浮球的“错误识别”是前端本地规则匹配,不是模型判断,也不是 OCR/截图分析。

  1. 信号来源
    ShellBallApp 会读取当前前台窗口信息,只拿 windowContext.title 做判断,也就是窗口标题apps/desktop/src/features/shell-ball/ShellBallApp.tsx:470 apps/desktop/src/features/shell-ball/ShellBallApp.tsx:473

  2. 识别方式
    标题会经过 normalizeDesktopErrorSignalText() 过滤;这里只有一个关键词表,命中才算错误信号。当前包含 errorfailedexceptionunabledeniednot foundcannotcan't,以及中文的 错误失败异常报错出错apps/desktop/src/platform/desktopErrorSignal.ts:1 apps/desktop/src/platform/desktopErrorSignal.ts:32

  3. 什么时候会弹这个入口
    只有悬浮球处于 idle / hover_input,并且当前没有更高优先级的选中文本提示和剪贴板提示时,才会去刷新这个错误提示。apps/desktop/src/features/shell-ball/ShellBallApp.tsx:1079 apps/desktop/src/features/shell-ball/ShellBallApp.tsx:1085

  4. 用户看到的是什么
    命中后不会直接起任务,而是先生成一个本地气泡,带 Analyze errorNot now 两个按钮;这块状态只是 shell-ball 的本地 UI 状态。apps/desktop/src/features/shell-ball/shellBallBubbleDesktop.ts:25 apps/desktop/src/features/shell-ball/components/ShellBallBubbleMessage.tsx:117

  5. 点了 Analyze error 之后
    前端才会把这段错误文本正式提交成 agent.task.start(trigger = error_detected),输入类型是 error,同时把当前窗口映射出的 page_context 一起带上。apps/desktop/src/features/shell-ball/useShellBallCoordinator.ts:1513 apps/desktop/src/features/shell-ball/useShellBallCoordinator.ts:1568 apps/desktop/src/services/taskService.ts:194

所以可以把现在的逻辑理解成:前台窗口标题命中错误关键词 -> 弹出本地提示气泡 -> 用户确认后再进入正式 error_detected 任务链路

当前没有做的事情也很明确:不读窗口正文、不读终端输出区、不做 OCR、不做语义分类;误报/漏报主要取决于窗口标题里有没有这些关键词。

View job run

@gdemonc
Copy link
Copy Markdown
Collaborator

gdemonc commented May 8, 2026

image image

这个确实是可以识别,但是为什么只在前台窗口标题命中匹配字段呢? 点击之后的意图确认老问题了哎

@liche719 liche719 force-pushed the feat/issue-389-shell-ball-error-intake-upstream-clean branch from 61b74d3 to 16d0b04 Compare May 9, 2026 00:40
@gdemonc
Copy link
Copy Markdown
Collaborator

gdemonc commented May 9, 2026

rebase到主分支之后,现在测不出来到底是什么问题了,没办法屏幕截图分析?所以也拿不到“错误”的信息
image

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.

任务:接入错误信息承接,统一 error_detected 与错误机会推荐入口

2 participants