Skip to content

fix(web): keep a renamed workspace's runs in it across a restart - #262

Merged
harenome merged 2 commits into
ThinkFlowLab:mainfrom
harenome:fix/rename-keeps-runs
Nov 20, 2026
Merged

harenome merged 2 commits into
ThinkFlowLab:mainfrom
harenome:fix/rename-keeps-runs

Conversation

@harenome

Copy link
Copy Markdown
Collaborator

Closes #256

What

Two commits.

  1. A name that no workspace has no longer falls back to the open one (shared.adopt_roots). At a restart, app.py puts each resumed run back with adopt_roots([ex.jobs], into=ex.workspace). When into did not load, the run's job root went into the workspace open at the time, which never held it. Now a missing into is treated like the case where nothing is open: the roots go to the workspace that holds exactly them, or to a new one. That workspace is opened only when nothing else is open, so the open workspace stays open, as A restart opens the run's workspace, not the workspace that was open #157 requires. Callers that pass into from a form check that it exists first, so only the restart reaches this path.
  2. A rename re-files the workspace's runs (workspaces.workspace_rename). Every run record is loaded in execution.EXECUTIONS, from restore at start or from start. After the directory moves, each record filed under the old name is filed under the new one with file_under, which saves run.json under the record's lock. A restart then puts the run back in the renamed workspace.

Touches

routes (web/shared.py, web/workspaces.py) · docs (docs/builder.md) · tests

Verified

In a rootless Podman container (python:3.12, with uv for the Harbor build fixtures):

  • python3 app/tests/parallel.py: 3104 tests in 157 modules, OK.
  • pip install -r app/requirements.txt, then python3 app/tests/parallel.py app/ui_tests: 557 tests in 56 modules, OK.
  • New tests in ui_tests/test_run_routes.py, ResumeIntoWorkspace. Each starts a real run from /run and restarts through app.main:
    • test_a_rename_refiles_the_run_and_a_restart_puts_it_back_in_the_renamed_workspace: the rename route rewrites run.json. After the restart, the run is in the renamed workspace and not in the open one.
    • test_a_run_filed_under_a_name_no_workspace_has_stays_out_of_the_open_one: the issue's case, a record that still names the old workspace. The open workspace stays open and does not gain the run.
    • Both tests fail on main.
  • The issue's test (test_rename_keeps_runs.py) passes on this branch.

Not checked: a real nullius serve restart with a live run after a rename.

Risk

  • Only records that this process has loaded are re-filed. A record under another RUNS_DIR than the one this server reads keeps the old name. At its restart, that run gets a workspace of its own and is never added to the open one.
  • A run whose workspace was deleted now gets a new workspace that stays closed while another one is open. Before, the run was added to the open workspace. With nothing open, nothing changes.
  • To undo, revert the commits.

…s gone

adopt_roots(into=name) fell back to the open workspace when no workspace
had that name, so a restart after a rename added the run's job root to a
workspace that never held it. A missing name now finds or makes one as
when nothing is open, and leaves the open workspace open.
run.json names the workspace a restart puts the run back in; a rename
moved the workspace's directory and left that name behind.
@harenome
harenome merged commit d00c8e9 into ThinkFlowLab:main Nov 20, 2026
2 checks passed
@harenome
harenome deleted the fix/rename-keeps-runs branch November 20, 2026 13:13
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.

Workspaces: after a rename, a restart adds a resumed run to the workspace that is open

1 participant