René's URL Explorer Experiment


Title: fix(mothership): number recovered turns past an unreadable ring and floor the replay TTL by waleedlatif1 · Pull Request #8501 · simstudioai/sim · GitHub

Open Graph Title: fix(mothership): number recovered turns past an unreadable ring and floor the replay TTL by waleedlatif1 · Pull Request #8501 · simstudioai/sim

X Title: fix(mothership): number recovered turns past an unreadable ring and floor the replay TTL by waleedlatif1 · Pull Request #8501 · simstudioai/sim

Description: Summary This PR fixes two Chat stream-recovery findings from the release review. Neither one is a regression against the current release, and neither blocks it. 1. A recovered turn can number its events at 0 over an unreadable ring (recover-stream.ts) Release-review finding: a recovery whose readEvents comes back empty resumes numbering at 0, even though the stream's seq counter has survived. Root cause. readEvents skips any ring entry that fails envelope parsing. If every retained entry is unreadable, events is empty. startsAtReplayHead(undefined) is true, so the code took the "ring intact" branch with resumeSeq = events.at(-1)?.seq ?? 0 = 0. The writer then numbers new events from 1. The append script ZADDs them next to the old scores and SETs the counter, which moves it backwards (N → k). A live tail whose cursor sits between the old and new numbering can then silently skip new events. The empty-events path predates the lost-head branch added in #8469; prod has the same behaviour. Fix. Use the recovered event's seq only when an event was actually recovered. Otherwise resume from the stream's counter (getLatestSeq), which still falls back to 0 when the key is missing. The lost-head branch already took this path. The controller still starts from an empty context and re-attaches with an empty receipt, so nothing else changes. 2. A configured replay TTL below the heartbeat lets an idle live buffer expire (buffer.ts) Release-review finding: the 20 s chat-lock heartbeat refreshes the live buffer's TTL, but COPILOT_STREAM_TTL_SECONDS accepted any value of 1 s or more. Root cause. With a TTL under about 20 s, a run that goes quiet loses its events and seq keys between refreshes. The refresh only calls EXPIRE, so it cannot bring them back. The default (3600 s) is unaffected, and nothing in the repo sets the variable. Fix. getStreamConfig floors the configured live TTL at 60 s, which is three heartbeats. The default and every value of 60 s or more behave as before. The completed-stream TTL is unchanged. Behaviour changes A recovery with no readable ring events numbers new events after the stream's counter instead of from 1. Readers use zrangebyscore, so the gap is harmless. COPILOT_STREAM_TTL_SECONDS values below 60 now act as 60. Not changed Both findings are real. Neither one was rejected. A broader variant, max(lastRecoveredSeq, counter), would also cover a corrupt tail behind a readable head. I left it out: the finding was the empty-ring case, and that variant adds a Redis read to every recovery for a case that needs corrupt data mid-ring. Test plan stream-recovery.integration.ts: new case, a ring whose entries are all unreadable recovers with new events numbered after the counter (min seq 5). Fails on the pre-fix code. buffer-ttl.integration.ts: new case, a live buffer under a 5 s configured TTL gets at least 60 s. Fails on the pre-fix code. The existing park test now shortens the event and seq keys' TTLs explicitly, since the floor no longer lets the env do it. Both new tests checked red with the fix reverted and green with it applied (bun run test:integration buffer-ttl.integration.ts stream-recovery.integration.ts, disposable Postgres/Redis). recover-stream.test.ts and the session/ unit tests pass. bun run lint, bun run type-check (apps/sim), bun run check:audits pass. Full bun run test:integration (left to CI).

Open Graph Description: Summary This PR fixes two Chat stream-recovery findings from the release review. Neither one is a regression against the current release, and neither blocks it. 1. A recovered turn can number its e...

X Description: Summary This PR fixes two Chat stream-recovery findings from the release review. Neither one is a regression against the current release, and neither blocks it. 1. A recovered turn can number its e...

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

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:66784a47-c1dd-3926-b978-bee0f703d93c
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idDD9C:196274:32A2F1:4572DF:6AFB95F8
html-safe-nonce15a5008e8bb10f74f63411ae5ca286a56c72ac31717cce3003187aaf31cae374
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERDlDOjE5NjI3NDozMkEyRjE6NDU3MkRGOjZBRkI5NUY4IiwidmlzaXRvcl9pZCI6IjYyODYxMjgzMDEwMjI2MTUwMzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac415f5c4863331d9a5bc4e7b838c59314d1c6e00f4566e88db9ce90a963fe91fb
hovercard-subject-tagpull_request:4698036072
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/8501/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 This PR fixes two Chat stream-recovery findings from the release review. Neither one is a regression against the current release, and neither blocks it. 1. A recovered turn can number its e...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None4f01efe06174a5ba6342fd58e42d02295e0675bedbb465d6bef2dbaec8e46556
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
releasea52db8866b6543b4e83730cd6a6b1360f1a9e4dc
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/8501/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F8501%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%2F8501%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/8501/files
Reloadhttps://github.com/simstudioai/sim/pull/8501/files
Reloadhttps://github.com/simstudioai/sim/pull/8501/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests198 (198)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/stream-recovery-seq-and-ttl-floorhttps://github.com/simstudioai/sim/tree/fix/stream-recovery-seq-and-ttl-floor
Conversation 12 https://github.com/simstudioai/sim/pull/8501
Commits 3 https://github.com/simstudioai/sim/pull/8501/commits
Checks 31 https://github.com/simstudioai/sim/pull/8501/checks
Files changed https://github.com/simstudioai/sim/pull/8501/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8501/files
fix(mothership): number recovered turns past an unreadable ring and floor the replay TTL https://github.com/simstudioai/sim/pull/8501/files#top
Show all changes 3 commits https://github.com/simstudioai/sim/pull/8501/files
5b55bd3 fix(mothership): number recovered turns past an unreadable ring and f… waleedlatif1 Oct 1, 2026 https://github.com/simstudioai/sim/pull/8501/commits/5b55bd3aa3d904cdc62e8ca70fcc9307915c3ef3
5292795 test(mothership): leave a margin for Redis TTL rounding in the live-b… waleedlatif1 Oct 1, 2026 https://github.com/simstudioai/sim/pull/8501/commits/52927955a7f9d1ed0d658d01b19064048b7282e9
4e148f2 Merge remote-tracking branch 'origin/staging' into fix/stream-recover… waleedlatif1 Oct 1, 2026 https://github.com/simstudioai/sim/pull/8501/commits/4e148f28cadcc2c8df5143e6d26b5b8720eda146
Clear filters https://github.com/simstudioai/sim/pull/8501/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8501/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8501/files
recover-stream.test.ts https://github.com/simstudioai/sim/pull/8501/files#diff-11e53dc01ca797604b3a6bf1b82d95193ccf95780ddb929e880e31cdf70fa6dc
recover-stream.ts https://github.com/simstudioai/sim/pull/8501/files#diff-a01b4e7ea6496e8d31a2d7d0bf36d2955e70ddaacff109d7f3fe6ba6ee0c1862
buffer-ttl.integration.ts https://github.com/simstudioai/sim/pull/8501/files#diff-7f9616e37b2371414205cfc73196161ffe333d9a2263ebe481cd5d81467c4690
buffer.ts https://github.com/simstudioai/sim/pull/8501/files#diff-3523442e19f7ca7ea7476233be9cb95707b375b5cc5164fc889a592fedbbc44f
stream-recovery.integration.ts https://github.com/simstudioai/sim/pull/8501/files#diff-c7ca84e4bdd4707fdbc798c4a1ad589c58ba90208afdecf856c7910a693eebda
apps/sim/lib/mothership/request/application/recover-stream.test.tshttps://github.com/simstudioai/sim/pull/8501/files#diff-11e53dc01ca797604b3a6bf1b82d95193ccf95780ddb929e880e31cdf70fa6dc
View file https://github.com/simstudioai/sim/blob/4e148f28cadcc2c8df5143e6d26b5b8720eda146/apps/sim/lib/mothership/request/application/recover-stream.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8501/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8501/files#diff-11e53dc01ca797604b3a6bf1b82d95193ccf95780ddb929e880e31cdf70fa6dc
https://github.com/simstudioai/sim/pull/8501/files#diff-11e53dc01ca797604b3a6bf1b82d95193ccf95780ddb929e880e31cdf70fa6dc
apps/sim/lib/mothership/request/application/recover-stream.tshttps://github.com/simstudioai/sim/pull/8501/files#diff-a01b4e7ea6496e8d31a2d7d0bf36d2955e70ddaacff109d7f3fe6ba6ee0c1862
View file https://github.com/simstudioai/sim/blob/4e148f28cadcc2c8df5143e6d26b5b8720eda146/apps/sim/lib/mothership/request/application/recover-stream.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8501/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8501/files#diff-a01b4e7ea6496e8d31a2d7d0bf36d2955e70ddaacff109d7f3fe6ba6ee0c1862
https://github.com/simstudioai/sim/pull/8501/files#diff-a01b4e7ea6496e8d31a2d7d0bf36d2955e70ddaacff109d7f3fe6ba6ee0c1862
apps/sim/lib/mothership/request/session/buffer-ttl.integration.tshttps://github.com/simstudioai/sim/pull/8501/files#diff-7f9616e37b2371414205cfc73196161ffe333d9a2263ebe481cd5d81467c4690
View file https://github.com/simstudioai/sim/blob/4e148f28cadcc2c8df5143e6d26b5b8720eda146/apps/sim/lib/mothership/request/session/buffer-ttl.integration.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8501/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8501/files#diff-7f9616e37b2371414205cfc73196161ffe333d9a2263ebe481cd5d81467c4690
https://github.com/simstudioai/sim/pull/8501/files#diff-7f9616e37b2371414205cfc73196161ffe333d9a2263ebe481cd5d81467c4690
https://github.com/simstudioai/sim/pull/8501/files#diff-7f9616e37b2371414205cfc73196161ffe333d9a2263ebe481cd5d81467c4690
https://github.com/simstudioai/sim/pull/8501/files#diff-7f9616e37b2371414205cfc73196161ffe333d9a2263ebe481cd5d81467c4690
https://github.com/simstudioai/sim/pull/8501/files#diff-7f9616e37b2371414205cfc73196161ffe333d9a2263ebe481cd5d81467c4690
apps/sim/lib/mothership/request/session/buffer.tshttps://github.com/simstudioai/sim/pull/8501/files#diff-3523442e19f7ca7ea7476233be9cb95707b375b5cc5164fc889a592fedbbc44f
View file https://github.com/simstudioai/sim/blob/4e148f28cadcc2c8df5143e6d26b5b8720eda146/apps/sim/lib/mothership/request/session/buffer.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8501/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8501/files#diff-3523442e19f7ca7ea7476233be9cb95707b375b5cc5164fc889a592fedbbc44f
https://github.com/simstudioai/sim/pull/8501/files#diff-3523442e19f7ca7ea7476233be9cb95707b375b5cc5164fc889a592fedbbc44f
https://github.com/simstudioai/sim/pull/8501/files#diff-3523442e19f7ca7ea7476233be9cb95707b375b5cc5164fc889a592fedbbc44f
https://github.com/simstudioai/sim/pull/8501/files#diff-3523442e19f7ca7ea7476233be9cb95707b375b5cc5164fc889a592fedbbc44f
apps/sim/lib/mothership/request/session/stream-recovery.integration.tshttps://github.com/simstudioai/sim/pull/8501/files#diff-c7ca84e4bdd4707fdbc798c4a1ad589c58ba90208afdecf856c7910a693eebda
View file https://github.com/simstudioai/sim/blob/4e148f28cadcc2c8df5143e6d26b5b8720eda146/apps/sim/lib/mothership/request/session/stream-recovery.integration.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8501/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8501/files#diff-c7ca84e4bdd4707fdbc798c4a1ad589c58ba90208afdecf856c7910a693eebda
https://github.com/simstudioai/sim/pull/8501/files#diff-c7ca84e4bdd4707fdbc798c4a1ad589c58ba90208afdecf856c7910a693eebda
https://github.com/simstudioai/sim/pull/8501/files#diff-c7ca84e4bdd4707fdbc798c4a1ad589c58ba90208afdecf856c7910a693eebda
Please reload this pagehttps://github.com/simstudioai/sim/pull/8501/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.