Skip to content

Plan bar: run-all plans offer Pause, not Run step N; the model is told not to end its reply between steps - #733

Merged
neuromechanist merged 7 commits into
developfrom
feature/issue-731-run-all-bar
Nov 11, 2026
Merged

neuromechanist merged 7 commits into
developfrom
feature/issue-731-run-all-bar

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Closes #731

Diagnosis

The main cause is how the widget decides that a reply is in flight; a model that ends its reply early is a secondary cause.

  • progressOf (frontend/osa-plan.js) returns paused whenever active is false. The widget passed active: isLoading || toolActivity !== null (the strip, the bar and the rail). But isLoading means "no visible text yet": handleStreamingResponse's reveal callback clears it as soon as the reply shows any text.
  • A run-all plan's steps are all answered inside one sendMessage (each execute_code request is answered on /chat/resume and its stream read in the same loop). So between two steps, once the model had written a sentence, isLoading was false while the reply was still running: the bar read "Paused after step N" with Run step N+1, and clicking it passed the if (isLoading) return; guard and sent a second /chat alongside the running reply.
  • Fix: a reply is in flight when currentReply !== null (set at the start of sendMessage, cleared in its finally) or a tool activity is on, at both call sites and in the click guard.
  • Secondary: a model can end its reply with text after a step (nothing continues a plan the model stops), which does leave a run-all plan waiting. run_mode reaches the model only as the "Run mode" line of the propose_plan result and, for NEMAR, as one weak clause in plan_first_instructions. The prompt is made explicit (below).
  • Server limits are not a cause: 20 runs per reply against at most 8 steps with 2 attempts each.

Change

Prompt (server):

  • src/assistants/nemar/config.yaml: the run_all branch now says the reader will not tell the model to continue, to call execute_code for the next step in the same turn after each result, to write no closing message until the last step has run (one sentence of what a step showed may come with the next call), and to summarize once at the end. Failure handling (item 6) is unchanged.
  • src/api/tool_results.py: for an approved run_all decision the Next: block gets the same instruction, deterministic, plus: an execute_code call left unanswered during a run-all plan means the reader paused before that step started; it never ran and is not a failed attempt.

Client:

  • Reply in flight is read from currentReply/tool activity, not isLoading (see the diagnosis).
  • Pause is offered only while a later step is left to hold (not on the last step), and a pending pause is cleared when the model proposes a new plan in the same reply.
  • Run step N is left out, not disabled, while a run-all plan runs. The plan goes on by itself, so there is nothing for the reader to press; a grayed button between every pair of steps reads as something to wait out, or as a plan that is missing something. The bar is Working on step N of M. with Pause and Stop plan.
  • Pause is client-side only. canPause(progress) (run-all, running or retrying) decides when it is offered; clicking sets currentReply.pausing. In continueBrowserReply, pauseDue(messages) (approved plan, the request is the first attempt of a step) leaves the next request for code unanswered, exactly as Stop plan does, and the reply ends with the plan still approved. The bar is then the paused one: Run step N+1, Change step N+1, Stop plan. A step that failed is tried again before the pause takes effect, since it has not finished. While Pause is asked and the step still runs, the bar says Pausing: ... with Stop plan only.
  • Run step N+1 after a pause on a run-all plan sends Continue with step N. It has not run: I paused before it started, so it is not a failed attempt. Run it now, then run the remaining steps without stopping. (the held step is kept on the plan as held), so the continuing reply is run-all too and the step is not counted as an attempt. A run-all reply that ended on its own gets Continue with step N, then run the remaining steps without stopping. A plan that pauses after each step is unchanged (Continue with step N., no Pause button).
  • The rail has no run buttons of its own; its rows, heading and Runs all steps foot read the same plan state, and the bar beside it follows the rules above (tested with the dialog raised, including text streamed between steps).
  • frontend/osa-plan.js changed, so frontend/osa-runtime.bundle.js and the integrity hash in the widget are rebuilt (bun scripts/build-runtime-bundle.js). Widget: OSAChatWidget.seed (open with a reply, send nothing); smooth open and dock; bottom-right Move to corner icon #730 also edits frontend/osa-chat-widget.js: the hash line is the one place both PRs will touch, rebuild after the merge of the second.

Docs: the "strip and bar" table, a note on why Run step N is absent and how Pause works, and the rail text in docs/community-widget.md; CHANGELOG entry.

Not verified here: the on-test.nemar.org check in the issue (a three-step run-all plan running to the end, Pause, then Run step). Whether the stronger wording makes the model stop ending its reply is a model behavior and needs that check; the client never ends a plan the model has ended, by design (see Pause's paused state, which is also what a run-all plan whose reply ended anyway shows).

Commands run

  • pytest tests/test_agents/test_plan_first.py tests/test_api/test_tool_results.py tests/test_api/test_propose_plan.py tests/test_frontend tests/test_scripts/test_plan_consistency.py -o addopts="": 364 passed.
  • ruff check src tests: passed; ruff format --check src tests: 301 files already formatted.
  • bun frontend/test-widget-plan-card.js: 338 passed, 0 failed; bun frontend/test-widget-plan-rail.js: 170 passed, 0 failed; bun frontend/test-plan-rail.js: 78 passed; all 45 frontend/test-*.js exit 0.
  • bun scripts/build-runtime-bundle.js then --check: "Runtime bundle is current".

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Preview Deployment

Name Link
Preview URL https://feature-issue-731-run-all-ba-demo.osc.earth
Branch feature/issue-731-run-all-bar
Commit 61f42ff

This preview will be updated automatically when you push new commits.

…ause on the last step; tell the model a held step never ran; a new plan clears a pause (Refs #731) (tested)
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Worker Deployment Required

Worker changes detected. After merging to main or develop, the workflow will automatically deploy the worker.

Manual deployment (if needed):

cd workers/osa-worker
wrangler deploy --env dev  # for develop branch
wrangler deploy            # for main branch

@neuromechanist

Copy link
Copy Markdown
Member Author

Review round 1 (Sonnet code reviewer): outcomes

# Severity Finding Outcome Commit
1 Critical The diagnosis was incomplete: isLoading is cleared once any text shows, so between steps active was false, the bar read paused with Run step N+1, and its click sent a concurrent /chat Fixed: "reply in flight" is currentReply !== null || toolActivity !== null at the bar and rail call sites, and if (currentReply) return; guards Run step. Tests stream text before steps 1 and 2 and sample the bar and the rail between steps (Pause and Stop plan only, never Run step; no second request), plus Pause pressed between steps after text. The reviewer's probe.mjs and probe2.mjs now show Pause and Stop plan. Prompt change kept. PR body, docs/community-widget.md and CHANGELOG corrected: the active computation is the main cause, a model ending its reply early the secondary one 674be4c, docs 06636d8
2 Important Pause was offered on the last step Fixed: canPause requires step < total (running and retrying); the pending "Pausing" text still shows when the held step is the last. Unit and widget tests added 674be4c
3 Important After a Pause the model saw the held step as a failed call Fixed: the held step is kept on the plan (held, stored), and Run step N sends Continue with step N. It has not run: I paused before it started, so it is not a failed attempt. Run it now, then run the remaining steps without stopping. (no last clause on the last step; a run-all reply that ended on its own is unchanged). The run_all Next: line also says an unanswered execute_code means the reader paused and never ran. Pinned in frontend/test-widget-plan-card.js and tests/test_api/test_tool_results.py 674be4c
4 Minor currentReply.pausing was never cleared Fixed: a new plan arriving in the same reply clears it (notePlanProposal); test where the new plan's step 1 is answered, not held 674be4c

…e and the send guard read currentReply, Run step N is grayed during an unrelated reply, the held note survives a failed send; the Next line says an unanswered call was not run (Refs #731) (tested)
@neuromechanist

Copy link
Copy Markdown
Member Author

Review round 2 (Sonnet code reviewer): outcomes

# Severity Finding Outcome Commit
Round 1 Critical, Important x2, Minor Reply in flight, Pause on the last step, the held step, a pause carrying into a new plan Confirmed resolved (probe.mjs and probe2.mjs show Pause and Stop plan between steps, with and without text) 674be4c, 06636d8
A Important replyWaitingOnAssistant() read isLoading, so the failed card lost its "attempt 2 of 2" line once text streamed Fixed: it reads currentReply !== null. Test streams text after a failed step and checks the retry line stays unchanged (it fails without the fix); probe3.mjs prints the line before and after the text. Other isLoading reads checked: the notebook card (said "once it is whole"), the sendMessage guard and hostAsk now also read currentReply; the loading bubble, its status label, the hidden empty assistant message, the handover card, suggestions and the history-sheet locks describe the "no text yet" state or a conversation switch, not plan or run state, and are left 0dd8ac2
B Minor The run_all Next: line said an unanswered call means the reader paused Reworded: "an execute_code call left unanswered during a run_all plan was not run (most likely the reader paused before that step started); it is not a failed attempt." test_tool_results.py updated 0dd8ac2
C Minor An unrelated question while a run-all plan waits showed Working and Pause for the whole answer Fixed: currentReply.forPlan is set by a plan proposal, by the bar's Run step N (pendingPlanSend) and by a run of the approved plan arriving; planReplyActive() is (currentReply !== null && currentReply.forPlan) || toolActivity !== null. During an unrelated reply Run step N is aria-disabled (opacity .45, not-allowed, the plan card's disabled style) and a click sends nothing. Tests (card and rail): unrelated question keeps the waiting bar and rail with Run step disabled, then enabled again after the answer; a Run-step reply shows Pause and Stop plan with text on screen; a hand-typed reply becomes the plan's once a run arrives 0dd8ac2
D Minor held was deleted before the send, so a failed send lost the note Fixed: sendMessage deletes it only after the server answers (serverAnswered). Test: Pause, Run step fails (no stream), second click carries the same note, and held is gone afterwards 0dd8ac2

Suites after the changes: pytest 364 passed; ruff clean; frontend/test-widget-plan-card.js 361 passed, test-widget-plan-rail.js 175 passed, test-plan-rail.js 78 passed, all 45 frontend/test-*.js exit 0; bun scripts/build-runtime-bundle.js --check current (osa-plan.js unchanged this round).

@neuromechanist
neuromechanist merged commit b45b65e into develop Nov 11, 2026
13 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-731-run-all-bar branch November 11, 2026 23:11
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.

1 participant