Skip to content

fix: refresh an open not-installed app tab when the app is installed - #36347

Merged
bolichen97 merged 1 commit into
mainfrom
fix/smoke3-c1
Nov 14, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/smoke3-c1

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: An open "X isn't installed" app tab updates on its own once that app is installed from the CLI or another tab.

The gateway sends the app_reload frame on every install, update and Sync. Only a mounted app host listened for it, so a tab showing the not-installed page for that app kept showing it until the user reloaded the page or left and came back to the tab. The sidebar stayed stale the same way. Found in adoption smoke 3 of the built-in app campaign.

Why it matters

A user who opens an app's page, sees "not installed", and installs it from a terminal sees nothing change. The page looks broken until they reload it.

Not a goal

  • Changing what the disabled, unavailable or no-UI app states do on app_reload.
  • Sending a new frame for CLI uninstall, which never reaches the gateway.
  • Changing the mounted host's window reload on app_reload.

What changed (motivation → approach → change)

The not-installed page had no host on screen, so nothing heard the frame. A new hook, useAppInstalledElsewhere (website/src/hooks/useAppInstalledElsewhere.ts), listens for mc:app-reload naming one app. It is active only while one of the two not-installed views is on screen: AppPage after a 404, and BuiltinAppRoute's released state for a former built-in. When the frame names that app, the hook fires mc:apps-changed. That is the event every install surface already uses, so the shell re-reads its app list. AppPage also re-reads the app's record, and the page then shows the app's real state. A page that already shows the app is left to its host, which reloads the window as before. The owning spec, app-kit-platform §18, now says so.

Backwards compatibility

Compatible: the hook only adds a listener while a not-installed view is on screen, and it reuses the existing mc:apps-changed event.

Removes nothing: no path, key, record or check is removed or narrowed.

Tests

  • website/src/pages/AppPage.installedElsewhere.test.tsx: after a 404, an mc:app-reload naming the app re-reads the record and fires mc:apps-changed. A frame for another app does nothing, and a page showing the app does not re-read.
  • website/src/apps/BuiltinAppRoute.installedElsewhere.test.tsx: the released state fires mc:apps-changed for its own app only, and the compiled page does not listen.
  • Both files fail with the production hunks reverted (re-read and mc:apps-changed cases), pass with them, and pass 3 shuffled repeats (--sequence.shuffle).

Proof: not provable -- frontend test (prove.py runs Python only)

Manual verification

N/A: unit coverage drives the real window events both views listen on. tsc -p tsconfig.app.json, eslint on the changed files and check-i18n-strings.mjs pass locally. Semgrep is not installed on this host, so the SAST rules run in CI only.

Screenshots / video

Why no screenshot: no layout or text changes; the existing not-installed and app pages render as before, only when they re-read changes.

Related Issues

Part of #26967

Sibling sweep

Swept: git grep -n "InstalledAppSurface app={null}|AppNotFound|mc:app-reload" -- website/src
Sibling: website/src/pages/AppPage.tsx -- changed here
Sibling: website/src/apps/BuiltinAppRoute.tsx -- changed here
Sibling: website/src/pages/chat/SidePanelTabBodies.tsx -- not affected -- a panel tab renders nothing while its app is absent, so it has no not-installed view
Sibling: website/src/desktopWindow/DesktopWindowRoot.tsx -- not affected -- a desktop window closes itself when its app is absent, so it has no not-installed view

Pattern harvest

Rule candidate: review-prompt
Pattern: a view that renders an "absent" state for a server resource must listen for the push event that announces the resource arriving, not only the mounted view.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@bolichen97

Copy link
Copy Markdown
Contributor Author

Head 64f6547 red triage: test/test_reply_format_once.py::TestEveryMessageWhereTheBlockCannotBeTakenOut::test_the_table_names_every_selectable_harness (Linux + Windows shard 8) was a main red fixed by eee70be (#36290), so this head is rebased onto origin/main 27e9359 (bd17689, same diff). The Design / First Principles / UX / GPT / Opus / PR Policy (Screenshot Evidence) / readiness reds were the shared installation token hitting its primary rate limit before any verdict was produced, and the Dependency License Gate red is the same outage showing as "Dependency review is not supported"; the new head re-runs all of them.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/system-specs/modules/app-kit-platform.md since this head went green (27e9359 -> 1ca713c); CI re-running.

The previous head bd17689 had no verdicts to answer: Design, First Principles, UX, GPT, Opus, PR Policy (Screenshot Evidence read), Dependency License Gate and CodeQL (actions) all failed closed on the installation API rate limit (API rate limit exceeded for installation, 0/15000 at 04:06Z). Backend Tests (3.12, 7) red on design_critique / issue_radar timeouts is unrelated to this frontend-only diff and is recorded on #36261.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 13, 2026
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 31c5ad1735754e6e7a9074df78240cb808dfbeae — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

No design-level concerns. The fix makes the not-installed views listen for the existing app_reload frame and passes it on as the existing mc:apps-changed event. It adds no new surface and takes nothing away.

[DESIGN-REVIEWED] 31c5ad1

Description read

[DESCRIPTION-READ] 331537c99c002c91f759c42fe0f95c1afe79adb7a412e6e75e3bc888274ffb86

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 31c5ad1735754e6e7a9074df78240cb808dfbeae — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks: the diff adds or changes no control, string or layout. The not-installed view now gets replaced by the app's real state when the app is installed elsewhere. That is a load-to-content change, so no screenshot is needed.

[UX-REVIEWED] 31c5ad1

Description read

[DESCRIPTION-READ] e42ba0d0628c955c26038707caa824f76d8d63b6f322af4431e78fb6f80231e7

That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 31c5ad1735754e6e7a9074df78240cb808dfbeae — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

The fix works for both not-installed views. The one note: the shell's app-list refresh only runs while one of those views is on screen.

Notes

  • Item 3 — symptom-level: the sidebar and the ['apps'] list refresh on mc:app-reload only while a not-installed view is mounted. The cause is one level up. appShell.tsx:797-820 listens for mc:apps-changed but not for mc:app-reload. So a CLI install while the user is on any other page still leaves the rail stale until focus returns (the description: "The sidebar stayed stale the same way"). BuiltinAppRoute already reads ['apps'] through useInstalledAppsWhen, so a listener in the shell would cover it with no hook at all. Grep for addEventListener('mc:app-reload': 2 listeners on base (AppHost.tsx, appBundleFreshness.ts), none in the shell. Subtraction: delete the mc:apps-changed re-dispatch from useAppInstalledElsewhere.ts and the BuiltinAppRoute.tsx call. Have the existing shell effect also subscribe to mc:app-reload. Keep only AppPage's record re-read.

What this change ships

Inventory (5 items) — 4 justified

Intent: when an app is installed from the CLI or another tab, a tab already showing "X isn't installed" for it updates without a reload. FIX.

  1. AppPage's not-installed view (after a 404) re-reads the app's record when its app is installed elsewhere — justified
  2. BuiltinAppRoute's released state is replaced once its app is installed elsewhere — justified
  3. The sidebar and app list refresh on an install announcement, but only while a not-installed view is on screen — symptom-level
  4. New hook useAppInstalledElsewhere with an optional onInstalled callback (2 callers, 1 passes it) — justified
  5. app-kit-platform §18 spec wording and writers list updated — justified

[FIRST-PRINCIPLES-REVIEWED] 31c5ad1

Description read

[DESCRIPTION-READ] c79706a0adad098fe66516a0cad70eafb610d9cbb305ab32e11bf4dc33dfbd85

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 31c5ad1735754e6e7a9074df78240cb808dfbeae — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 31c5ad1

Verdict parsed from the review's SHA-scoped output markers for commit 31c5ad1735754e6e7a9074df78240cb808dfbeae.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 31c5ad1735754e6e7a9074df78240cb808dfbeae false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 31c5ad1735754e6e7a9074df78240cb808dfbeae and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 31c5ad1

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 31c5ad1735754e6e7a9074df78240cb808dfbeae false-positive: <reason, 20 to 500 characters>

@KiroCrewCaptain

KiroCrewCaptain commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: Approve

Why: the decider estimates a 10% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes.

I'm approving this PR: it makes both not-installed views (AppPage after a 404, and BuiltinAppRoute's released state) react to mc:app-reload for their own app. When the frame arrives they fire mc:apps-changed, the event the shell already handles by re-reading ['apps'] and writing the result into the shared cache. AppPage also bumps attempt to re-read the app's record. The listener is off while the page is loading, shows an error or shows the app, so a re-read cannot loop, and the mounted AppHost still does its own window reload. BuiltinAppRoute reads the same ['apps'] query, so the new record clears recordless and released, and the compiled page returns. The gateway sends the reload announcement after the install, update or registry install finishes, and the CLI installs through the gateway, so the CLI path is covered. Both new test files drive the real window events for the app named, another app named, and a page that already shows the app. The spec edit matches the code.

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit 231cce4396 · 207 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 13, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/system-specs/modules/app-kit-platform.md and 52 same-dir docs since this head went green (1ca713c -> 39fd360); CI re-running.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased onto main at 6d61070 to pick up #36804, the fix for the red-main Coverage Gate (agent_ipc_client.py per-file floor). The touched files did not move on main; the related vitest files, tsc -p tsconfig.app.json and eslint pass locally. The other reds on 52b205f (Dependency License Gate, PR Policy Screenshot Evidence, Publish readiness signal, GPT pass-2 not published) were installation-token rate-limit failures, and CI re-runs them on f57519d.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 14, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 14, 2026
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 14, 2026
An open "X isn't installed" tab kept saying so after the app was
installed from the CLI or another tab, until a reload or a focus
change. The gateway already sends the app_reload frame for every
install, but only a mounted AppHost listened for it.

A new useAppInstalledElsewhere hook lets the two not-installed views
(AppPage after a 404, BuiltinAppRoute's released state) hear that
frame for their app: it fires mc:apps-changed so the shell re-reads
the installed-apps list, and AppPage also re-reads the app's record.

Part of #26967
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 14, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Green-age note for head 31c5ad1: green_age.py reports STALE because origin/main gained two commits since this base (0403d40 -> 2304233), #37151 and #30655. Both overlap this PR only by directory (docs/system-specs/modules/instances.md, website/src/pages/ArtifactsPageSections.tsx). This PR changes neither file.

Closure proof on fresh main: I merged origin/main at 2304233 into this head in a scratch worktree. On that tree, vitest run src/apps/BuiltinAppRoute src/pages/AppPage src/pages/ArtifactsPage passed 7 files and 25 tests, and tsc --noEmit was clean. I'm not rebasing again for a directory-only overlap, which would rerun the full matrix for no change in what is tested.

The earlier reds on this PR were not caused by its diff:

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This review checked head 31c5ad1. Every install route announces app_reload after it commits the record, and kirocrew app install goes through the gateway when one is running. The new hook matches the app name exactly and dispatches mc:apps-changed, so the shell's existing invalidate-then-refresh path runs. The hook listens only while AppPage's 404 view or BuiltinAppRoute's released state is on screen. A page that already shows the app keeps AppHost's window reload. The tests have no sleeps or clocks, and each guard has a negative test that fails if that guard is removed. PR Readiness is green on this head.

Done well: the fix reuses the single app-list fetcher instead of adding a second one, and the app-kit-platform spec narrows its earlier "changes nothing" sentence in the same commit.

Optional:

  • In BuiltinAppRoute.installedElsewhere.test.tsx test 1, set installed.apps = [{ name: 'shop' }] and rerender after the announce, then assert the compiled page appears. Today the test stops at the mc:apps-changed dispatch, so the swap away from the released state is not tested.
  • The Problem section says the sidebar stayed stale. The fix refreshes the rail only while a not-installed view is open. Other pages still rely on the focus and visibility re-read. A short reply to the First Principles note saying so would close it.

@bolichen97
bolichen97 merged commit 9bfa880 into main Nov 14, 2026
133 of 139 checks passed
@bolichen97
bolichen97 deleted the fix/smoke3-c1 branch November 14, 2026 12:41
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 14, 2026
buluoray added a commit that referenced this pull request Nov 14, 2026
…36347)

An open "X isn't installed" tab kept saying so after the app was
installed from the CLI or another tab, until a reload or a focus
change. The gateway already sends the app_reload frame for every
install, but only a mounted AppHost listened for it.

A new useAppInstalledElsewhere hook lets the two not-installed views
(AppPage after a 404, BuiltinAppRoute's released state) hear that
frame for their app: it fires mc:apps-changed so the shell re-reads
the installed-apps list, and AppPage also re-reads the app's record.

Part of #26967

Hand-resolved backport; original author: Bolin Chen.

(cherry picked from commit 9bfa880)
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.

2 participants