Skip to content

fix(execution): resume a run into the workspace it started in - #139

Merged
harenome merged 1 commit into
ThinkFlowLab:mainfrom
harenome:fix/resume-run-into-its-workspace
Nov 16, 2026
Merged

harenome merged 1 commit into
ThinkFlowLab:mainfrom
harenome:fix/resume-run-into-its-workspace

Conversation

@harenome

Copy link
Copy Markdown
Collaborator

Closes #138

What

A run started from the page records the name of its workspace in run.json (field workspace). At start-up, the app adds each run that it picks up again to that workspace, when the workspace still exists. Without this, a restarted app has no workspace open. It looks for a workspace that holds exactly the run's roots, and a workspace that also holds other roots does not match. Thus each restart makes a new workspace with a random name.

  • Execution.workspace is saved with the record. Execution.file_under(name) sets it. A record without the field loads with "".
  • shared.adopt_runs(runs) adds started runs to a workspace, as adopt_roots does, and records its name in each run. The builder's Run, the agent port check and the benchmark proofs use it.
  • adopt_roots(..., into=name) adds the roots to the named workspace when it exists. It opens that workspace only when no workspace is open. When the workspace does not exist, the behaviour does not change.
  • app.py passes into=ex.workspace for each restored run.

A record without the field, or one that names a deleted workspace, gets a workspace as before. The workspace that is open at start-up does not change for other reasons.

Touches

backend · routes · docs and site

Verified

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

  • New route test ResumeIntoWorkspace in app/ui_tests/test_run_routes.py. It opens a workspace that holds two roots, starts a run through POST /run that pauses after its first part, stops the app, and calls main() with a fresh state. On main it fails: AssertionError: 'eager-ferret' != 'witty-pelican'. With this change it passes. Two more cases pass on both: a record that names a deleted workspace, and a record without the field.

  • The real app: started over /r/a /r/b, a run with one part sleep 120 started through POST /run, the app stopped while the run goes on, then started again without arguments.

    Case main This branch
    Run recorded with its workspace a second workspace holds only the run's job the run is back in its workspace; 1 workspace
    workspace removed from run.json (same as above) a second workspace holds only the run's job, as on main
    Every workspace deleted before the restart (same as above) one new workspace holds the run's job

    In each case the log says Run p picked up again on this machine (running), with no error.

  • Backend suite, python3 app/tests/parallel.py: 1988 tests in 116 modules, OK.

  • Route suite, python3 app/tests/parallel.py app/ui_tests: 325 tests in 40 modules, OK (322 on main).

Risk

A rename changes a workspace's name, so a run recorded before the rename gets a workspace as on main at the next restart. If the change is wrong, a restored run goes into the wrong workspace: its job is only listed there, and no data moves or is deleted. A revert undoes it, and the extra workspace field in run.json is then ignored.

A run started from the page records the name of the workspace its job
went into, in run.json. At start-up, a run picked up again goes back into
that workspace while it exists. Before, a restarted app had no workspace
open and matched one by its exact roots, so a workspace that held other
runs too did not match and each restart made a new workspace.

A record without the name, or one that names a deleted workspace, gets a
workspace as before.
@harenome
harenome merged commit 4648c75 into ThinkFlowLab:main Nov 16, 2026
2 checks passed
@harenome
harenome deleted the fix/resume-run-into-its-workspace branch November 16, 2026 10:40
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 while a run goes on puts the run in a new workspace

1 participant