Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
df0228d4
Unverified
Commit
df0228d4
authored
Sep 30, 2026
by
Jiwon Choi
Committed by
GitHub
Sep 30, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove `true` from `agentUpgrade` option (#99461)
Set `'security'` to be the default.
parent
a1de339f
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
13 deletions
+13
-13
index.ts
packages/next/src/build/index.ts
+0
-1
nudge.ts
packages/next/src/lib/upgrade/nudge.ts
+1
-4
config-schema.ts
packages/next/src/server/config-schema.ts
+4
-1
config-shared.ts
packages/next/src/server/config-shared.ts
+3
-3
router-server.ts
packages/next/src/server/lib/router-server.ts
+0
-1
security-upgrade-nudge.test.ts
test/unit/security-upgrade-nudge.test.ts
+5
-3
No files found.
packages/next/src/build/index.ts
View file @
df0228d4
...
@@ -1165,7 +1165,6 @@ export default async function build(
...
@@ -1165,7 +1165,6 @@ export default async function build(
// Reuse the loaded config; ordinary builds do not load upgrade tooling.
// Reuse the loaded config; ordinary builds do not load upgrade tooling.
if
(
if
(
config
.
experimental
.
agentUpgrade
===
true
||
config
.
experimental
.
agentUpgrade
===
'security'
||
config
.
experimental
.
agentUpgrade
===
'security'
||
config
.
experimental
.
agentUpgrade
===
'latest'
||
config
.
experimental
.
agentUpgrade
===
'latest'
||
config
.
experimental
.
agentUpgrade
===
'experimental-future'
||
config
.
experimental
.
agentUpgrade
===
'experimental-future'
||
...
...
packages/next/src/lib/upgrade/nudge.ts
View file @
df0228d4
...
@@ -157,10 +157,7 @@ export function getUpgradeContext(config: NextConfigComplete): UpgradeContext {
...
@@ -157,10 +157,7 @@ export function getUpgradeContext(config: NextConfigComplete): UpgradeContext {
cacheComponents
:
config
.
cacheComponents
,
cacheComponents
:
config
.
cacheComponents
,
experimental
:
{
experimental
:
{
agentUpgrade
:
agentUpgrade
:
getRequestedUpgrade
()
??
getRequestedUpgrade
()
??
config
.
experimental
.
agentUpgrade
??
false
,
(
config
.
experimental
.
agentUpgrade
===
true
?
'security'
:
(
config
.
experimental
.
agentUpgrade
??
false
)),
},
},
}
}
}
}
...
...
packages/next/src/server/config-schema.ts
View file @
df0228d4
...
@@ -198,7 +198,10 @@ const zTurbopackConfig: zod.ZodType<TurbopackOptions> = z.strictObject({
...
@@ -198,7 +198,10 @@ const zTurbopackConfig: zod.ZodType<TurbopackOptions> = z.strictObject({
export
const
experimentalSchema
=
{
export
const
experimentalSchema
=
{
agentUpgrade
:
z
agentUpgrade
:
z
.
union
([
z
.
enum
([
'security'
,
'latest'
,
'experimental-future'
]),
z
.
boolean
()])
.
union
([
z
.
enum
([
'security'
,
'latest'
,
'experimental-future'
]),
z
.
literal
(
false
),
])
.
optional
(),
.
optional
(),
agentFeedback
:
z
.
boolean
().
optional
(),
agentFeedback
:
z
.
boolean
().
optional
(),
turbopackAdditionalRoots
:
z
turbopackAdditionalRoots
:
z
...
...
packages/next/src/server/config-shared.ts
View file @
df0228d4
...
@@ -499,8 +499,8 @@ export interface DeprecatedConfig {
...
@@ -499,8 +499,8 @@ export interface DeprecatedConfig {
}
}
export
interface
ExperimentalConfig
{
export
interface
ExperimentalConfig
{
/** Nudge coding agents about security upgrades, stable releases, or Future Defaults.
`true` uses the security policy.
*/
/** Nudge coding agents about security upgrades, stable releases, or Future Defaults. */
agentUpgrade
?:
'security'
|
'latest'
|
'experimental-future'
|
boolean
agentUpgrade
?:
'security'
|
'latest'
|
'experimental-future'
|
false
/**
/**
* Adds managed instructions to AGENTS.md that let AI coding agents prepare
* Adds managed instructions to AGENTS.md that let AI coding agents prepare
* anonymized Next.js feedback for user review.
* anonymized Next.js feedback for user review.
...
@@ -2363,7 +2363,7 @@ export const defaultConfig = Object.freeze({
...
@@ -2363,7 +2363,7 @@ export const defaultConfig = Object.freeze({
adapterPath
:
process
.
env
.
NEXT_ADAPTER_PATH
||
undefined
,
adapterPath
:
process
.
env
.
NEXT_ADAPTER_PATH
||
undefined
,
deprecated
:
{}
as
DeprecatedConfig
,
deprecated
:
{}
as
DeprecatedConfig
,
experimental
:
{
experimental
:
{
agentUpgrade
:
true
,
agentUpgrade
:
'security'
,
agentFeedback
:
false
,
agentFeedback
:
false
,
coldCacheBadge
:
false
,
coldCacheBadge
:
false
,
collapseAdapterRoutes
:
true
,
collapseAdapterRoutes
:
true
,
...
...
packages/next/src/server/lib/router-server.ts
View file @
df0228d4
...
@@ -222,7 +222,6 @@ export async function initialize(opts: {
...
@@ -222,7 +222,6 @@ export async function initialize(opts: {
// Check only development; production startup does not query advisories.
// Check only development; production startup does not query advisories.
if
(
if
(
developmentConfig
.
experimental
.
agentUpgrade
===
true
||
developmentConfig
.
experimental
.
agentUpgrade
===
'security'
||
developmentConfig
.
experimental
.
agentUpgrade
===
'security'
||
developmentConfig
.
experimental
.
agentUpgrade
===
'latest'
||
developmentConfig
.
experimental
.
agentUpgrade
===
'latest'
||
developmentConfig
.
experimental
.
agentUpgrade
===
'experimental-future'
||
developmentConfig
.
experimental
.
agentUpgrade
===
'experimental-future'
||
...
...
test/unit/security-upgrade-nudge.test.ts
View file @
df0228d4
...
@@ -17,6 +17,7 @@ import { getAgentName } from 'next/dist/telemetry/agent-name'
...
@@ -17,6 +17,7 @@ import { getAgentName } from 'next/dist/telemetry/agent-name'
import
{
getUpgradeAssessment
}
from
'next/dist/lib/upgrade/prepare-upgrade'
import
{
getUpgradeAssessment
}
from
'next/dist/lib/upgrade/prepare-upgrade'
import
{
warn
}
from
'next/dist/build/output/log'
import
{
warn
}
from
'next/dist/build/output/log'
import
{
spawnNextUpgrade
}
from
'next/dist/cli/next-upgrade'
import
{
spawnNextUpgrade
}
from
'next/dist/cli/next-upgrade'
import
{
defaultConfig
}
from
'next/dist/server/config-shared'
jest
.
mock
(
'next/dist/cli/next-upgrade'
,
()
=>
({
jest
.
mock
(
'next/dist/cli/next-upgrade'
,
()
=>
({
spawnNextUpgrade
:
jest
.
fn
(),
spawnNextUpgrade
:
jest
.
fn
(),
...
@@ -94,7 +95,7 @@ const initialNextVersion = process.env.__NEXT_VERSION
...
@@ -94,7 +95,7 @@ const initialNextVersion = process.env.__NEXT_VERSION
const
initialRequestedUpgrade
=
process
.
env
.
__NEXT_AGENT_UPGRADE
const
initialRequestedUpgrade
=
process
.
env
.
__NEXT_AGENT_UPGRADE
const
config
=
(
const
config
=
(
policy
:
'security'
|
'latest'
|
'experimental-future'
|
boolean
,
policy
:
'security'
|
'latest'
|
'experimental-future'
|
false
,
values
:
Record
<
string
,
unknown
>
=
{}
values
:
Record
<
string
,
unknown
>
=
{}
)
=>
)
=>
({
({
...
@@ -103,8 +104,9 @@ const config = (
...
@@ -103,8 +104,9 @@ const config = (
experimental
:
{
agentUpgrade
:
policy
},
experimental
:
{
agentUpgrade
:
policy
},
})
as
never
})
as
never
it
(
'uses the security policy when agentUpgrade is true'
,
()
=>
{
it
(
'defaults agentUpgrade to the security policy'
,
()
=>
{
const
context
=
getUpgradeContext
(
config
(
true
))
expect
(
defaultConfig
.
experimental
.
agentUpgrade
).
toBe
(
'security'
)
const
context
=
getUpgradeContext
(
config
(
'security'
))
expect
(
context
.
experimental
.
agentUpgrade
).
toBe
(
'security'
)
expect
(
context
.
experimental
.
agentUpgrade
).
toBe
(
'security'
)
})
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment