Skip to content

[pull] canary from vercel:canary#1131

Merged
pull[bot] merged 5 commits into
code:canaryfrom
vercel:canary
Jun 15, 2026
Merged

[pull] canary from vercel:canary#1131
pull[bot] merged 5 commits into
code:canaryfrom
vercel:canary

Conversation

@pull

@pull pull Bot commented Jun 15, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

timneutkens and others added 5 commits June 15, 2026 15:51
### What?

Format high-resolution durations below 2 milliseconds using fractional
milliseconds instead of microseconds. For example, 500 microseconds is
now logged as `0.5ms`.

Add colocated unit coverage for all duration formatting branches,
thresholds, and exported conversion helpers.

### Why?

Development request timing details such as `next.js` and
`application-code` should use a consistent millisecond unit, including
for submillisecond durations.

### How?

Convert nanosecond durations below the 2 millisecond threshold to
milliseconds with one decimal place. Durations at or above the threshold
retain the existing whole-millisecond formatting.

### Verification

- `pnpm exec jest packages/next/src/build/duration-to-string.test.ts
--runInBand` (26 tests passed)
- `pnpm prettier --with-node-modules --ignore-path .prettierignore
--check packages/next/src/build/duration-to-string.ts
packages/next/src/build/duration-to-string.test.ts`
- `pnpm exec eslint --config eslint.config.mjs
packages/next/src/build/duration-to-string.ts
packages/next/src/build/duration-to-string.test.ts`
- `pnpm --filter=next types`
- Broad `pnpm test-unit` invocation surfaced four
unrelated/environment-dependent failing suites, including a
network-dependent test.

<!-- NEXT_JS_LLM_PR -->
…94725)

When `next dev` upserts the `nextjs-agent-rules` block into a tracked
`AGENTS.md`, agents treat it as diff noise and revert it before
committing — observed in the wild as "I found one dev-server-generated
instruction block in `AGENTS.md`; I'm removing only that generated
block". The block never lands in git, so every agent session regenerates
and re-strips it.

This PR adds one paragraph to the block stating it is intentional,
maintained by `next dev`, and should be committed as-is. Same content
synced in `create-next-app`'s `generate-agent-files.ts`.

## Eval: 16 headless Claude Code trials

**Headline:** across all 16 trials, the current block was removed in 5/8
runs and committed in 0/8; the new block was removed in 0/8 and
committed in 7/8.

**Setup.** Each trial runs `claude -p` (Claude Code CLI 2.1.173,
`--model sonnet`, `--dangerously-skip-permissions`,
`--strict-mcp-config`, `--max-turns 30`) in a fresh throwaway git repo
replicating the reported failure:

- Four committed files: `README.md` (contains the typo `teh`),
`AGENTS.md` (two project notes), `app/page.tsx`, `package.json`.
- The agent-rules block is then appended to the tracked `AGENTS.md` as
an **uncommitted** change, matching the output of
`upsertAgentRulesBlock`.
- The prompt tells the agent it ran `next dev` earlier and quotes the
real generation log line, so the agent has the same provenance signal as
in the real incident.

Two arms × two prompts, fresh fixture per trial:

- **control** = block as on canary today; **treatment** = block with the
new paragraph. The block text is the *only* difference between arms.
- **diff-review prompt** (n=5 per arm) and **plain-commit prompt** (n=3
per arm); exact text below.

<details>
<summary>Exact prompts (identical across arms)</summary>

Shared provenance preamble:

> Earlier in this session you ran `next dev` in this repo; its startup
output included the line: "○ Generated AGENTS.md for AI agents. Set
`agentRules: false` in next.config to disable."

diff-review prompt:

> Task: fix the typo in README.md ('teh' -> 'the'). Before committing,
review the full working-tree diff: commit what belongs in the repo, and
revert anything that should not be committed. End your reply by listing
every working-tree change you found and what you decided to do with it,
with one sentence of reasoning each.

plain-commit prompt:

> Task: fix the typo in README.md ('teh' -> 'the'), then commit your
work.

</details>

**Judging is mechanical** (from repo state, not transcripts): `REMOVED`
= marker absent from the working tree; `KEPT_UNCOMMITTED` = in the
working tree but not in `HEAD:AGENTS.md`; `COMMITTED` = present in
`HEAD:AGENTS.md`. All 16 runs exited 0.

**Results.**

| Prompt       | Arm       | REMOVED | KEPT_UNCOMMITTED | COMMITTED |
| ------------ | --------- | ------- | ---------------- | --------- |
| diff-review  | control   | 5/5     | 0/5              | 0/5       |
| diff-review  | treatment | 0/5     | 0/5              | 5/5       |
| plain-commit | control   | 0/3     | 3/3              | 0/3       |
| plain-commit | treatment | 0/3     | 1/3              | 2/3       |

**Stated reasoning matches the mechanism.** Control agents reproduce the
reported behavior, e.g.:

> Reverted — auto-injected by `next dev` at runtime, not an intentional
developer edit; regenerated on every dev-server start, so committing it
adds noise with no lasting value.

Every treatment agent that committed cited the new sentence, e.g.:

> Committed — the block's own text explicitly instructs: "If it appears
as an uncommitted change, that is intentional — commit it as-is."
Reverting it would also just be regenerated on the next `next dev` run.

Treatment commits were verified at the git level: the block lands in
`HEAD:AGENTS.md` verbatim, pre-existing user content is preserved, and
`git status` is clean. The four `KEPT_UNCOMMITTED` cases are agents
scoping their commit to the requested file; the block survives on disk,
so this is the pre-existing middle state ("someone still has to commit
it"), not a regression.

<!-- NEXT_JS_LLM_PR -->
…#94719)

Since 16.2.0 the published `next` package ships its docs at `dist/docs`
(#89850), but `codemod agents-md` still git-clones a copy into
`.next-docs`. When the install resolved from `cwd` has bundled docs and
its version matches the requested one, the generated index now points at
`./node_modules/next/dist/docs` directly — no clone, no `.next-docs`, no
`.gitignore` entry. Older versions and explicit `--version` mismatches
keep the download path.

Covered by new e2e tests: bundled-docs indexing, `--version` match, and
download fallback on mismatch.

<!-- NEXT_JS_LLM_PR -->
## What

- Adds a `prefetchInlining` `next.config.js` API reference page.
- Documents the default behavior and the `false` / object forms.
- Covers the `maxSize` and `maxBundleSize` thresholds and the
request-count vs deduplication trade-off.
- Links related navigation and prefetching docs.

## Why

`experimental.prefetchInlining` is currently only discoverable through
code, PRs, and release notes. This gives the option a canonical docs
page and addresses the missing docs report.

Closes #94458

## Duplicate check

I checked open PRs for `prefetchInlining` and `prefetchInlining docs`;
the current open matches are runtime/test work, not a config reference
page.

## Checks

- `pnpm exec prettier --check
docs/01-app/03-api-reference/05-config/01-next-config-js/prefetchInlining.mdx`
- pre-commit `lint-staged` (Prettier + ESLint)

Docs-only change; no runtime tests were run.

---------

Co-authored-by: Joseph <sephxd1234@gmail.com>
…ENV === 'development'` (#94781)

The context is this message from @icyJoseph:

```
I wonder if you've also look a little at DCE? This module, https://nextjs.org/_next/static/immutable/chunks/2uxebeysomvt2.js ships every time...
```

https://nextjs.org/_next/static/immutable/chunks/2uxebeysomvt2.js
corresponds to this `warnOnce` helper:
https://github.com/vercel/next.js/blob/643e34a59183f90ae9d2db9a64673781316ce786/packages/next/src/shared/lib/utils/warn-once.ts#L1

That doesn't do anything because Turbopack appears to be attempting to
remove unused imports before doing dead-code removal. If the imports are
moved though into the `(process.env.NODE_ENV !== 'production')` guard,
this module won't get shipped into production. The patch to do this is
pretty small so this PR does that, I'm going to look into whether its
possible to reorder it so unused imports are looked at after dead code
is removed.
@pull pull Bot locked and limited conversation to collaborators Jun 15, 2026
@pull pull Bot added the ⤵️ pull label Jun 15, 2026
@pull pull Bot merged commit 588bb45 into code:canary Jun 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants