Skip to content

fix(web): reopen the open workspace after a restart, not the run's - #158

Merged
harenome merged 2 commits into
ThinkFlowLab:mainfrom
harenome:fix/restart-keeps-open-workspace
Nov 16, 2026
Merged

harenome merged 2 commits into
ThinkFlowLab:mainfrom
harenome:fix/restart-keeps-open-workspace

Conversation

@harenome

Copy link
Copy Markdown
Collaborator

Closes #157

What

A restart without job paths showed the first steps of the Runs page, or the workspace of a run that it picked up again. Now it reopens the workspace that was open.

  • shared.adopt_roots(..., into=name) adds the job of a run picked up again to its workspace and does not open that workspace. Before, it opened the workspace when none was open.
  • At start-up without job paths, main reopens the workspace opened last (workspace.last_open, the first of workspace.list_all, which sorts by opened). This occurs before the app picks up runs again.
  • Close marks the open workspace as closed in its workspace.json. A restart then opens no workspace. Opening the workspace again clears the mark.
  • Job paths at start-up still select the workspace. Without workspaces, the first steps show, as before.
  • A run whose record names no workspace goes into the reopened workspace. When no workspace reopens, it gets a new workspace, as before.

Touches

backend · routes · docs and site

Verified

On main (b11083b) and on this branch, each in a clean rootless container (python:3.12, a temporary NULLIUS_HOME).

The real app: workspace alpha over /r/a, workspace bravo over /r/b, a run with one part sleep 300 started from bravo through POST /run. Then the action in the first column, the app stops, and the app starts again.

Before the restart Restart main This branch
alpha open, the run goes on no arguments bravo open alpha open, the run's job in bravo
alpha open, no run no arguments no workspace open alpha open
Close, the run goes on no arguments bravo open no workspace open, the run's job in bravo
the open bravo deleted, no run no arguments no workspace open alpha open (opened last)
alpha open, no run over /r/b bravo open bravo open
no workspace no arguments first steps first steps
alpha open, /r/a removed, no run no arguments no workspace open alpha open, as Open does
alpha open, WORKSPACES_DIR set, no run no arguments no workspace open alpha open, from WORKSPACES_DIR

Tests:

  • ReopenAtStart and ResumeIntoWorkspace in app/ui_tests/test_run_routes.py: 9 tests. With these tests on main, 5 fail. On this branch, all pass.
  • Lifecycle.test_last_open_is_the_latest_unless_the_user_closed_it in app/tests/test_workspace.py.
  • Backend suite, python3 app/tests/parallel.py: 2046 tests in 119 modules, OK.
  • Route suite, python3 app/tests/parallel.py app/ui_tests: 353 tests in 42 modules, OK.

Risk

The start-up changes for every user: a start without job paths now opens the workspace opened last, unless the user closed it. At start-up, the app converts the foreign roots of that workspace before it serves, as Open does. If the change is wrong, the wrong workspace opens. The user can open another one or close it. No data moves or is deleted. A workspace saved by this version has a closed field, which older versions ignore. A revert undoes it.

At start-up, a run picked up again went back into its workspace and also
opened it when no workspace was open. A restart without arguments thus
opened the workspace of the run, not the first steps, and marked it as
the workspace opened last. Add the job to its workspace and leave it
closed.
A start with no job path given showed the first steps, and the user had
to open the workspace again. Reopen the workspace opened last. Job paths
given at start-up still decide. Close marks the workspace as closed, so a
restart leaves it closed. Opening it again clears the mark.

Reopen before restored runs go back into their workspaces. A run whose
record names no workspace now goes into the reopened one.
@harenome
harenome merged commit 2371a16 into ThinkFlowLab:main Nov 16, 2026
2 checks passed
@harenome
harenome deleted the fix/restart-keeps-open-workspace branch November 16, 2026 15:39
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.

A restart opens the run's workspace, not the workspace that was open

1 participant