The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
Web new-version notice Implementation Plan
For agentic workers: Work task by task, test first (project instructions, revision 26: Engineer role, not subagent-driven-development). Steps use checkbox (
- [ ]) syntax. There is no Execution Handoff: the Engineer goes on to implement.
Goal: An open Harness web page says so within minutes of a new web release ("A new version of Harness is ready." with Reload), Reload loads the new build, and the account menu shows the running version ("Harness X.Y.Z").
Architecture: The host already serves release.json (no-store, written by scripts/build-web-release.sh, read at start-up by webReleaseVersion for the running version). A new WebUpdateWatcher re-reads it every few minutes, once at start-up and when the tab comes back to the front, and says "new" when it names a version other than the one this page was built as (compiled in by build-web-release.sh, since a page an old cache keeps would otherwise take the host's version for its own). A quiet bar at the top of the page (WebUpdateFrame, inside the store frame, above the app) shows it; Reload clears any old service worker and its caches, then reloads. The account menu takes the running version as an optional line, given only by the web build. Desktop (native) draws and does nothing new.
Tech Stack: Flutter web (desktop/), package:web, flutter_test.
Spec: Task #2185 (Huy). Mockup posted in the project chat: a bar "A new version of Harness is ready. Reload", and "Harness 1.3.51" under Settings · Sign out in the account menu. No server or website change: the website's release.json and index.html are already no-store (website/next.config.js), and releases already start no service worker (website/scripts/harness-web-assets.mjs).
Design
- growth: N/A because nothing is stored; the page keeps one watcher and one timer.
- concurrency: N/A because the page only reads; two tabs each read for themselves.
- read cost: one small file (
release.json,no-store) per open page every 5 minutes and when the tab comes back to the front; nothing is read once the bar shows. - scale: 10x the open pages is 10x a few hundred bytes every 5 minutes; the host's request rate for
/harness-web/release.jsonis the metric that warns first. - compatibility: an old page without this code shows nothing and is not affected; a new page on a host without
release.json(flutter run) never shows the bar. - migration + rollback: none; reverting the PR removes the bar, the timer and the menu line. A build's own version is compiled in (
--dart-define=HARNESS_BUILD_VERSION), so a page an old cache keeps still knows it is out of date (review of #2622). - audience: N/A because the file and the version are public.
- identity: N/A because no account is involved.
- failure: an unreadable
release.jsonchanges nothing (no bar, none cleared); Reload's cleanup steps may each fail and the page still reloads. - platforms: browser only; Desktop draws and runs nothing new.
Global Constraints
- The pull request body starts with:
Requested by [email protected] through Harness. - Web only; Desktop unchanged: the native app shows no bar and no version line, and runs no timer.
- A change people see follows the Harness design language (the quiet bar matches the store bar's surface and type).
- Before each web release a Tester checks the web build in Safari in the iPhone simulator on Tony's Mac (keyboard, top bar) and in a desktop browser.
- Copy exactly: "A new version of Harness is ready." / "Reload" / "Harness X.Y.Z".
Review Focus
- A release.json that cannot be read (offline, 404, odd body) never shows the bar and never clears one already shown.
- The same version shows nothing; a different one (a newer release, or a rollback) shows the bar once, however many checks follow.
- A page that could not tell its own version at start-up never shows the bar (it would show for every release).
- The bar must not remount the app below it, and must not sit under a phone's top inset or the store bar.
- Reload with an old service worker or cache registered still loads the new build.
- Desktop's account menu is unchanged (no version line unless the web gives one).
Task 1: The watcher
Files:
- Create:
desktop/lib/web/update/web_update_watcher.dart - Test:
desktop/test/web_update_watcher_test.dart
Interfaces:
Produces:
class WebUpdateWatcher extends ChangeNotifier { WebUpdateWatcher({required String? running, required Future<String?> Function() readLatest, Duration every = const Duration(minutes: 5)}); bool get updateReady; Future<void> check(); void start(); void dispose(); }Step 1: Write the failing tests
a different version is ready, the same one is not,an unreadable manifest changes nothing, before or after the bar shows,a page that does not know its own version never says ready,it checks again every interval until disposed,many checks tell listeners once.Step 2: Run, expect FAIL (
cd desktop && flutter test --no-pub test/web_update_watcher_test.dart): file missing.Step 3: Implement
WebUpdateWatcherwithTimer.periodic;updateReadyis latched true once a read names a version different fromrunning.Step 4: Run, expect PASS.
Step 5: Commit test, then code.
Task 2: The bar
Files:
- Create:
desktop/lib/web/update/web_update_bar.dart(WebUpdateFrame,WebUpdateBar) - Modify:
desktop/lib/web/web_entry.dart(appFrame) - Test:
desktop/test/web_update_bar_test.dart
Interfaces:
Consumes: Task 1.
Produces:
WebUpdateFrame({required WebUpdateWatcher watcher, required VoidCallback reload, required Widget child}); keysweb-update-bar,web-update-reload.Step 1: Write the failing tests: ready shows the bar with the exact words and Reload calls
reloadonce; not ready shows nothing; the child's state survives the bar appearing; the bar is a quiet strip in the store bar's colors.Step 2: Run, expect FAIL.
Step 3: Implement the frame (one Column shape whether or not the bar shows,
SafeArea(bottom: false)on the bar,MediaQuery.removePadding(removeTop: true)for the child while it shows); wire it inappFrameinsideWebAppStoreFrame.Step 4: Run, expect PASS.
Step 5: Commit test, then code.
Task 3: The account menu's version
Files:
- Modify:
desktop/lib/widgets/account_menu.dart,desktop/lib/screens/swarm_screen.dart(_showAccountMenu) - Test:
desktop/test/account_menu_version_test.dart
Interfaces:
Produces:
AccountMenu(version: String?)andshowAccountMenu(version:); keyaccount-menu-version, textHarness $versionunder the last row.Step 1: Write the failing tests: with a version the menu says "Harness 1.3.51"; with none (Desktop) there is no such line.
Step 2: Run, expect FAIL.
Step 3: Implement;
swarm_screen.dartpassesdeclaredAppVersiononly whenkIsWeb.Step 4: Run, expect PASS.
Step 5: Commit test, then code.
Task 4: Reload that really loads the new build, and the timer
Files:
- Modify:
desktop/lib/web/parts/page_reload_web.dart,desktop/lib/web/parts/page_reload.dart,desktop/lib/web/web_entry.dart - Test:
desktop/test/web/web_reload_test.dart(browser)
Interfaces:
Produces:
Future<void> reloadForNewVersion(): unregisters every service worker and deletes every cache of the page, then reloads; native is a no-op. The watcher is started inappFrameand also checks when the tab turns visible.Step 1: Write the failing browser test: with a service worker registration and a cache present,
reloadForNewVersionremoves both before the reload it asks for (reload injected).Step 2: Run, expect FAIL (
flutter test --platform chrome test/web/web_reload_test.dart).Step 3: Implement with
package:web; each step in try/catch so a refusal still reloads.Step 4: Run, expect PASS; then the whole
test/webandanalyze.Step 5: Commit test, then code.