René's URL Explorer Experiment


Title: fix(mothership): leave desktop tool calls to the desktop app in other clients by waleedlatif1 · Pull Request #8562 · simstudioai/sim · GitHub

Open Graph Title: fix(mothership): leave desktop tool calls to the desktop app in other clients by waleedlatif1 · Pull Request #8562 · simstudioai/sim

X Title: fix(mothership): leave desktop tool calls to the desktop app in other clients by waleedlatif1 · Pull Request #8562 · simstudioai/sim

Description: Summary A Chat open in the desktop app and in a web tab at the same time could lose a browser or terminal tool's real result: the agent got an error instead Every client tailing a chat starts each client-executed call it sees. A web tab has no desktop bridge, so for a desktop tool it fails at once and posts an error to /api/copilot/confirm. The confirm route takes a pre-claim error while the call is still pending, so the web tab's error usually lands before the desktop claims the call (the desktop restores its browser scope first). The desktop's claim then 404s, and its retried reports 404 too Fix: the stream tool-event handler starts a desktop-only tool (agent browser, terminal, local files) only in the desktop app. Any other client leaves the call pending for the desktop, which claims it atomically through /api/desktop/tool/authorize as before isDesktopExecutedToolCall now names that set in client-executed-tools.ts, and isClientExecutedToolCall is built from it, so the gate and the client-executed set can't drift apart Workflow tools are unchanged: they still start in any client, and their claim settles who runs them Design notes Rejected: a server-side owner check on confirm. Native claims record a constant owner (desktop-browser/desktop-terminal), not which client holds them, and the desktop renderer's pre-claim errors (stale event, closed session, replay-guard limits) need the pre-claim path. Telling the web tab and the desktop apart would mean trusting a client header, or adding a per-client claim token across Electron main, the renderer and the server, which old desktop builds don't send Rejected: changing the 404 on a late confirm for an already-finished native call to a 200 or 409. With this fix that 404 no longer happens in this scenario. A native confirm carries no executor identity, so a 200 would tell a client its result was accepted when it was thrown away Behavior changes Web only (no desktop app): no change. The server offers browser, terminal and local-file tools only when the request reports desktop capabilities, so a web-only turn never gets these calls Desktop and a web tab open together: the desktop's result reaches the agent. The web tab shows the call as running until the result streams in Desktop app (any shell version): no change. The renderer is served by Sim, and every shell injects the bridge the gate checks If the desktop app quits for good while a web tab stays open, and the agent then issues a desktop tool, the call is no longer failed right away with a misleading "no active browser session" error from the web tab. It now ends on the worker's deferred-call timeout, the same as when no web tab is open. A desktop that exits mid-action still reports through its page-exit path, as before Not covered here: two desktop windows on the same chat both try the call. The losing window's rejected claim is still reported as an error. This predates this PR and is unchanged by it. Fixing it needs a per-window claim identity Type of Change Bug fix Testing New lib/mothership/tools/client/desktop-tool-executor.integration.ts runs against real Postgres and Redis. A web tab runs the production stream handler and client executors. The desktop claims through the real authorize route and reports through the real confirm route. The server-side waiter shows what the agent receives. Covers browser_find and terminal Red on origin/staging: the desktop's claim gets 404 and the agent receives the web tab's error Green with the fix: the claim returns 200, the confirm returns 200, the agent receives success, and the row is completed handle-tool-event.test.ts: the existing desktop routing tests now set the desktop bridge explicitly Reverting the gate turns the integration test red again bun run lint, bun run type-check (apps/sim), bun run check:audits, docs-manifest:check, block-registry check, root bun run test Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing (new tests pass the test-audit authoring gate) No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Open Graph Description: Summary A Chat open in the desktop app and in a web tab at the same time could lose a browser or terminal tool's real result: the agent got an error instead Every client tailing a chat starts ...

X Description: Summary A Chat open in the desktop app and in a web tab at the same time could lose a browser or terminal tool's real result: the agent got an error instead Every client tailing a chat sta...

Opengraph URL: https://github.com/simstudioai/sim/pull/8562

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,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-controllerpull_requests
route-actionfiles
fetch-noncev2:0a0d2258-a25d-e9e2-5b01-51b0ddc837bf
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idBBEC:2833F1:AFC558:F13999:6AFB51A5
html-safe-nonce4cd6b4746c67a6720479fcea5de2c0419ef28e89b8835561aa399c4726b6c771
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQkVDOjI4MzNGMTpBRkM1NTg6RjEzOTk5OjZBRkI1MUE1IiwidmlzaXRvcl9pZCI6IjE0MzYzNTk4NzE1NzcxNDk4NjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac99d6e3f4d229838a9e088815ae1c0127017ceb5c57718af4a311f1f9a0266814
hovercard-subject-tagpull_request:4714110640
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/8562/files
twitter:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
og:image:altSummary A Chat open in the desktop app and in a web tab at the same time could lose a browser or terminal tool's real result: the agent got an error instead Every client tailing a chat starts ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None7122bb414b542dba14d71a3f0b9f6fd2abce715b9f5912d082800563e6c806d1
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasecbf66c024bb6d10e6955baa7413c54cf13a201bb
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/8562/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F8562%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F8562%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/8562/files
Reloadhttps://github.com/simstudioai/sim/pull/8562/files
Reloadhttps://github.com/simstudioai/sim/pull/8562/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests197 (197)https://github.com/simstudioai/sim/pulls
Actionshttps://github.com/simstudioai/sim/actions
Projectshttps://github.com/simstudioai/sim/projects
Security and qualityhttps://github.com/simstudioai/sim/security
Insightshttps://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
waleedlatif1https://github.com/waleedlatif1
staginghttps://github.com/simstudioai/sim/tree/staging
fix/mothership-browser-tool-single-executorhttps://github.com/simstudioai/sim/tree/fix/mothership-browser-tool-single-executor
Conversation 14 https://github.com/simstudioai/sim/pull/8562
Commits 2 https://github.com/simstudioai/sim/pull/8562/commits
Checks 33 https://github.com/simstudioai/sim/pull/8562/checks
Files changed https://github.com/simstudioai/sim/pull/8562/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8562/files
fix(mothership): leave desktop tool calls to the desktop app in other clients https://github.com/simstudioai/sim/pull/8562/files#top
Show all changes 2 commits https://github.com/simstudioai/sim/pull/8562/files
10494cb fix(mothership): leave desktop tool calls to the desktop app in other… waleedlatif1 Oct 2, 2026 https://github.com/simstudioai/sim/pull/8562/commits/10494cb86406ee10a7e07da445803284f9fdd71c
842a2f3 test(mothership): drop the mock-call routing test; the integration su… waleedlatif1 Oct 2, 2026 https://github.com/simstudioai/sim/pull/8562/commits/842a2f3c1f2d1cc7116f0520458ba161e0a1ae16
Clear filters https://github.com/simstudioai/sim/pull/8562/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8562/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8562/files
handle-tool-event.test.ts https://github.com/simstudioai/sim/pull/8562/files#diff-23a9d7c75459e3a0ee1a2a547cc450b520288832b85bd96460a3ec076c30b192
handle-tool-event.ts https://github.com/simstudioai/sim/pull/8562/files#diff-29efcffd44cdd85babf6f9011ba407877c63779e3769d5b299aace99bd2e0627
client-executed-tools.ts https://github.com/simstudioai/sim/pull/8562/files#diff-4343b663eafafff43034464e945d663b80afe14691fff01de4848e82281e7513
desktop-tool-executor.integration.ts https://github.com/simstudioai/sim/pull/8562/files#diff-11cc3471097d5dd56172a4edb02423042d8a262d7f18f11cd9f80e610fc460d7
apps/sim/app/workspace/[workspaceId]/home/hooks/stream/handle-tool-event.test.tshttps://github.com/simstudioai/sim/pull/8562/files#diff-23a9d7c75459e3a0ee1a2a547cc450b520288832b85bd96460a3ec076c30b192
View file https://github.com/simstudioai/sim/blob/842a2f3c1f2d1cc7116f0520458ba161e0a1ae16/apps/sim/app/workspace/%5BworkspaceId%5D/home/hooks/stream/handle-tool-event.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8562/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8562/files#diff-23a9d7c75459e3a0ee1a2a547cc450b520288832b85bd96460a3ec076c30b192
https://github.com/simstudioai/sim/pull/8562/files#diff-23a9d7c75459e3a0ee1a2a547cc450b520288832b85bd96460a3ec076c30b192
https://github.com/simstudioai/sim/pull/8562/files#diff-23a9d7c75459e3a0ee1a2a547cc450b520288832b85bd96460a3ec076c30b192
apps/sim/app/workspace/[workspaceId]/home/hooks/stream/handle-tool-event.tshttps://github.com/simstudioai/sim/pull/8562/files#diff-29efcffd44cdd85babf6f9011ba407877c63779e3769d5b299aace99bd2e0627
View file https://github.com/simstudioai/sim/blob/842a2f3c1f2d1cc7116f0520458ba161e0a1ae16/apps/sim/app/workspace/%5BworkspaceId%5D/home/hooks/stream/handle-tool-event.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8562/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8562/files#diff-29efcffd44cdd85babf6f9011ba407877c63779e3769d5b299aace99bd2e0627
https://github.com/simstudioai/sim/pull/8562/files#diff-29efcffd44cdd85babf6f9011ba407877c63779e3769d5b299aace99bd2e0627
https://github.com/simstudioai/sim/pull/8562/files#diff-29efcffd44cdd85babf6f9011ba407877c63779e3769d5b299aace99bd2e0627
https://github.com/simstudioai/sim/pull/8562/files#diff-29efcffd44cdd85babf6f9011ba407877c63779e3769d5b299aace99bd2e0627
apps/sim/lib/mothership/tools/client-executed-tools.tshttps://github.com/simstudioai/sim/pull/8562/files#diff-4343b663eafafff43034464e945d663b80afe14691fff01de4848e82281e7513
View file https://github.com/simstudioai/sim/blob/842a2f3c1f2d1cc7116f0520458ba161e0a1ae16/apps/sim/lib/mothership/tools/client-executed-tools.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8562/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8562/files#diff-4343b663eafafff43034464e945d663b80afe14691fff01de4848e82281e7513
apps/sim/lib/mothership/tools/client/desktop-tool-executor.integration.tshttps://github.com/simstudioai/sim/pull/8562/files#diff-11cc3471097d5dd56172a4edb02423042d8a262d7f18f11cd9f80e610fc460d7
View file https://github.com/simstudioai/sim/blob/842a2f3c1f2d1cc7116f0520458ba161e0a1ae16/apps/sim/lib/mothership/tools/client/desktop-tool-executor.integration.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8562/{{ revealButtonHref }}
Please reload this pagehttps://github.com/simstudioai/sim/pull/8562/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.