Skip to content

fix(webui): track current run on relaunch, support run-scoped services, and streamline group toggle - #313

Merged
bpiwowar merged 6 commits into
experimaestro:masterfrom
VictorMorand:feat/runid-loading-services
Nov 4, 2026
Merged

bpiwowar merged 6 commits into
experimaestro:masterfrom
VictorMorand:feat/runid-loading-services

Conversation

@VictorMorand

Copy link
Copy Markdown
Contributor

Summary

This PR addresses two issues with run tracking and service inspection in the WebUI when an experiment is relaunched or when inspecting services across runs, plus a UI layout enhancement for collapsing/expanding task/experiment groups:

1. Track current run on relaunch & cache invalidation

  • In WorkspaceStateProvider._on_experiment_events_created, clear the experiment cache and emit ExperimentUpdatedEvent unconditionally so newly discovered runs become current immediately.
  • In StateProvider.apply_event and WorkspaceStateProvider._handle_experiment_event, invalidate cached experiment queries ("current_run", "jobs", etc.) when receiving events associated with a new run, preventing stale query cache hits or job pollution across runs.
  • In the WebUI Redux store (reducers.ts), when viewing "Current run" (currentRun === null) and current_run_id changes for the active experiment, clear cached jobs and jobsRequested to trigger an automatic reload of the new run's jobs.

2. Run-scoped services & service cache invalidation

  • In experiment.py, include experiment_id and run_id in ServiceAddedEvent and RunCompletedEvent.
  • In StateProvider.apply_event, drop cached ("services", ...) queries when ServiceAddedEvent arrives so newly added services appear without restarting the app.
  • Support run_id in service_operations.find_service, WebUI WebSocket handlers (services, service.start, service.stop), proxy routes, and service log endpoints.
  • In the WebUI, render <RunSelector /> in the services view, pass runId down to all service actions/links/logs, and scope service Redux keys by run (${experiment_id}/${run_id}/${id}).

3. Merged Collapse/Expand Groups Button

  • Replace separate "Expand all" and "Collapse all" buttons with a single toggle button positioned to the left of the search/filter input in both Tasks and Experiments views.
  • Add CollapseExpandIcon rendering vertical >< (collapse) / <> (expand) with clear chevron spacing and centering.

Testing

  • Unit tests added to test_state_cache.py (test_current_run_invalidated_on_new_run_event and test_service_added_event_invalidates_services_cache).
  • All existing tests pass (test_state_cache.py, test_webui_websocket.py, test_webui_serialization.py, UI driver tests).

VictorMorand and others added 6 commits November 4, 2026 13:23
…ices

- Invalidate StateProvider and WorkspaceStateProvider experiment query cache on new run events so current run updates on relaunch
- Add experiment_id and run_id to ServiceAddedEvent and RunCompletedEvent, and invalidate services query cache on ServiceAddedEvent
- Support runId in find_service, WebUI WebSocket handlers, proxy routes, and logs routes
- Scope WebUI service keys by run (${experiment_id}/${run_id}/${id}) and render RunSelector in the services view
- Clear cached jobs in Redux when current_run_id changes for the active experiment
- Rebuild frontend production bundle and add query cache unit tests
…search

- Add CollapseExpandIcon rendering vertical >< (collapse) / <> (expand)
- Merge separate expand and collapse buttons into a single toggle button
- Relocate toggle button directly to the left of the search/filter input
- Rebuild frontend production bundle
- Service state changes update the cached services in place; a new service
  only drops the cached lists of its run that miss it (the started service
  instances are kept)
- No cache wipe on any event of another run: run/experiment events do it
- get_services resolves an empty run id (events without a run) to the
  current run
- Factor the jobs reset on run change in the reducer, remove unused
  _in_thread kwargs, ruff format
- Tests: services cache, run-scoped services over the WebSocket (scenario
  service in a former run); docs; rebuilt frontend

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The button was small (forced to 31px in the jobs toolbar) next to a
default-size input: it now has the default size, like the input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
event_run_id() reads the run id of the events that belong to a run,
instead of getattr().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	src/experimaestro/webui/data/index.js
@bpiwowar
bpiwowar merged commit 44732b2 into experimaestro:master Nov 4, 2026
@VictorMorand
VictorMorand deleted the feat/runid-loading-services branch November 4, 2026 17:37
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