Skip to content

Makes long-running Apps tool APIs run properly in background (BL-16350)#7961

Merged
andrew-polk merged 1 commit into
masterfrom
improveAppsApi
Jun 22, 2026
Merged

Makes long-running Apps tool APIs run properly in background (BL-16350)#7961
andrew-polk merged 1 commit into
masterfrom
improveAppsApi

Conversation

@JohnThomson

@JohnThomson JohnThomson commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Several Apps tool APIs, especially Build, were made to kick off a background task and then return; task completion signaled by websocket.
Enhanced so if you return to the tool and build is still running, it gets back into a state indicating the progress of the build.
Also, Build is now more appropriately enabled; you don't have to do Customize first if all the required settings are already known.


This change is Reviewable

Devin review

@greptile-apps

greptile-apps Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR converts the three long-running Apps tool APIs (prepare, build, install) from synchronous blocking handlers into fire-and-forget Task.Run background tasks that complete via a new actionComplete websocket event, and adds server-side progress state so the UI can restore its busy indicator after switching tabs mid-build.

  • C# backend: TryBeginAction uses Interlocked.CompareExchange for an atomic concurrency guard; volatile fields expose the latest progress stage/percent through GetStatus(); ClearAction + SendActionCompleteEvent are called in the correct order in finally blocks; requiresSync: false is applied to all five read/action endpoints.
  • TypeScript frontend: busyActionRef tracks the latest action in async contexts; the isActive effect now snapshots server state before resetting the BloomPUB cache (skipping the reset when a build is in progress); a new useSubscribeToWebSocketForStringMessage handler processes actionComplete events; refreshStatus recovers stale busy state on remount.
  • UI: The requiresSubscription overlay no longer flashes while featureStatus is loading; the Build button no longer requires a detected change (buildIsNeeded removed) — it is enabled whenever prepare has run and required settings are present.

Important Files Changed

Filename Overview
src/BloomExe/Publish/Rab/RabPublishApi.cs Replaced synchronous RegisterAsyncEndpointHandler calls with fire-and-forget Task.Run pattern; TryBeginAction provides atomic concurrency guard; previous review concerns addressed
src/BloomExe/Publish/Rab/RabProjectService.cs Added TryBeginAction (Interlocked.CompareExchange), ClearAction, SendActionCompleteEvent; volatile progress fields; GetStatus exposes active action/progress; Prepare() early-return path does not propagate failure to succeeded flag
src/BloomExe/Publish/Rab/RabProjectModels.cs Added ActiveAction, ActiveActionProgressStage, ActiveActionProgressPercent to RabProjectStatus DTO for mid-session remount recovery
src/BloomBrowserUI/publish/Apps/useAppBuilderPublisherScreen.ts Added busyActionRef, remount-recovery logic in refreshStatus, tab-activation effect reworked, runAction switches to post, actionComplete websocket subscription added
src/BloomBrowserUI/publish/Apps/appBuilderShared.ts Extended IAppBuilderStatus/IAppBuilderStatusApi with activeAction/progress fields; dual-casing normalization in normalizeStatus; kAppBuilderActionCompleteEventId constant added
src/BloomBrowserUI/publish/Apps/AppPublisherScreen.tsx Removed buildIsNeeded from Build button enabled guard so the button is available whenever settings are present, not only when a change is detected
src/BloomBrowserUI/react_components/requiresSubscription.tsx Fixed overlay flashing while featureStatus is loading by adding featureStatus === undefined guard
src/BloomExe/web/controllers/FeatureStatusApi.cs Added requiresSync: false to the feature-status endpoint; safe read-only handler

Reviews (9): Last reviewed commit: "Makes long-running Apps tool APIs run pr..." | Re-trigger Greptile

Comment thread src/BloomExe/Publish/Rab/RabPublishApi.cs
Comment thread src/BloomExe/Publish/Rab/RabProjectService.cs Outdated

@andrew-polk andrew-polk left a comment

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.

devin found some stuff...

@andrew-polk reviewed 8 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on JohnThomson).

@JohnThomson JohnThomson left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@JohnThomson made 1 comment and resolved 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on JohnThomson).

Comment thread src/BloomExe/Publish/Rab/RabProjectService.cs Outdated
@JohnThomson JohnThomson self-assigned this Jun 16, 2026
@JohnThomson JohnThomson force-pushed the improveAppsApi branch 5 times, most recently from b3453a2 to 2dcfd1e Compare June 17, 2026 16:14
Several Apps tool APIs, especially Build, were made to kick off a background task and then return; task completion signaled by websocket.
Enhanced so if you return to the tool and build is still running, it gets back into a state indicating the progress of the build.
Also, Build is now more appropriately enabled; you don't have to do Customize first if all the required settings are already known.

@JohnThomson JohnThomson left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Devin seems to be (finally!) happy as of 724ef4a

@JohnThomson made 1 comment.
Reviewable status: 5 of 8 files reviewed, all discussions resolved (waiting on andrew-polk).

@andrew-polk andrew-polk left a comment

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.

@andrew-polk reviewed 3 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on JohnThomson).

@andrew-polk andrew-polk left a comment

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.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on JohnThomson).

@andrew-polk andrew-polk merged commit a5e0af9 into master Jun 22, 2026
2 checks passed
@andrew-polk andrew-polk deleted the improveAppsApi branch June 22, 2026 20:57
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.

3 participants