Skip to content

v0.7.55: revert nextjs version bump - #6243

Merged
waleedlatif1 merged 1 commit into
mainfrom
staging
Aug 4, 2026
Merged

v0.7.55: revert nextjs version bump #6243
waleedlatif1 merged 1 commit into
mainfrom
staging

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

…code (#6242)

Next 16.3.0's Turbopack optimizer models a bare `return <asyncCall>()` tail
call inside an async function as returning the promise object, then propagates
that always-truthy fact through the caller's `await`. Where the result feeds an
`if (x)` whose every branch returns, it concludes the branch is always taken and
deletes everything after it from the emitted bundle.

Two sites shipped to production that way:

- `POST /api/credentials` lost its entire create path — the transaction, the
  org locks, the insert, the audit, the 201. A first-time create fell into the
  existing-credential branch and threw on `existingCredential.id`, so every new
  credential 500'd.
- `upsertAsyncToolCall` collapsed to `async () => await getAsyncToolCall(id)`.
  The insert is simply gone; it returns null for every new async copilot tool
  call. Silent — no error, no failed request.

A differential scan of 71,266 source string literals across `.next/server` and
`.next/static`, comparing images built from the same commit on 16.2.12 and
16.3.0, found exactly these two and nothing else. That scan cannot see dropped
branches with no distinctive string literal, which is why the version goes back
rather than the two sites being patched alone.

Both are also hardened with `return await`, verified to defeat the miscompile in
a minimal reproduction. The TypeScript toolchain cleanup from the original bump
(dropping @typescript/native-preview, `useTypeScriptCli`) is kept.
@waleedlatif1
waleedlatif1 requested a review from a team as a code owner August 4, 2026 05:33
@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Building Building Preview Aug 4, 2026 5:33am

Request Review

@cursor

cursor Bot commented Aug 4, 2026

Copy link
Copy Markdown

PR Summary

High Risk
The reverted 16.3.0 build could ship bundles missing credential creation and copilot async-tool upsert paths; the downgrade plus return await directly protects those API flows until Next’s optimizer is fixed.

Overview
Reverts Next.js from 16.3.0 to 16.2.12 across the monorepo (apps/sim, apps/docs, packages/emcn, root overrides, and bun.lock).

On 16.3.0, Turbopack’s optimizer mis-models bare return <asyncCall>() as returning a promise object (always truthy), which dead-code eliminated real paths—e.g. first-time credential create in credentials/route.ts and insert logic in upsertAsyncToolCall. The PR keeps return await on those async tail returns (and on all withDbSpan wrappers in async-runs/repository.ts) plus inline comments so the workaround survives a future 16.3.x bump.

next.config.ts comments are updated to keep turbopackFileSystemCacheForBuild: false explicit while on 16.2.12 (16.3.0 flips the default on).

Reviewed by Cursor Bugbot for commit 2977db5. Configure here.

@waleedlatif1
waleedlatif1 merged commit 1b9e0f2 into main Aug 4, 2026
41 of 43 checks passed
@greptile-apps

greptile-apps Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR reverts Next.js across the monorepo from 16.3.0 to 16.2.12 after an optimizer regression and adds defensive return await boundaries around affected asynchronous database paths.

  • Aligns application, documentation, EMCN, root overrides, SWC packages, and the Bun lockfile on Next 16.2.12.
  • Protects credential creation and Copilot async-run persistence from incorrect optimizer truthiness propagation.
  • Retains explicit Turbopack build-cache and TypeScript CLI configuration while clarifying why those settings remain necessary.

Confidence Score: 5/5

The PR appears safe to merge, with the dependency graph consistently reverted and the affected asynchronous persistence paths comprehensively protected.

The manifests and lockfile resolve the reverted Next.js toolchain consistently, and all relevant changed wrappers now await the resolved database value without altering established error or cleanup behavior.

Important Files Changed

Filename Overview
apps/sim/app/api/credentials/route.ts Adds explicit awaits to preserve resolved credential nullability through optimized production builds; no uncovered failure remains.
apps/sim/lib/copilot/async-runs/repository.ts Consistently applies the async-tail-call workaround to traced database operations without changing their returned values or error handling.
apps/sim/next.config.ts Updates explanatory comments while retaining configuration compatible with the reverted toolchain.
apps/sim/package.json Pins the primary application to Next 16.2.12 consistently with root overrides and lockfile resolution.
apps/docs/package.json Aligns the documentation application with the reverted Next.js version.
packages/emcn/package.json Aligns the package development dependency while continuing to satisfy its broad Next peer range.
package.json Keeps Next, its environment package, and explicitly listed SWC binaries on one version.
bun.lock Resolves Next, environment, compiler, and associated optional platform packages consistently at 16.2.12.

Reviews (1): Last reviewed commit: "fix(deps): revert next to 16.2.12, its 1..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant