René's URL Explorer Experiment


Title: fix(mothership): reconcile stuck conversation_id against Redis lock to clear stuck-yellow task tiles by waleedlatif1 · Pull Request #4556 · simstudioai/sim · GitHub

Open Graph Title: fix(mothership): reconcile stuck conversation_id against Redis lock to clear stuck-yellow task tiles by waleedlatif1 · Pull Request #4556 · simstudioai/sim

X Title: fix(mothership): reconcile stuck conversation_id against Redis lock to clear stuck-yellow task tiles by waleedlatif1 · Pull Request #4556 · simstudioai/sim

Description: Summary The bug Mothership task tiles render yellow/amber when the chat has an "active stream" (copilot_chats.conversation_id IS NOT NULL). Several tasks in production were stuck yellow with no stream actually running. Root cause copilot_chats.conversation_id is the persistent active-stream marker. It is written when a stream starts and cleared on the finalize/stop callbacks (finalizeAssistantTurn, /chat/stop). It has no TTL and no heartbeat, so if the process dies before the clear path runs (pod OOM, SIGKILL, uncaught throw, deploy mid-stream), the column is orphaned forever and the task renders yellow indefinitely. The Redis lock at copilot:chat-stream-lock: is the canonical liveness signal — it self-heals via 60s TTL + 20s heartbeat from startAbortPoller. The API routes that powered the UI were reading the DB column directly without consulting Redis. The fix Read-time reconciliation at the API boundary: check whether the persisted conversation_id has a live Redis lock; if not, treat the marker as null. New helper getActiveChatStreamIds(chatIds[]) in lib/copilot/request/session/abort.ts — batched MGET against copilot:chat-stream-lock: keys. Mirrors the existing getPendingChatStreamId pattern (local pending map + Redis fallback, graceful degradation on Redis-null or Redis-throws). GET /api/mothership/chats filters chats with activeStreamId != null, MGETs their locks, rewrites activeStreamId = null for any whose lock has expired. GET /api/mothership/chats/[chatId] does the same reconciliation per-chat before reading the stream snapshot — prevents the client from trying to reconnect to a dead stream via use-chat.ts. No DB writes; the DB stays the persistent record, Redis remains the source of truth for liveness. Already-stuck rows self-heal on the next fetch. Type of Change Bug fix Testing lib/copilot/request/session/abort.test.ts — 5 new cases for getActiveChatStreamIds (empty input, mixed live/expired locks, all expired, Redis unavailable, Redis throws) app/api/mothership/chats/route.test.ts (new) — 4 cases: stuck-yellow reconciled, no Redis lookup when no candidates, live locks pass through, 401 unauthenticated app/api/mothership/chats/[chatId]/route.test.ts (new) — 5 cases: stuck conversationId nulled and no snapshot read, live lock returns snapshot, null conversationId short-circuits Redis call, 404, 401 20 tests passing. bun run check:api-validation passes. 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 The bug Mothership task tiles render yellow/amber when the chat has an "active stream" (copilot_chats.conversation_id IS NOT NULL). Several tasks in production were stuck yellow w...

X Description: Summary The bug Mothership task tiles render yellow/amber when the chat has an "active stream" (copilot_chats.conversation_id IS NOT NULL). Several tasks in production were stuck ...

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

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:6c93e19e-e1d6-7c98-9392-0f76dd4c3d09
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD9D6:A5723:90604A:CC9B61:6AFB5162
html-safe-nonceea8d872f4a261ea390bf0a16f0ceb7a01313588a539d256c52180ea797584021
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOUQ2OkE1NzIzOjkwNjA0QTpDQzlCNjE6NkFGQjUxNjIiLCJ2aXNpdG9yX2lkIjoiOTgxODQ0NTgzODE1Nzk1MDQyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac1ecc20f30f72c45751a670f190037174500acd3c266989af1d00a90859bb3680
hovercard-subject-tagpull_request:3664100148
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/4556/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 The bug Mothership task tiles render yellow/amber when the chat has an "active stream" (copilot_chats.conversation_id IS NOT NULL). Several tasks in production were stuck yellow w...
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/4556/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F4556%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%2F4556%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/4556/files
Reloadhttps://github.com/simstudioai/sim/pull/4556/files
Reloadhttps://github.com/simstudioai/sim/pull/4556/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
icecrasher321https://github.com/icecrasher321
staginghttps://github.com/simstudioai/sim/tree/staging
waleedlatif1/task-yellow-bughttps://github.com/simstudioai/sim/tree/waleedlatif1/task-yellow-bug
Conversation 11 https://github.com/simstudioai/sim/pull/4556
Commits 5 https://github.com/simstudioai/sim/pull/4556/commits
Checks 12 https://github.com/simstudioai/sim/pull/4556/checks
Files changed https://github.com/simstudioai/sim/pull/4556/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/4556/files
fix(mothership): reconcile stuck conversation_id against Redis lock to clear stuck-yellow task tiles https://github.com/simstudioai/sim/pull/4556/files#top
Show all changes 5 commits https://github.com/simstudioai/sim/pull/4556/files
66fca0f fix(mothership): reconcile stuck conversation_id against Redis lock t… waleedlatif1 May 11, 2026 https://github.com/simstudioai/sim/pull/4556/commits/66fca0fa675c171b03ca1476a23357148fcd4fb8
fca291b test(mothership): clarify test name to reflect that getActiveChatStre… waleedlatif1 May 11, 2026 https://github.com/simstudioai/sim/pull/4556/commits/fca291bb27aee729f7dbdb9eb70fee4edebbe301
9406a3b address comments May 13, 2026 https://github.com/simstudioai/sim/pull/4556/commits/9406a3b677a9568359cd0e273be9cddae566a676
ee39dea fix state machine issue May 13, 2026 https://github.com/simstudioai/sim/pull/4556/commits/ee39dead8563c6509ad35306a8fecb317b6c71c3
9a1b16e cleanup code and fix types May 13, 2026 https://github.com/simstudioai/sim/pull/4556/commits/9a1b16e84a850cb672e906808ee82f4cf69ed5a1
Clear filters https://github.com/simstudioai/sim/pull/4556/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/4556/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/4556/files
route.test.ts https://github.com/simstudioai/sim/pull/4556/files#diff-2cb78fd4d41c80069e5ddb6a493d909b6bf9ebb78ae44675b58f1ca0a5bc1409
route.ts https://github.com/simstudioai/sim/pull/4556/files#diff-4c5e8c40518ea807e723d9aa9ba2b447c98e3ac89dbcb79481be95192b4aef2b
route.test.ts https://github.com/simstudioai/sim/pull/4556/files#diff-e79ca7303ebd2c335e75875150c329954e03507f3f2be0257935521977b27eb9
route.ts https://github.com/simstudioai/sim/pull/4556/files#diff-a182c85ca522b8fbfaa33158edcf83d16291c5532581e8e017354545d5c1dce5
use-chat.ts https://github.com/simstudioai/sim/pull/4556/files#diff-1a0584ccf9cc4bacd55ce19aeeea8d807c39f36c365fa5b6638587aad38c700d
tasks.test.ts https://github.com/simstudioai/sim/pull/4556/files#diff-6cd90eb2d1d9ecc2b2011b51608c4edb0143b25c2c183ded5f37321ea0010d43
tasks.ts https://github.com/simstudioai/sim/pull/4556/files#diff-8e7a6c78c64f1d9f90ee95f6f19b40698628fba6a328e4782523a9ed6d06f747
mothership-tasks.ts https://github.com/simstudioai/sim/pull/4556/files#diff-84f9b8e125f46fc0e67c8efb5a98703c8f1bc646576a99581533b7e5abe22204
stream-liveness.test.ts https://github.com/simstudioai/sim/pull/4556/files#diff-d31074224770101d679dc428ddf6c982521728c19b83c6c9fd1bb07ad444d483
stream-liveness.ts https://github.com/simstudioai/sim/pull/4556/files#diff-f14fa66a04b87f89b530439bb74ad4a1a6f281cd745f604ad6b3755cd75a3158
abort.test.ts https://github.com/simstudioai/sim/pull/4556/files#diff-a03835d6b1c7bb14f7aa1f1d9453fa29575a17aeb8f0a50bf9a0b1adf75e7c77
abort.ts https://github.com/simstudioai/sim/pull/4556/files#diff-1be90eaa24dc927b379b7e811fba79abdaa6fb93f55edabf25aac00aa4a0f49e
index.ts https://github.com/simstudioai/sim/pull/4556/files#diff-b989422ee5013485344177d04542a06dc2758ca7857924300087fbe49cb7b411
apps/sim/app/api/mothership/chats/[chatId]/route.test.tshttps://github.com/simstudioai/sim/pull/4556/files#diff-2cb78fd4d41c80069e5ddb6a493d909b6bf9ebb78ae44675b58f1ca0a5bc1409
View file https://github.com/simstudioai/sim/blob/9a1b16e84a850cb672e906808ee82f4cf69ed5a1/apps/sim/app/api/mothership/chats/%5BchatId%5D/route.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/4556/{{ revealButtonHref }}
apps/sim/app/api/mothership/chats/[chatId]/route.tshttps://github.com/simstudioai/sim/pull/4556/files#diff-4c5e8c40518ea807e723d9aa9ba2b447c98e3ac89dbcb79481be95192b4aef2b
View file https://github.com/simstudioai/sim/blob/9a1b16e84a850cb672e906808ee82f4cf69ed5a1/apps/sim/app/api/mothership/chats/%5BchatId%5D/route.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/4556/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/4556/files#diff-4c5e8c40518ea807e723d9aa9ba2b447c98e3ac89dbcb79481be95192b4aef2b
https://github.com/simstudioai/sim/pull/4556/files#diff-4c5e8c40518ea807e723d9aa9ba2b447c98e3ac89dbcb79481be95192b4aef2b
https://github.com/simstudioai/sim/pull/4556/files#diff-4c5e8c40518ea807e723d9aa9ba2b447c98e3ac89dbcb79481be95192b4aef2b
https://github.com/simstudioai/sim/pull/4556/files#diff-4c5e8c40518ea807e723d9aa9ba2b447c98e3ac89dbcb79481be95192b4aef2b
https://github.com/simstudioai/sim/pull/4556/files#diff-4c5e8c40518ea807e723d9aa9ba2b447c98e3ac89dbcb79481be95192b4aef2b
https://github.com/simstudioai/sim/pull/4556/files#diff-4c5e8c40518ea807e723d9aa9ba2b447c98e3ac89dbcb79481be95192b4aef2b
https://github.com/simstudioai/sim/pull/4556/files#diff-4c5e8c40518ea807e723d9aa9ba2b447c98e3ac89dbcb79481be95192b4aef2b
Please reload this pagehttps://github.com/simstudioai/sim/pull/4556/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/4556/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.