René's URL Explorer Experiment
Title: improvement(condition): batch condition evaluation into one sandbox call, and stop the transport from undercutting a route's own deadline by icecrasher321 · Pull Request #6854 · simstudioai/sim · GitHub
Open Graph Title: improvement(condition): batch condition evaluation into one sandbox call, and stop the transport from undercutting a route's own deadline by icecrasher321 · Pull Request #6854 · simstudioai/sim
X Title: improvement(condition): batch condition evaluation into one sandbox call, and stop the transport from undercutting a route's own deadline by icecrasher321 · Pull Request #6854 · simstudioai/sim
Description: What
Two changes to the same failure, from opposite ends.
apps/sim/executor/handlers/condition/condition-handler.ts — a condition block spent one function_execute round trip per branch, so a four-branch block that fell through to else paid four sandbox executions before it could route. It now builds one script that tests each expression in order and returns the index of the first truthy one.
apps/sim/tools/index.ts — a timeout param bounds the work an internal route was asked to do (the code a sandbox runs, the upstream call a proxy makes). The fetch around it also pays authentication, body parsing, workspace authorization, worker acquisition, and response serialization, none of which that budget was sized for. Arming the client with the bare number made the caller give up at the same instant the route's own deadline fired, so the route could never win its own race — you saw an unattributable Request timed out instead of Function execution timed out after 5000ms. Adds 30s of transport headroom, sized above the isolated-vm worker's own 10s startup budget so a cold worker spawn stays inside the deadline rather than aborting it.
Behavior that is deliberately unchanged
Ordering and short-circuiting. An expression is only reached once every earlier one returned falsy, so a later expression that throws is still never reached and the run takes the same branch it took before.
Error attribution. The script's catch reports the index it was on as data rather than rethrowing, so the handler still throws Evaluation error in condition "" naming the branch that actually failed.
else handling. An else wins as soon as it is reached, so only the branches ahead of it are testable — matching the original loop, which returned on the first else it walked past rather than assuming else comes last. The else expression never reaches the sandbox.
Execution deadlines. When a caller/execution abort signal is present it still bounds the call; the headroom only extends the local hang net.
The fallback, and why it is load-bearing
A batch that produces no verdict falls back to one call per branch — exactly what this handler did before. That is not a competing second system kept for comfort: a syntax error anywhere in the list fails the whole script at parse time, whereas evaluating one at a time only reaches, and so only fails on, the branches the run actually takes. Without it, a workflow with a broken later branch that always matches an earlier one would newly start failing. There is no way to isolate a parse failure per-branch inside a single script, so the second pass is the only recovery.
Two failures skip the fallback, because retrying would make them worse rather than recover them:
A timed-out batch — re-running every branch against the same stalled transport turns one slow call into as many slow calls as there are branches.
A cancelled run — every retry aborts on arrival.
Both surface the batch failure as it stands. The whole list was one call, so no single branch owns that failure; the error names the first, where evaluation started.
An unrecognized reply is treated as no verdict rather than as "nothing matched", so a garbled response cannot silently route the run down the else path.
Tests
apps/sim/executor/handlers/condition/condition-handler.test.ts — the existing suite was rewritten onto the batched verdict shape (one call, one verdict) and pins the new behavior: a whole list in a single call, declaration order preserved in the emitted script, the else branch never sent, per-branch fallback on a no-verdict batch, no fan-out on a timeout or a cancelled run, an out-of-range index falling back, a garbled reply not taking the else path, and no secret leaking into logs on either failure path.
apps/sim/tools/index.test.ts — asserts the transport is still waiting at the instant the route's own 5s budget expires, and gives up at 35s.
Verification
bun run test on both files: 204 passed
bun run type-check (apps/sim): clean
biome check on all four files: clean
bun run check:api-validation: passes
Known tradeoffs
A hard sandbox timeout loses the per-branch index (the script never returns), so a stalled batch names the first branch rather than the branch that stalled. Documented at the throw site.
The whole list now shares one 5s CONDITION_TIMEOUT_MS instead of 5s per branch. Conditions are inlined boolean expressions with no I/O, so this is not a budget any real list approaches.
isTimeoutFailure classifies by message text, the same way isRetryableFailure does in @/tools. A sandbox syntax error whose message happened to contain "timeout" would skip the fallback and fail a run that would otherwise have matched an earlier branch. It needs the user's own condition source to contain that substring and a syntax error in the list.
🤖 Generated with Claude Code
Open Graph Description: What
Two changes to the same failure, from opposite ends.
apps/sim/executor/handlers/condition/condition-handler.ts — a condition block spent one function_execute round trip per branch, so a four-b...
X Description: What
Two changes to the same failure, from opposite ends.
apps/sim/executor/handlers/condition/condition-handler.ts — a condition block spent one function_execute round trip per branch, so a four-b...
Opengraph URL: https://github.com/simstudioai/sim/pull/6854
X: @github
direct link
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,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-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:af8aba1a-aaa3-c750-5812-8441576d0b1a |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E5E0:2FE5F3:66DFE3:9058ED:6AFB6474 |
| html-safe-nonce | 29abe7c4ecd1dfd5cfeec25e1508bba022dd1e2e0d7982fbb3e6300e1cfbf346 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNUUwOjJGRTVGMzo2NkRGRTM6OTA1OEVEOjZBRkI2NDc0IiwidmlzaXRvcl9pZCI6IjY2NDg5NjM3MDY1MDk4MTI4NTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 54bcac7107d03fbaa0facec7a2c9db3c6daa2c768613d556d6b551041247a27f |
| hovercard-subject-tag | pull_request:4316881609 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | ///pull_requests/show/files |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/6854/files |
| twitter:image | https://avatars.githubusercontent.com/u/17950982?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/17950982?s=400&v=4 |
| og:image:alt | What
Two changes to the same failure, from opposite ends.
apps/sim/executor/handlers/condition/condition-handler.ts — a condition block spent one function_execute round trip per branch, so a four-b... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | ea33d13c96d0ff66bd8fa906b193d2213536b78cb06b0c50a4632c58b1418f94 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 59ef97164c52cf59bd10558ddec9c4f482763988 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Skip to content | https://github.com/simstudioai/sim/pull/6854/files#start-of-content |
| https://github.com/ |
| Sign in | https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F6854%2Ffiles |
| GitHubRepository hosting, code review, and collaboration | https://github.com/platform |
| CopilotAI coding agent for tasks, projects, and automated work | https://github.com/features/copilot |
| ActionsCI/CD and automation | https://github.com/features/actions |
| Code QualityQuality analysis, fixes, and enforcement | https://github.com/features/code-quality |
| CodespacesCloud development environments | https://github.com/features/codespaces |
| Code SecurityVulnerability detection and remediation | https://github.com/security/advanced-security/code-security |
| Secret ProtectionSecret scanning and leak prevention | https://github.com/security/advanced-security/secret-protection |
| All Features | https://github.com/features |
| Documentation | https://docs.github.com/en |
| Training | https://learn.github.com/skills |
| Certifications | https://learn.github.com/credentials |
| Build with Copilot | https://github.com/features/ai |
| Customize Copilot | https://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview |
| Integrations | https://github.com/marketplace |
| Trending repos | https://github.com/trending |
| GitHub Sponsors | https://github.com/open-source/sponsors |
| Developer articles | https://github.com/resources/articles |
| ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place. | https://github.blog/changelog/ |
| Enterprises | https://github.com/enterprise |
| Team | https://github.com/team |
| Startups | https://github.com/enterprise/startups |
| Nonprofits | https://github.com/solutions/industry/nonprofits |
| Healthcare | https://github.com/solutions/industry/healthcare |
| Financial services | https://github.com/solutions/industry/financial-services |
| Manufacturing | https://github.com/solutions/industry/manufacturing |
| Government | https://github.com/solutions/industry/government |
| See all industries | https://github.com/solutions/industry |
| Why GitHub | https://github.com/why-github |
| Customer Stories | https://github.com/customer-stories |
| Business insights | https://github.com/solutions/executive-insights |
| Trust Center | https://github.com/trust-center |
| GitHub Advanced SecurityEnterprise-grade code security | https://github.com/security/advanced-security |
| Copilot for businessEnterprise-grade AI features | https://github.com/features/copilot/copilot-business |
| Premium SupportEnterprise-grade 24/7 support | https://github.com/enterprise/premium-support |
| Documentation | https://docs.github.com/en |
| Resource center | https://github.com/resources |
| Blog | https://github.blog/ |
| Events & webinars | https://github.com/resources/events |
| Community Forum | https://github.com/orgs/community/discussions |
| Customer Stories | https://github.com/customer-stories |
| Integrations | https://github.com/marketplace |
| Customer support | https://help.github.com/ |
| Training | https://learn.github.com/skills |
| GitHub Status | https://www.githubstatus.com/ |
| About | https://github.com/about |
| Partners | https://github.com/partners |
| Changelog | https://github.blog/changelog/ |
| GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub. | https://githubuniverse.com/ |
| Pricing | https://github.com/pricing |
| Sign in | https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F6854%2Ffiles |
| Sign up | https://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 |
| Reload | https://github.com/simstudioai/sim/pull/6854/files |
| Reload | https://github.com/simstudioai/sim/pull/6854/files |
| Reload | https://github.com/simstudioai/sim/pull/6854/files |
| simstudioai | https://github.com/simstudioai |
| sim | https://github.com/simstudioai/sim |
| Code | https://github.com/simstudioai/sim |
| Issues129 (129) | https://github.com/simstudioai/sim/issues |
| Pull requests197 (197) | https://github.com/simstudioai/sim/pulls |
| Actions | https://github.com/simstudioai/sim/actions |
| Projects | https://github.com/simstudioai/sim/projects |
| Security and quality | https://github.com/simstudioai/sim/security |
| Insights | https://github.com/simstudioai/sim/pulse |
| Sign up for GitHub
| https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose |
| terms of service | https://docs.github.com/terms |
| privacy statement | https://docs.github.com/privacy |
| Sign in | https://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose |
| icecrasher321 | https://github.com/icecrasher321 |
| staging | https://github.com/simstudioai/sim/tree/staging |
| fix/condition-batch-eval | https://github.com/simstudioai/sim/tree/fix/condition-batch-eval |
|
Conversation
10
| https://github.com/simstudioai/sim/pull/6854 |
|
Commits
3
| https://github.com/simstudioai/sim/pull/6854/commits |
|
Checks
30
| https://github.com/simstudioai/sim/pull/6854/checks |
|
Files changed
| https://github.com/simstudioai/sim/pull/6854/files |
| Please reload this page | https://github.com/simstudioai/sim/pull/6854/files |
|
improvement(condition): batch condition evaluation into one sandbox call, and stop the transport from undercutting a route's own deadline
| https://github.com/simstudioai/sim/pull/6854/files#top |
|
Show all changes
3 commits
| https://github.com/simstudioai/sim/pull/6854/files |
|
2479705
fix(tools): give internal routes transport headroom past their execut…
Aug 19, 2026
| https://github.com/simstudioai/sim/pull/6854/commits/24797055570e351b52d3a0029e0a9d130bd0673f |
|
4483825
improvement(executor): evaluate a condition list in one sandbox call
Aug 19, 2026
| https://github.com/simstudioai/sim/pull/6854/commits/448382504f882973aed6ca1829541396c1beb590 |
|
3c3ad93
fix(executor): wrap condition expressions the same way in both paths
Aug 19, 2026
| https://github.com/simstudioai/sim/pull/6854/commits/3c3ad93c9f1eaefd32c5e2c621aea39d0d5a2e8a |
|
Clear filters
| https://github.com/simstudioai/sim/pull/6854/files |
| Please reload this page | https://github.com/simstudioai/sim/pull/6854/files |
| Please reload this page | https://github.com/simstudioai/sim/pull/6854/files |
|
condition-handler.test.ts
| https://github.com/simstudioai/sim/pull/6854/files#diff-064a4bb886fba11b872087b9ced2f91da3c38abcf15f14af2c7d557c2b1db882 |
|
condition-handler.ts
| https://github.com/simstudioai/sim/pull/6854/files#diff-59b85c48f9cbcee6cddb93179ee9a261f9174a720f75ec87c584be23f1459ab5 |
|
index.test.ts
| https://github.com/simstudioai/sim/pull/6854/files#diff-9ba0f7033f9247e496b4f9e0f46183a13c79b1bb48d721ba4bf042bdd08e4dd0 |
|
index.ts
| https://github.com/simstudioai/sim/pull/6854/files#diff-47ae0066fea628681d98d136239929a240a55aaf3d99ef293c83b3eca7e197c1 |
| Please reload this page | https://github.com/simstudioai/sim/pull/6854/files |
| Please reload this page | https://github.com/simstudioai/sim/pull/6854/files |
|
| https://github.com |
| Terms | https://docs.github.com/site-policy/github-terms/github-terms-of-service |
| Privacy | https://docs.github.com/site-policy/privacy-policies/github-privacy-statement |
| Security | https://github.com/security |
| Status | https://www.githubstatus.com/ |
| Community | https://github.community/ |
| Docs | https://docs.github.com/ |
| Contact | https://support.github.com?tags=dotcom-footer |
Viewport: width=device-width
URLs of crawlers that visited me.