René's URL Explorer Experiment


Title: fix(mothership): keep a chatless surface's queue across remounts and contain hung chat hook tests by waleedlatif1 · Pull Request #8707 · simstudioai/sim · GitHub

Open Graph Title: fix(mothership): keep a chatless surface's queue across remounts and contain hung chat hook tests by waleedlatif1 · Pull Request #8707 · simstudioai/sim

X Title: fix(mothership): keep a chatless surface's queue across remounts and contain hung chat hook tests by waleedlatif1 · Pull Request #8707 · simstudioai/sim

Description: Summary Follow-up to #8695. A chatless surface's queue survives a remount, in order. A follow-up queued on the new-chat surface waits until the first message's chat is known. If the surface remounted first, the queue stayed under the dead mount's key, neither sent nor shown. The unmount now marks that queue as held for its surface (holdForSurface), and the next mount of the surface adopts it through the existing adoptHeldSends lane. migrate and replaceAt already drop the mark once a chat is known. Plain remount (navigate away and back, a route remount): the unmount also withdraws the first message, whose POST hasn't been answered. When follow-ups are queued, the unmount puts that first message at their head, under its own userMessageId, and skips its separate cross-surface handoff. The next mount then sends the first message (the server deduplicates it by id) and the follow-ups after it. Without this, the next mount would send a follow-up before the first message's handoff arrived. A first message with nothing queued behind it keeps the usual handoff. After a Stop: the Stop leaves the first message's POST to the server, so nothing withdraws or hands off the first message, and the next mount sends only the follow-up. This is the case where a failed Stop used to strand the follow-up. Workflow panel: the first message and its follow-ups now travel in the same held queue, tagged with the panel's surface, so they land together on the next mount of that panel. Previously the first message went to the home handoff while the follow-up stayed with the panel. A follow-up whose first message did get a chat was never affected: it moves to that chat with the rest of the queue. Hung DOM tests stay contained. A send that never settles (for example a regression stuck reconnecting) ran into the test timeout while still inside React's act scope, so the renders of every later test queued behind it and failed with "Hook result is not ready". use-chat.dom.test.tsx now wraps act: an async callback still pending after 6s fails the act, which ends the scope well before the 10s test timeout. Sync callbacks stay synchronous. The budget runs on a real timer captured before any test fakes timers. The deduplicated stream lookup's comment now says that its own timeout abort is retried on purpose: a failed lookup proves nothing, and the server deduplicates the retry by id. Only an abort of the send itself is not retried. Comment only. reopenChat is split into two explicitly named actions, so the token can't be dropped by mistake. Behavior is unchanged. liftDelete(chatKey, deleteToken) takes a required token and lifts only the delete a read or restore saw when it began. reopenRestoredChat(chatKey) is for the created event a restore publishes. Type of Change Bug fix Improvement (tests, naming) Testing With #8695's lookup fix reverted, the DOM file went from 28 failures (one timeout plus "Hook result is not ready" cascades) to 1: the regressed test, failing with act callback still pending after 6000ms. With the fix in place, all 97 tests pass. DOM tests with a home-like surface and its mothership-send-message listener. Both assert the exact messages sent after the remount, and their order: sends a withdrawn first message before its follow-up when the new-chat surface remounts: the first message goes out once under its own id, then the follow-up into its chat. It fails on the previous head of this PR (reversed order). sends only the follow-up after a failed Stop when the new-chat surface remounts: it fails on staging (stranded). holdForSurface has a store test: only the same surface adopts. The store, query and event-handler tests are updated to the new action names and pass. The full gate and integration tests ran on the CI runner. Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing 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 Follow-up to #8695. A chatless surface's queue survives a remount, in order. A follow-up queued on the new-chat surface waits until the first message's chat is known. If the surfac...

X Description: Summary Follow-up to #8695. A chatless surface's queue survives a remount, in order. A follow-up queued on the new-chat surface waits until the first message's chat is known. If th...

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

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:6183a2c0-c81b-f606-6bbc-988fc559f169
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idADC6:3D6EF:4F0469:6F2B35:6AFB5E8A
html-safe-nonce1131e9fdda9c360e4c163b6bda0d155e37ffdb0e6b0ea289e665a11e2e4a4c08
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBREM2OjNENkVGOjRGMDQ2OTo2RjJCMzU6NkFGQjVFOEEiLCJ2aXNpdG9yX2lkIjoiMjk0NjI0OTQzMTE0MzExMjMzMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac6abbe06b83d7a41da43d6f13bacc76297e9d8bada64b57c1b3c24c2dc4b1569d
hovercard-subject-tagpull_request:4766246435
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/8707/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 Follow-up to #8695. A chatless surface's queue survives a remount, in order. A follow-up queued on the new-chat surface waits until the first message's chat is known. If the surfac...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneea33d13c96d0ff66bd8fa906b193d2213536b78cb06b0c50a4632c58b1418f94
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
release59ef97164c52cf59bd10558ddec9c4f482763988
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/8707/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F8707%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%2F8707%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/8707/files
Reloadhttps://github.com/simstudioai/sim/pull/8707/files
Reloadhttps://github.com/simstudioai/sim/pull/8707/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-chat-test-containmenthttps://github.com/simstudioai/sim/tree/fix/mothership-chat-test-containment
Conversation 11 https://github.com/simstudioai/sim/pull/8707
Commits 3 https://github.com/simstudioai/sim/pull/8707/commits
Checks 33 https://github.com/simstudioai/sim/pull/8707/checks
Files changed https://github.com/simstudioai/sim/pull/8707/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8707/files
fix(mothership): keep a chatless surface's queue across remounts and contain hung chat hook tests https://github.com/simstudioai/sim/pull/8707/files#top
Show all changes 3 commits https://github.com/simstudioai/sim/pull/8707/files
e9a6a3f improvement(mothership): contain hung chat hook tests and name the de… waleedlatif1 Oct 7, 2026 https://github.com/simstudioai/sim/pull/8707/commits/e9a6a3f8d6fc92a74144f774d9795219c14acaea
999b5eb fix(mothership): keep a chatless surface's queue when it remounts waleedlatif1 Oct 7, 2026 https://github.com/simstudioai/sim/pull/8707/commits/999b5eb4b16e91b6cc8adf3fb8c675f2534e981e
ac20e3f fix(mothership): keep a withdrawn first message ahead of its follow-u… waleedlatif1 Oct 7, 2026 https://github.com/simstudioai/sim/pull/8707/commits/ac20e3fef7adf027b71ad571545c1abce847a5b2
Clear filters https://github.com/simstudioai/sim/pull/8707/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8707/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8707/files
use-chat.dom.test.tsx https://github.com/simstudioai/sim/pull/8707/files#diff-f13f1eaa18b785ec858b76bfef8952fc11d2c6730951634aad2c3bf4e167e62e
use-chat.ts https://github.com/simstudioai/sim/pull/8707/files#diff-1a0584ccf9cc4bacd55ce19aeeea8d807c39f36c365fa5b6638587aad38c700d
mothership-chat-history-restore.test.ts https://github.com/simstudioai/sim/pull/8707/files#diff-85f7727faa4746e1962e896cd8181b6d56e6bb15d107914c0a69218afb444e41
mothership-chats.ts https://github.com/simstudioai/sim/pull/8707/files#diff-d93326dc7ad3c0d6856933a9ba910634ba50d1e7c3292f43f7aaa85ca2979311
use-mothership-chat-events.ts https://github.com/simstudioai/sim/pull/8707/files#diff-963a944f69743406cd60f43c3c8ae7523922b5efdda370416b64bbd310167eec
store.test.ts https://github.com/simstudioai/sim/pull/8707/files#diff-7d2974e798ef7a4d7a04a4cf937327e478bb15555326c08838222e30dcbf5c54
store.ts https://github.com/simstudioai/sim/pull/8707/files#diff-f9609bb09028d5fea616b8fbeca370d62c6a6d20f6dc460fed34a8a0594dce70
types.ts https://github.com/simstudioai/sim/pull/8707/files#diff-66995a79415f1ef4665bc2e86e1d1a9d3b0d0babf5f62114dc92f09880c1d1ae
apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.dom.test.tsxhttps://github.com/simstudioai/sim/pull/8707/files#diff-f13f1eaa18b785ec858b76bfef8952fc11d2c6730951634aad2c3bf4e167e62e
View file https://github.com/simstudioai/sim/blob/ac20e3fef7adf027b71ad571545c1abce847a5b2/apps/sim/app/workspace/%5BworkspaceId%5D/home/hooks/use-chat.dom.test.tsx
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8707/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8707/files#diff-f13f1eaa18b785ec858b76bfef8952fc11d2c6730951634aad2c3bf4e167e62e
https://github.com/simstudioai/sim/pull/8707/files#diff-f13f1eaa18b785ec858b76bfef8952fc11d2c6730951634aad2c3bf4e167e62e
https://github.com/simstudioai/sim/pull/8707/files#diff-f13f1eaa18b785ec858b76bfef8952fc11d2c6730951634aad2c3bf4e167e62e
https://github.com/simstudioai/sim/pull/8707/files#diff-f13f1eaa18b785ec858b76bfef8952fc11d2c6730951634aad2c3bf4e167e62e
https://github.com/simstudioai/sim/pull/8707/files#diff-f13f1eaa18b785ec858b76bfef8952fc11d2c6730951634aad2c3bf4e167e62e
https://github.com/simstudioai/sim/pull/8707/files#diff-f13f1eaa18b785ec858b76bfef8952fc11d2c6730951634aad2c3bf4e167e62e
apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.tshttps://github.com/simstudioai/sim/pull/8707/files#diff-1a0584ccf9cc4bacd55ce19aeeea8d807c39f36c365fa5b6638587aad38c700d
View file https://github.com/simstudioai/sim/blob/ac20e3fef7adf027b71ad571545c1abce847a5b2/apps/sim/app/workspace/%5BworkspaceId%5D/home/hooks/use-chat.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8707/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8707/files#diff-1a0584ccf9cc4bacd55ce19aeeea8d807c39f36c365fa5b6638587aad38c700d
https://github.com/simstudioai/sim/pull/8707/files#diff-1a0584ccf9cc4bacd55ce19aeeea8d807c39f36c365fa5b6638587aad38c700d
https://github.com/simstudioai/sim/pull/8707/files#diff-1a0584ccf9cc4bacd55ce19aeeea8d807c39f36c365fa5b6638587aad38c700d
https://github.com/simstudioai/sim/pull/8707/files#diff-1a0584ccf9cc4bacd55ce19aeeea8d807c39f36c365fa5b6638587aad38c700d
https://github.com/simstudioai/sim/pull/8707/files#diff-1a0584ccf9cc4bacd55ce19aeeea8d807c39f36c365fa5b6638587aad38c700d
https://github.com/simstudioai/sim/pull/8707/files#diff-1a0584ccf9cc4bacd55ce19aeeea8d807c39f36c365fa5b6638587aad38c700d
https://github.com/simstudioai/sim/pull/8707/files#diff-1a0584ccf9cc4bacd55ce19aeeea8d807c39f36c365fa5b6638587aad38c700d
https://github.com/simstudioai/sim/pull/8707/files#diff-1a0584ccf9cc4bacd55ce19aeeea8d807c39f36c365fa5b6638587aad38c700d
https://github.com/simstudioai/sim/pull/8707/files#diff-1a0584ccf9cc4bacd55ce19aeeea8d807c39f36c365fa5b6638587aad38c700d
https://github.com/simstudioai/sim/pull/8707/files#diff-1a0584ccf9cc4bacd55ce19aeeea8d807c39f36c365fa5b6638587aad38c700d
https://github.com/simstudioai/sim/pull/8707/files#diff-1a0584ccf9cc4bacd55ce19aeeea8d807c39f36c365fa5b6638587aad38c700d
https://github.com/simstudioai/sim/pull/8707/files#diff-1a0584ccf9cc4bacd55ce19aeeea8d807c39f36c365fa5b6638587aad38c700d
apps/sim/hooks/queries/mothership-chat-history-restore.test.tshttps://github.com/simstudioai/sim/pull/8707/files#diff-85f7727faa4746e1962e896cd8181b6d56e6bb15d107914c0a69218afb444e41
View file https://github.com/simstudioai/sim/blob/ac20e3fef7adf027b71ad571545c1abce847a5b2/apps/sim/hooks/queries/mothership-chat-history-restore.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8707/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8707/files#diff-85f7727faa4746e1962e896cd8181b6d56e6bb15d107914c0a69218afb444e41
https://github.com/simstudioai/sim/pull/8707/files#diff-85f7727faa4746e1962e896cd8181b6d56e6bb15d107914c0a69218afb444e41
https://github.com/simstudioai/sim/pull/8707/files#diff-85f7727faa4746e1962e896cd8181b6d56e6bb15d107914c0a69218afb444e41
apps/sim/hooks/queries/mothership-chats.tshttps://github.com/simstudioai/sim/pull/8707/files#diff-d93326dc7ad3c0d6856933a9ba910634ba50d1e7c3292f43f7aaa85ca2979311
View file https://github.com/simstudioai/sim/blob/ac20e3fef7adf027b71ad571545c1abce847a5b2/apps/sim/hooks/queries/mothership-chats.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8707/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8707/files#diff-d93326dc7ad3c0d6856933a9ba910634ba50d1e7c3292f43f7aaa85ca2979311
https://github.com/simstudioai/sim/pull/8707/files#diff-d93326dc7ad3c0d6856933a9ba910634ba50d1e7c3292f43f7aaa85ca2979311
https://github.com/simstudioai/sim/pull/8707/files#diff-d93326dc7ad3c0d6856933a9ba910634ba50d1e7c3292f43f7aaa85ca2979311
https://github.com/simstudioai/sim/pull/8707/files#diff-d93326dc7ad3c0d6856933a9ba910634ba50d1e7c3292f43f7aaa85ca2979311
apps/sim/hooks/use-mothership-chat-events.tshttps://github.com/simstudioai/sim/pull/8707/files#diff-963a944f69743406cd60f43c3c8ae7523922b5efdda370416b64bbd310167eec
View file https://github.com/simstudioai/sim/blob/ac20e3fef7adf027b71ad571545c1abce847a5b2/apps/sim/hooks/use-mothership-chat-events.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8707/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8707/files#diff-963a944f69743406cd60f43c3c8ae7523922b5efdda370416b64bbd310167eec
https://github.com/simstudioai/sim/pull/8707/files#diff-963a944f69743406cd60f43c3c8ae7523922b5efdda370416b64bbd310167eec
apps/sim/stores/mothership-queue/store.test.tshttps://github.com/simstudioai/sim/pull/8707/files#diff-7d2974e798ef7a4d7a04a4cf937327e478bb15555326c08838222e30dcbf5c54
View file https://github.com/simstudioai/sim/blob/ac20e3fef7adf027b71ad571545c1abce847a5b2/apps/sim/stores/mothership-queue/store.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8707/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8707/files#diff-7d2974e798ef7a4d7a04a4cf937327e478bb15555326c08838222e30dcbf5c54
https://github.com/simstudioai/sim/pull/8707/files#diff-7d2974e798ef7a4d7a04a4cf937327e478bb15555326c08838222e30dcbf5c54
https://github.com/simstudioai/sim/pull/8707/files#diff-7d2974e798ef7a4d7a04a4cf937327e478bb15555326c08838222e30dcbf5c54
Please reload this pagehttps://github.com/simstudioai/sim/pull/8707/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8707/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.