Pause and resume browser optimization studies - #9606
Draft
kube wants to merge 4 commits into
Draft
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
kube
added this pull request to stack #9549
September 9, 2026 05:07
kube
force-pushed
the
claude/opt-proto-pause-resume
branch
from
September 9, 2026 12:45
d748dbd to
89e6fa3
Compare
kube
force-pushed
the
claude/opt-proto-pause-resume
branch
from
September 9, 2026 13:32
89e6fa3 to
13580cf
Compare
kube
force-pushed
the
claude/opt-proto-pause-resume
branch
from
September 9, 2026 13:51
13580cf to
306caf0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Experimental
Behind the In-browser optimization feature flag.
Summary
Before this PR, the only way to interrupt a browser study was Stop, which pruned the steps in flight and left them uncounted. Stopping and failing refined the best point on their own, so an interrupted study started computing before anyone asked.
This PR adds Pause. The Python loop asks the sampler for nothing more, awaits the evaluations in flight, tells and reports every one, and returns a paused summary; the worker posts
pausedand the segment ends with apausedevent that keeps the study resumable. The record reads Paused at the click, the header counts the steps still finishing, every card takes the paused tone, and the footer offers Resume, which runs the steps the study still owes on the same sampler, and Run at the best configuration, with Remove in a More actions menu. Pausing, stopping and failing park the controls at the best step without computing anything there; only completion refines the best point on its own.Links
Changes
Python
run_studytakesis_pausedand drainsrun_browser_studytakesis_pausedas its sixth argumentCore browser runtime
pausedevent in the schema andpauseOptimizationRunon the connected capabilitypausepauseOptimizationRunpostspausewithout aborting the segment's signalbrowser/README.mdsegment diagram gainspausedand a paragraph on who owns pausingProvider
OptimizationStatusgainspaused;pauseOptimization,resumeOptimizationandrefineOptimizationBeston the contextsettleOnBestrefines only on a complete outcomeStudy view
tone="paused"while pausedConnected study, pausedfor the drawer and the full viewKnown issues
pausedNext steps
Test coverage
test_ask_tell.py,test_pyodide_entry.py:optimization.test.ts,run-log.test.ts,attach-optimizer-worker.test.ts,browser-optimization.test.ts:study-runner.pyodide.test.ts:connected-study.test.ts,provider.test.tsx:study-header.test.tsx,view-optimization-drawer.test.tsx:How to test
In the browser
Profit, direction Maximize, tick Optimize production_rate, set Optimization steps to 12, RunPython
cd libs/@local/petrinaut-optimizer-core && uv run pytest -q