fix: replace non-functional alert()/prompt() in desktop UI - #4521
fix: replace non-functional alert()/prompt() in desktop UI#4521praisonai-triage-agent[bot] wants to merge 2 commits into
Conversation
WKWebView under Tauri has no JS dialog panel, so prompt() returns null and alert() shows nothing. This made "Move to project" inert and hid MCP add errors. Add an askText() helper mirroring askConfirm(), and route the three sites through askText/toast. Update the button test stubs to model the real platform (prompt->null, alert throws) and add a contextmenu test asserting a POST /project request is issued. Co-authored-by: MervinPraison <454862+MervinPraison@users.noreply.github.com>
|
@coderabbitai review |
|
/review |
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Greptile SummaryThe PR replaces unsupported native webview dialogs with in-app prompt and confirmation UI. It adds a text-entry dialog for moving chats, routes MCP errors through visible dialogs, and updates desktop tests to model WKWebView behavior; however, dismissing an MCP error with Escape also closes the underlying MCP form. Confidence Score: 4/5The PR needs a fix before merging because dismissing an MCP error with Escape also closes the underlying MCP form. The new MCP error dialog and the existing overlay both process the same document-level Escape event, causing users to lose their in-progress MCP form when they dismiss only the foreground error. Files Needing Attention: src/praisonai-desktop/ui/index.html
|
| Filename | Overview |
|---|---|
| src/praisonai-desktop/ui/index.html | Adds askText and visible MCP error dialogs, but the new nested-dialog path lets one Escape event close both the error and MCP overlays. |
| src/praisonai-desktop/frontend/tests/buttons.test.mjs | Models unavailable native dialogs and verifies that the in-app text prompt issues a project-move request. |
Reviews (2): Last reviewed commit: "fix: surface MCP add errors via in-app d..." | Re-trigger Greptile
|
@claude You are the FINAL architecture reviewer. If the branch is under MervinPraison/PraisonAI (not a fork), you are able to make modifications to this branch and push directly. SCOPE: Review changes in this PR. Python SDK: praisonaiagents, praisonai. TypeScript SDK: src/praisonai-ts/. Do NOT modify src/praisonai-rust. Read ALL comments above from Gemini, Qodo, CodeRabbit, and Copilot carefully before responding. Phase 1: Review per AGENTS.md
Phase 2: FIX Valid Issues Phase 3: Final Verdict |
|
Claude finished @MervinPraison's task —— View job Final Architecture Review — PR #4521 ✅
Phase 1 — AGENTS.md Review
Phase 2 — Issue Found & FixedGreptile's finding was valid, but its suggested fix (raise toast z-index) was wrong. Raising Correct fix instead: the MCP blank-name and backend-error paths ( Files modified (pushed to
Independently verified: no live Skipped: Greptile's literal z-index suggestion (would break Phase 3 — Verdict: ✅ ApproveAll 177 desktop tests pass ( |
The toast intentionally paints below the settings scrim (see layout.test 'the settings scrim covers the toast'), so blank-name and backend-error feedback shown while the MCP overlay is open was dimmed and unreadable -- the same invisible-feedback bug this PR set out to fix. Route both MCP error paths through askConfirm, whose .confirm-back (z-index 90) paints above the overlay (z-index 80). Co-authored-by: Mervin Praison <MervinPraison@users.noreply.github.com>
| if(!name){ await askConfirm('A name is required.',{danger:false,ok:'OK',cancel:'Dismiss'}); return; } | ||
| const r=await (await fetch('http://127.0.0.1:'+PORT+'/mcp',{method:'POST', | ||
| headers:{'content-type':'application/json'}, | ||
| body:JSON.stringify({action:'add',name,command:cmd,enabled:false})})).json(); | ||
| if(!r.ok){ alert(r.error); return; } | ||
| if(!r.ok){ await askConfirm(r.error,{danger:false,ok:'OK',cancel:'Dismiss'}); return; } |
Fixes #4503
What
A WKWebView under Tauri implements no JS dialog panel, so
prompt()returnsnullandalert()shows nothing. This made three sites non-functional in a page that already documents JS dialogs as unavailable (the reasonaskConfirmexists):ui/index.html"Move to project" right-click usedprompt()→ issued zero requests.alert()→ showed nothing for a blank name or an engine rejection.Changes
askText()— an in-app text prompt mirroringaskConfirm()(promise-based, resolves to the string ornull), plus matching.confirm-box .txtstyling.askText/toast:await askText(...)toast('A name is required.')toast(r.error)Test
frontend/tests/buttons.test.mjsstubs to model the real platform:w.prompt = () => nullandw.alert = () => { throw ... }(the old() => 'x'/ no-op stubs hid the bug).contextmenuon a chat row, fills the in-app prompt, and asserts aPOST /project/<id>request is issued.All 177 desktop tests pass (
npm run test:ci).Generated with Claude Code