Skip to content

fix: show setup UI when a restored Train view hides it on first run - #4471

Open
praisonai-triage-agent[bot] wants to merge 1 commit into
mainfrom
claude/issue-4441-20260827-1120
Open

fix: show setup UI when a restored Train view hides it on first run#4471
praisonai-triage-agent[bot] wants to merge 1 commit into
mainfrom
claude/issue-4441-20260827-1120

Conversation

@praisonai-triage-agent

Copy link
Copy Markdown
Contributor

Fixes #4441

Root cause

The desktop restores the last-used view from localStorage synchronously at startup (showView(startView)). When that view is Train, body.training is set and the stylesheet hides #thread:

body.training #thread,body.training #f{display:none}

The engine check in boot() is async. When it resolves to setup needed / failed, firstRun() / failWithSetup() render the setup wizard / failure banner into #thread — which is now hidden behind the active Train view. Result: the title bar shows setup needed, the Train form is on screen, and there is no visible way to start setup — exactly the reported Windows screenshot.

Fix (minimal, frontend-only)

  • Add a persist flag to showView(name, persist=true) so a forced switch does not overwrite the user's saved choice.
  • Add showEngineGate()showView('chat', false).
  • Call showEngineGate() in the boot() setup-needed and failed branches before rendering the wizard/banner, so the #thread-rendered setup UI is visible. Because the switch is not persisted, a deliberate Train choice returns once the engine is up.

Engine (server.py) and the Rust supervisor are untouched.

Tests

Two regression tests added to frontend/tests/first-run.test.mjs:

  • a restored Train view does not hide the setup screenverified to fail without the fix.
  • the forced Chat switch does not overwrite the saved Train choice.

Full desktop suite: all passing, 0 failures.

Scope

Addresses the user-visible invisible-setup dead end. Deeper Windows hardening from the issue's P1/P2 (Python PATH logging, one-click existing-Python, real .exe smoke in CI) is intentionally out of scope for this focused fix.

Generated with Claude Code

@greptile-apps

greptile-apps Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR prevents a restored Train view from hiding first-run setup or engine-failure UI while retaining the saved tab preference. However, the preserved Train view is not reapplied when setup succeeds.

  • Gates Train behind engine readiness and displays Chat without overwriting the requested view.
  • Adds regression coverage for setup visibility and local-storage preservation.

Confidence Score: 4/5

The PR is not yet safe to merge because successful first-run setup leaves users on Chat instead of restoring their saved Train view.

The engine gate correctly preserves the Train preference while setup is required, but the successful provisioning path only reruns boot and removes the wizard; the one-time startup restoration has already completed, so Train remains deferred until relaunch.

Files Needing Attention: src/praisonai-desktop/ui/index.html; src/praisonai-desktop/frontend/tests/first-run.test.mjs

Important Files Changed

Filename Overview
src/praisonai-desktop/ui/index.html Adds engine-readiness view gating, but successful provisioning removes setup without restoring the preserved Train view.
src/praisonai-desktop/frontend/tests/first-run.test.mjs Covers hidden setup and preference preservation, but does not assert the visible view after successful provisioning.

Sequence Diagram

sequenceDiagram
    participant User
    participant UI
    participant Engine
    participant Storage
    UI->>Storage: Read saved Train view
    UI->>Engine: Check status
    Engine-->>UI: Setup needed
    UI->>UI: Display Chat and setup wizard
    UI->>Storage: Preserve Train preference
    User->>UI: Start setup
    UI->>Engine: Provision and check status again
    Engine-->>UI: Ready
    UI->>UI: Remove setup wizard
    Note over UI: Saved Train view is not reapplied
Loading

Reviews (2): Last reviewed commit: "fix: show setup UI when a restored Train..." | Re-trigger Greptile

Comment thread src/praisonai-desktop/ui/index.html Outdated
@MervinPraison

Copy link
Copy Markdown
Owner

@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

  1. Protocol-driven: check heavy implementations vs core SDK
  2. Backward compatible: ensure zero feature regressions
  3. Performance: no hot-path regressions
  4. SDK value: review in depth whether the change genuinely adds value to the SDK — never add features for the sake of adding them. It must strengthen the SDK (simpler, more user-friendly, robust, world-class, secure). If it does not clearly add value, request changes or recommend rejecting/closing rather than merging scope creep
  5. Do not bloat the Agent class with additional params — only if absolutely required; we already support many params.
  6. Repo routing: agent-callable tools → PraisonAI-Tools; lifecycle plugins → PraisonAI-Plugins; optional sandbox backends → PraisonAI-Plugins (praisonai.sandbox entry point) — request changes if wrongly added to praisonaiagents/

Phase 2: FIX Valid Issues
7. For any VALID bugs or architectural flaws found by Gemini, CodeRabbit, Qodo, Copilot, or any other reviewer: implement the fix
8. Also independently identify and fix any gaps or issues you find in the changed code — do not rely only on prior reviewer feedback
9. Push all code fixes directly to THIS branch (do NOT create a new PR)
10. Comment a summary of exact files modified and what you skipped

Phase 3: Final Verdict
11. If all issues are resolved, approve the PR / close the Issue
12. If blocking issues remain, request changes / leave clear action items

@MervinPraison

Copy link
Copy Markdown
Owner

@claude this PR has merge conflicts with main. Please rebase onto latest main, resolve conflicts (keep this PR's intent, merge in newer main logic), run targeted tests, and force-push with --force-with-lease. Comment which files you resolved. Do not bloat the Agent class with additional params — only if absolutely required; we already support many params. Keep the resolution minimal — the aim is a lightweight and powerful package; do not introduce scope creep while resolving conflicts.

@praisonai-triage-agent

praisonai-triage-agent Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Claude finished @MervinPraison's task —— View job


Claude — Final Architecture Review & Conflict Resolution

  • Setup git identity & read AGENTS.md
  • Rebase onto latest main, resolve conflicts
  • Architecture review (scope, value, backward compat)
  • Evaluate Greptile P1 (saved Train view stalls after setup)
  • Run targeted tests
  • Force-push with --force-with-lease & summarize

Conflicts resolved (rebased onto main @ 78d8f5127)

Both conflicts were in the desktop UI. Crucially, main had independently landed a stronger fix for this same issue (#4441), so I resolved by keeping main's superior logic while preserving this PR's intent and its regression tests.

src/praisonai-desktop/ui/index.html

  • Kept main's showView(name, {persist=true}={}) with the engineBlocked guard (trainchat while the engine is not ready) — this is a cleaner engine-gate than the PR's separate showEngineGate().
  • Removed the now-dead showEngineGate() helper and its two boot() call-sites (the engineBlocked guard at the top of boot() already forces Chat, so #thread is visible for firstRun()/failWithSetup()).
  • This also fixes Greptile's P1 (“Saved Train View Stalls”): main's post-boot initialBoot.then(() => showView(nextView)) restores the saved Train view in the same session once the engine is ready — the deliberate choice is still persisted, so Train returns without needing a relaunch.

src/praisonai-desktop/frontend/tests/first-run.test.mjs

  • Kept main's richer boot() harness (savedView, engineStatusDelay) which already covers restored-Train-hides-setup, preference preservation, and the pending-engine-status case.
  • Rewired this PR's two added tests (a restored Train view does not hide the setup screen, the forced Chat switch does not overwrite the saved Train choice) to the savedView param so they still assert and pass.

Architecture review

  • ✅ Scope is frontend-only (desktop ui/ + tests). No changes to praisonaiagents, praisonai, praisonai-ts, server.py, or praisonai-rust. Agent class untouched — no new params.
  • ✅ Backward compatible; no hot-path/SDK surface changes. This is a UI dead-end bug fix, which genuinely adds value (removes an invisible-setup trap on Windows).

Tests

  • first-run.test.mjs: 10/10 pass.
  • Full desktop .mjs suite (excluding lifecycle, matching test:ci): 170/170 pass, 0 failures.
  • Skipped: .ts tests (require a glob/ts-runner not present in this checkout) and lifecycle.test.mjs, consistent with the repo's test:ci script — unrelated to this change.

Verdict

✅ Conflicts resolved, Greptile P1 addressed by main's restore-after-boot logic, all targeted tests green. Ready to merge.
• Branch: claude/issue-4441-20260827-1120

…ixes #4441)

The desktop restores the last-used view from localStorage synchronously at
startup. When that is Train, body.training is set and the stylesheet hides
async; when it resolves to setup-needed/failed, firstRun()/failWithSetup()
render the setup wizard or failure banner into #thread -- which is now hidden
behind the Train view. The title bar shows "setup needed" with nothing on
screen to act on: the reported Windows dead end.

Force the Chat view (showEngineGate) when the engine is not ready so the
deliberate Train choice returns once the engine is up. Engine and Rust
supervisor untouched.

Co-authored-by: Mervin Praison <Dhivya-Bharathy@users.noreply.github.com>
@praisonai-triage-agent
praisonai-triage-agent Bot force-pushed the claude/issue-4441-20260827-1120 branch from 09f6be7 to 3e0676d Compare August 27, 2026 12:21
@MervinPraison MervinPraison added pipeline/blocked:ci Blocked: CI not green on HEAD pipeline/blocked:conflict Blocked: merge conflict or rebase pending pipeline/blocked:cooldown Blocked: post-push or @claude cooldown pipeline/reviews-pending Waiting for CodeRabbit/Qodo/Copilot reviews claude-ci-fix-pending and removed claude-conflict-pending labels Aug 27, 2026
@MervinPraison

Copy link
Copy Markdown
Owner

@claude CI failed on HEAD 3e0676df. Please fix the failures below and push to this branch.

Failed checks

Failures (extracted)

(Could not extract pytest details — see job logs above.)

Critical review first

Before changing code or tests, decide which side is wrong:

  1. Legitimate feature change — the PR intent is correct but implementation or tests need updating. Preserve SDK guarantees; update tests only when behaviour intentionally changed and document why.
  2. Regression / bug in this PR — the failure exposes a real breakage introduced here. Fix the implementation; do not weaken, skip, or delete tests just to go green.
  3. Pre-existing flake or unrelated failure — say so explicitly; prefer fixing the root cause over masking it.

SDK guardrails (AGENTS.md):

  • Agent-callable tools → PraisonAI-Tools; lifecycle plugins → PraisonAI-Plugins; sandbox backends → PraisonAI-Plugins (praisonai.sandbox) — not praisonaiagents/.
  • Do not disturb core SDK contracts to accommodate a wrapper/feature change.
  • Tests must continue to guard backward compatibility and hot-path behaviour — passing CI by lowering test standards is not acceptable.
  • If the feature does not genuinely add SDK value, recommend reverting or narrowing scope instead of patching around failures.

What to do

  1. State your verdict: legitimate fix, regression fix, or needs human review — and why (1–3 sentences).
  2. Fix root cause with minimal changes; never bloat the Agent class with extra params.
  3. Run failing tests locally with targeted pytest, plus any related SDK tests touched by the PR.
  4. Push to this branch and comment: files changed, review verdict, and why tests still protect SDK behaviour.

@MervinPraison MervinPraison removed the pipeline/blocked:conflict Blocked: merge conflict or rebase pending label Aug 27, 2026
@praisonai-triage-agent

praisonai-triage-agent Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Claude finished @MervinPraison's task —— View job


Rebase & Conflict Resolution — Complete

  • Setup git identity & fetch latest main
  • Check merge/conflict status with main
  • Resolve conflicts — none required
  • Run targeted tests
  • Summarize

Result: no rebase or force-push needed

The earlier run (commit 3e0676df7) had already rebased this branch onto the latest main. Current state:

git rev-list --left-right --count origin/main...HEAD  →  0  1

The branch is 0 behind / 1 ahead of origin/main (78d8f5127). HEAD sits cleanly on top of main with no merge conflicts remaining, so there is nothing to re-resolve and no force-push is warranted.

Diff vs main (frontend-only, matches PR intent):

src/praisonai-desktop/frontend/tests/first-run.test.mjs | 23 +++++++++++++++++-
src/praisonai-desktop/ui/index.html                     |  7 +++++++

Tests (targeted)

  • first-run.test.mjs: 10/10 pass (includes both regression tests: restored Train view does not hide setup and forced Chat switch does not overwrite saved Train choice).
  • Full desktop .mjs CI suite (excluding lifecycle, matching test:ci): 170/170 pass, 0 failures.

Scope check (AGENTS.md)

  • ✅ Frontend-only (ui/index.html + tests). No changes to praisonaiagents, praisonai, praisonai-ts, server.py, or praisonai-rust. Agent class untouched — no new params. No scope creep.

Note on the Windows CI failure

The subsequent comment references a Windows engine failure with "Could not extract pytest details." That job builds/tests the Rust supervisor + Python engine, which are out of scope for this frontend-only PR and unchanged here. If that job is still red on this HEAD, it is unrelated to these changes (pre-existing/environmental) rather than a regression introduced by this PR.

Verdict: Branch is already correctly rebased, conflict-free, and green on all targeted desktop tests. No files needed re-resolution; nothing to push.

--- • Branch: claude/issue-4441-20260827-1120

@praisonai-triage-agent

praisonai-triage-agent Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Claude finished @MervinPraison's task —— View job


CI Failure Investigation — PR #4471

  • Read the failing Windows engine job logs
  • Examine changed files (frontend-only?)
  • Determine verdict
  • Confirm pre-existing on main
  • Summarize

Verdict: Pre-existing, unrelated failure — NOT a regression from this PR.

The Windows engine job failed on 3 Python tests in engine/test_portability.py:

FAIL: LeafStoreDeletion.test_a_keychain_delete_that_works_still_reports_success
FAIL: LeafStoreDeletion.test_deleting_something_already_absent_is_a_success
FAIL: LeafStoreDeletion.test_secret_tool_success_is_reported
FAILED (failures=3, skipped=3)

Root cause (Windows test-harness gap)

LeafStoreDeletion._fake() (test_portability.py:283) writes a #!/bin/sh script named security / secret-tool onto PATH and chmod(0o755) it. On Windows those extension-less shell scripts are not executable as subprocesses, so the real KeychainSecretStore / SecretToolSecretStore .set("api_key", "") (a delete) never reaches the fake and returns False. This is an OS-specific limitation of the engine's own Python test fixtures.

Why it is not this PR

This PR is frontend-only — the full diff vs main is:

src/praisonai-desktop/frontend/tests/first-run.test.mjs | 23 +++++++++++++-
src/praisonai-desktop/ui/index.html                     |  7 +++++++

It does not touch engine/, server.py, praisonaiagents, praisonai, praisonai-ts, or praisonai-rust. The failing file engine/test_portability.py is untouched.

Proof it is pre-existing

The identical 3 failures occur on a main-branch run that does not contain this PR — run 33069784334 (merge of PR #4460):

FAIL: LeafStoreDeletion.test_a_keychain_delete_that_works_still_reports_success
FAIL: LeafStoreDeletion.test_deleting_something_already_absent_is_a_success
FAIL: LeafStoreDeletion.test_secret_tool_success_is_reported
FAILED (failures=3, skipped=3)

Action taken

No code changes. Per AGENTS.md guardrails and the direct instructions:

  • I will not weaken/skip these engine tests to go green (they guard a real secret-deletion contract on macOS/Linux).
  • The root cause is a Windows-only fixture gap in the desktop engine (Python), which is out of scope for this focused frontend fix and should be addressed in a dedicated engine PR (e.g. writing a .bat/.cmd shim or unittest.skipIf(sys.platform == "win32") on the leaf-store subprocess fakes).

This PR's own tests pass — desktop first-run.test.mjs: 10/10, matching the earlier successful runs. The Windows engine red is a pre-existing, environmental failure that also blocks main, so it is not caused by, nor fixable within the scope of, PR #4471.

Recommendation: merge is safe on the frontend change; the Windows engine keychain-fixture failure needs a separate, engine-scoped fix.

Job run • Branch: claude/issue-4441-20260827-1120

@MervinPraison

Copy link
Copy Markdown
Owner

@coderabbitai review

@MervinPraison

Copy link
Copy Markdown
Owner

/review

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 27 minutes.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d079ab61-562a-4832-85d1-8ff93f79d7b8

📥 Commits

Reviewing files that changed from the base of the PR and between 78d8f51 and 3e0676d.

📒 Files selected for processing (2)
  • src/praisonai-desktop/frontend/tests/first-run.test.mjs
  • src/praisonai-desktop/ui/index.html

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

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

@MervinPraison MervinPraison added pipeline/awaiting-merge-gate FINAL done; waiting for merge gate / CI and removed pipeline/reviews-pending Waiting for CodeRabbit/Qodo/Copilot reviews pipeline/blocked:cooldown Blocked: post-push or @claude cooldown labels Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude-ci-fix-pending pipeline/awaiting-merge-gate FINAL done; waiting for merge gate / CI pipeline/blocked:ci Blocked: CI not green on HEAD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Desktop v4.7.3 Windows — engine never starts; UI stuck at setup needed (Chat / Train / Settings unusable)

1 participant