René's URL Explorer Experiment


Title: fix(sandbox): judge session lease coverage from the request's own clock reading by waleedlatif1 · Pull Request #8665 · simstudioai/sim · GitHub

Open Graph Title: fix(sandbox): judge session lease coverage from the request's own clock reading by waleedlatif1 · Pull Request #8665 · simstudioai/sim

X Title: fix(sandbox): judge session lease coverage from the request's own clock reading by waleedlatif1 · Pull Request #8665 · simstudioai/sim

Description: Summary session-sandbox.test.ts > session sandbox lease > trusts a lease granted by a slow reconnect… failed intermittently in CI with expected [ 1230000 ] to have a length of +0 but got 1. The extra extendLifetime(1_230_000) call came from production code, not only the test. Root cause. After #8621, ensureSessionSandbox read the clock once to work out how much of the lease was still needed (lifetimeMs - (Date.now() - requestedAtMs)). outlives() then read the clock a second time to add "now" back (deadline >= Date.now() + remaining). The two readings cancel only if they land in the same millisecond. If the clock ticks between them, and the reconnect granted its lease in the same millisecond the caller captured requestedAtMs (E2B's findSessionSandbox does this routinely), the check comes up 1 ms short. The code then issues the E2B getInfo + setTimeout round trip that #8621 set out to remove. The same thing happens with the real E2B handle, so production was sometimes making the unneeded request too. Fix. SandboxHandle.outlives(lifetimeMs, fromMs) now takes the clock reading that the window is measured from. Acquisition passes requestedAtMs, so the decision uses no second clock read. Both lease grant paths (reconnect and create) anchor their deadline at or after requestedAtMs, which makes coverage hold deterministically. Release and extendLifetime pass a single Date.now(), so their behaviour is unchanged. Why the test didn't catch it reliably. It slept on a real timer and read the real clock, so it failed only when a millisecond boundary fell between the two reads. It now controls Date.now(): the clock holds still through the reconnect and then advances on every read, which puts the tick exactly in the old window. Against the old code it fails every time with the CI assertion. It also no longer uses a real timer. Type of Change Bug fix Testing The original test, repeated 1,999× in one process under load (nice -n 10, load avg ~50): fails on origin/staging with the CI assertion, passes on this branch. The new clock-controlled test with the old one-argument fake against origin/staging code fails deterministically with expected [ 1230000 ] to have a length of +0 but got 1. Process-per-run loops (nice -n 10 vitest run … -t "slow reconnect") under CPU load: origin/staging 298/300 pass, 2 failures (expected [ 1230000 ] and expected [ 1229999 ] to have a length of +0); this branch 300/300 pass, 0 failures. bun run lint:check, bun run check:audits, apps/sim tsc --noEmit, and every lib/execution/remote-sandbox test (534 passed) all pass. 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 session-sandbox.test.ts > session sandbox lease > trusts a lease granted by a slow reconnect… failed intermittently in CI with expected [ 1230000 ] to have a length of +0 but got 1. T...

X Description: Summary session-sandbox.test.ts > session sandbox lease > trusts a lease granted by a slow reconnect… failed intermittently in CI with expected [ 1230000 ] to have a length of +0 but ...

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

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:d204a590-56f6-e8e3-aac3-dfa0be047587
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idA110:243422:DA91B:133986:6AFB758B
html-safe-nonce7beb8da034ae7cab41cb2a89e9d133c557a6812c997cd631667661fad897894a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMTEwOjI0MzQyMjpEQTkxQjoxMzM5ODY6NkFGQjc1OEIiLCJ2aXNpdG9yX2lkIjoiMzExNDA3MjkxNjAwMjMwNTQxOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacf0bc4405ccb0f376aedf4d1455cb9a7ed5cb1024d1710caaf306972e280949d3
hovercard-subject-tagpull_request:4754039490
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/8665/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 session-sandbox.test.ts > session sandbox lease > trusts a lease granted by a slow reconnect… failed intermittently in CI with expected [ 1230000 ] to have a length of +0 but got 1. T...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None0e29e7974fdda2feeaf5c891efd4b23b0734b23480232b62c7bdef13f40b5b48
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
release2e8872b770cc4d5d0cc1f2026afab747a268e2ce
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/8665/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F8665%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%2F8665%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/8665/files
Reloadhttps://github.com/simstudioai/sim/pull/8665/files
Reloadhttps://github.com/simstudioai/sim/pull/8665/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests201 (201)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/session-sandbox-lease-flakehttps://github.com/simstudioai/sim/tree/fix/session-sandbox-lease-flake
Conversation 5 https://github.com/simstudioai/sim/pull/8665
Commits 1 https://github.com/simstudioai/sim/pull/8665/commits
Checks 33 https://github.com/simstudioai/sim/pull/8665/checks
Files changed https://github.com/simstudioai/sim/pull/8665/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8665/files
fix(sandbox): judge session lease coverage from the request's own clock reading https://github.com/simstudioai/sim/pull/8665/files#top
Show all changes 1 commit https://github.com/simstudioai/sim/pull/8665/files
98ca1bb fix(sandbox): judge session lease coverage from the request's own clo… waleedlatif1 Oct 6, 2026 https://github.com/simstudioai/sim/pull/8665/commits/98ca1bbd7ffa9c90b35480fb74aa18124dd408b1
Clear filters https://github.com/simstudioai/sim/pull/8665/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8665/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8665/files
e2b-session.test.ts https://github.com/simstudioai/sim/pull/8665/files#diff-3b81819062f839724f7a7e7103433cc0e7947cb627037cc397bdd9f44a90e015
e2b.ts https://github.com/simstudioai/sim/pull/8665/files#diff-f54663c69a136b10f426311853c9d3c7b9f328f0b85719ae7c23c0dd7030721d
index.ts https://github.com/simstudioai/sim/pull/8665/files#diff-45bb4d66958fbda0e750b34264c092e3ed4f472e7bff507cee5875a58b2d3ef4
session-sandbox.test.ts https://github.com/simstudioai/sim/pull/8665/files#diff-93993881944d4232c1cecf96599ad647e51ea63369e46347edab5f349eb6cfd2
session.ts https://github.com/simstudioai/sim/pull/8665/files#diff-59b70b1ae1c65db98eca284b97b9bf2609499ac134a3bfac6ffa4b641491062c
types.ts https://github.com/simstudioai/sim/pull/8665/files#diff-a956fe3fea088fe237d431cb20fe73201f4c5feb647827ce7021cc35a4eda2d8
apps/sim/lib/execution/remote-sandbox/e2b-session.test.tshttps://github.com/simstudioai/sim/pull/8665/files#diff-3b81819062f839724f7a7e7103433cc0e7947cb627037cc397bdd9f44a90e015
View file https://github.com/simstudioai/sim/blob/98ca1bbd7ffa9c90b35480fb74aa18124dd408b1/apps/sim/lib/execution/remote-sandbox/e2b-session.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8665/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8665/files#diff-3b81819062f839724f7a7e7103433cc0e7947cb627037cc397bdd9f44a90e015
https://github.com/simstudioai/sim/pull/8665/files#diff-3b81819062f839724f7a7e7103433cc0e7947cb627037cc397bdd9f44a90e015
https://github.com/simstudioai/sim/pull/8665/files#diff-3b81819062f839724f7a7e7103433cc0e7947cb627037cc397bdd9f44a90e015
https://github.com/simstudioai/sim/pull/8665/files#diff-3b81819062f839724f7a7e7103433cc0e7947cb627037cc397bdd9f44a90e015
apps/sim/lib/execution/remote-sandbox/e2b.tshttps://github.com/simstudioai/sim/pull/8665/files#diff-f54663c69a136b10f426311853c9d3c7b9f328f0b85719ae7c23c0dd7030721d
View file https://github.com/simstudioai/sim/blob/98ca1bbd7ffa9c90b35480fb74aa18124dd408b1/apps/sim/lib/execution/remote-sandbox/e2b.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8665/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8665/files#diff-f54663c69a136b10f426311853c9d3c7b9f328f0b85719ae7c23c0dd7030721d
https://github.com/simstudioai/sim/pull/8665/files#diff-f54663c69a136b10f426311853c9d3c7b9f328f0b85719ae7c23c0dd7030721d
apps/sim/lib/execution/remote-sandbox/index.tshttps://github.com/simstudioai/sim/pull/8665/files#diff-45bb4d66958fbda0e750b34264c092e3ed4f472e7bff507cee5875a58b2d3ef4
View file https://github.com/simstudioai/sim/blob/98ca1bbd7ffa9c90b35480fb74aa18124dd408b1/apps/sim/lib/execution/remote-sandbox/index.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8665/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8665/files#diff-45bb4d66958fbda0e750b34264c092e3ed4f472e7bff507cee5875a58b2d3ef4
https://github.com/simstudioai/sim/pull/8665/files#diff-45bb4d66958fbda0e750b34264c092e3ed4f472e7bff507cee5875a58b2d3ef4
apps/sim/lib/execution/remote-sandbox/session-sandbox.test.tshttps://github.com/simstudioai/sim/pull/8665/files#diff-93993881944d4232c1cecf96599ad647e51ea63369e46347edab5f349eb6cfd2
View file https://github.com/simstudioai/sim/blob/98ca1bbd7ffa9c90b35480fb74aa18124dd408b1/apps/sim/lib/execution/remote-sandbox/session-sandbox.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8665/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8665/files#diff-93993881944d4232c1cecf96599ad647e51ea63369e46347edab5f349eb6cfd2
https://github.com/simstudioai/sim/pull/8665/files#diff-93993881944d4232c1cecf96599ad647e51ea63369e46347edab5f349eb6cfd2
apps/sim/lib/execution/remote-sandbox/session.tshttps://github.com/simstudioai/sim/pull/8665/files#diff-59b70b1ae1c65db98eca284b97b9bf2609499ac134a3bfac6ffa4b641491062c
View file https://github.com/simstudioai/sim/blob/98ca1bbd7ffa9c90b35480fb74aa18124dd408b1/apps/sim/lib/execution/remote-sandbox/session.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8665/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8665/files#diff-59b70b1ae1c65db98eca284b97b9bf2609499ac134a3bfac6ffa4b641491062c
https://github.com/simstudioai/sim/pull/8665/files#diff-59b70b1ae1c65db98eca284b97b9bf2609499ac134a3bfac6ffa4b641491062c
apps/sim/lib/execution/remote-sandbox/types.tshttps://github.com/simstudioai/sim/pull/8665/files#diff-a956fe3fea088fe237d431cb20fe73201f4c5feb647827ce7021cc35a4eda2d8
View file https://github.com/simstudioai/sim/blob/98ca1bbd7ffa9c90b35480fb74aa18124dd408b1/apps/sim/lib/execution/remote-sandbox/types.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8665/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8665/files#diff-a956fe3fea088fe237d431cb20fe73201f4c5feb647827ce7021cc35a4eda2d8
https://github.com/simstudioai/sim/pull/8665/files#diff-a956fe3fea088fe237d431cb20fe73201f4c5feb647827ce7021cc35a4eda2d8
Please reload this pagehttps://github.com/simstudioai/sim/pull/8665/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.