Title: fix(mothership): run same-workflow workflow tools in order instead of failing as busy by waleedlatif1 · Pull Request #8709 · simstudioai/sim · GitHub
Open Graph Title: fix(mothership): run same-workflow workflow tools in order instead of failing as busy by waleedlatif1 · Pull Request #8709 · simstudioai/sim
X Title: fix(mothership): run same-workflow workflow tools in order instead of failing as busy by waleedlatif1 · Pull Request #8709 · simstudioai/sim
Description: Summary When the agent issues several workflow run tools (run_block, run_workflow, run_from_block, run_workflow_until_block) against the same workflow in one step, the browser now runs them one after another, in the order they arrived. Before, every call after the first failed with WORKFLOW_EXECUTION_BUSY, and the agent had to spend a round re-issuing it. Why WORKFLOW_EXECUTION_BUSY is raised only in the browser (run-tool-execution.ts). The editor keeps one visible execution per workflow: the running flag, the current execution id, active blocks and the terminal pointer. Two runs of one workflow in a tab would overwrite each other, so the lock is right. Failing the queued calls is not: they are the agent's own fan-out, and nearly all of the busy results were this case, waiting behind a run tool from the same chat that finishes within seconds. Design One run slot per workflow. Each workflow has a single record, { owner, waiters }. The owner is either a run tool or an interrupted execution. acquireRunToolSlot, admitNextRunTool, releaseRunToolSlot and releaseInterruptedHold are the only functions that change it, and every run tool releases through releaseRunToolSlot. FIFO hand-off. A release passes the slot to the oldest waiter synchronously, so a call issued later can't take it first. Stop. stopRunToolExecutions removes stopped waiters and reports them cancelled without starting them. A call the server already took over is cancelled by the same Stop: the server's run uses the turn's abort signal. Chat recovery. bindRunToolToExecution treats a waiting call as owned by this tab, so recovery never starts it twice. It also re-sends a stored, undelivered completion even while another run owns the workflow, using the report's own execution id. Dropped streams. If a run's stream is interrupted while the server keeps executing it, that execution keeps the slot (owner interrupted), so a waiting call can't overwrite its terminal pointer. This is not run-tool ownership, so the editor's reconnect can still re-attach. The hold is released once two things are true: the server reports the execution settled (or 403/404), and no reconnect stream is still following it. Status is checked only while a call is actually waiting, never while a reconnect stream is open or the tab is hidden, and with backoff (max 15s). Once the server reports the execution settled, the browser stops asking and only waits for the reconnect to close. After repeated status errors it gives up and releases the hold. On release it clears any visible state that an abandoned reconnect left behind. Paused runs count as settled. A pause ends the stream and can last for days. What still returns BUSY: a run no run tool drives, such as the user's own run. That behaviour is unchanged. No queue timeout of its own: a call no browser claims within the server's pickup grace is run by the server. A late launch from the queue then gets the execute route's existing benign 409, so a workflow never runs twice and a long wait can't stall the agent. Tests run-tool-execution.test.ts covers: in-order runs; no skipping ahead during a hand-off; a stopped waiter is cancelled and never started; recovery doesn't double-start a waiter; a different workflow isn't held up; a dropped run holds the workflow until it settles; status is checked only while a call waits and no reconnect is open; an abandoned reconnect doesn't block the queue; a stored completion is re-sent while another run owns the workflow. Each regression test fails with its guard removed. apps/sim type-check, biome, check:audits, and the run-tool, editor-hook and home-hook suites pass. Verify In a browser chat, ask the agent to test several blocks of one workflow in parallel. The runs should appear one after another in the editor, every result should succeed with no busy errors, and Stop during the queue should cancel the remaining calls.
Open Graph Description: Summary When the agent issues several workflow run tools (run_block, run_workflow, run_from_block, run_workflow_until_block) against the same workflow in one step, the browser now runs them one aft...
X Description: Summary When the agent issues several workflow run tools (run_block, run_workflow, run_from_block, run_workflow_until_block) against the same workflow in one step, the browser now runs them one aft...
Opengraph URL: https://github.com/simstudioai/sim/pull/8709
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:2dc06809-41b0-fb50-44ef-16bc9fe2fcb1 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A5AE:F482B:4F2091:6E9E07:6AFB5DB2 |
| html-safe-nonce | ffdcf63a284fba095597120d7374b3ed00c6038942debc7ef91cb380ae4095e9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNUFFOkY0ODJCOjRGMjA5MTo2RTlFMDc6NkFGQjVEQjIiLCJ2aXNpdG9yX2lkIjoiNTI2MDI4NjI1MzM4MzkxOTg2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 0a9e96a061ddbefe0e311b6fd5b0188bb6403870857e1f886d0e47717716acd5 |
| hovercard-subject-tag | pull_request:4766282104 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/8709/files |
| twitter:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| og:image:alt | Summary When the agent issues several workflow run tools (run_block, run_workflow, run_from_block, run_workflow_until_block) against the same workflow in one step, the browser now runs them one aft... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | ea33d13c96d0ff66bd8fa906b193d2213536b78cb06b0c50a4632c58b1418f94 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 59ef97164c52cf59bd10558ddec9c4f482763988 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width