default to deep context (#1891)

<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Default Smart Files context to deep and align UI and stream handler
logic so any non-balanced option uses deep when Pro mode is enabled.
> 
> - **Smart Context behavior**
> - UI (`src/components/ProModeSelector.tsx`): default
`getCurrentValue()` to `"deep"` when Pro Smart Files mode is enabled
without an explicit option.
> - Engine (`src/ipc/handlers/chat_stream_handlers.ts`):
`isDeepContextEnabled` now requires `enableProSmartFilesContextMode` and
treats any option other than `"balanced"` as deep; `smartContextMode`
set accordingly and `versioned_files` used when deep.
> - **Snapshots**
> - Update e2e snapshots to reflect `smart_context_mode: "deep"` and new
`dyad_options.versioned_files` structure.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
7426890467d60b671a7a9712f7544a35ed922981. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->





<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Default smart files context to deep and align the UI and stream handler
so anything not “balanced” uses deep when Pro Smart Files mode is on.
This prevents mismatches and makes deep context the default.

- **Bug Fixes**
  - ProModeSelector: default to deep when no option is set.
- chat_stream_handlers: isDeepContextEnabled requires Pro Smart Files
mode and treats non-“balanced” as deep; smartContextMode set to deep
accordingly.
  - Engine payload: use versioned_files; update e2e snapshots.

<sup>Written for commit 7426890467d60b671a7a9712f7544a35ed922981.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
This commit is contained in:
Will Chen
2025-12-04 22:13:49 -08:00
committed by GitHub
parent 538745d546
commit 40aeed1456
13 changed files with 4465 additions and 3665 deletions

View File

@@ -20,86 +20,108 @@
"budget_tokens": 4000 "budget_tokens": 4000
}, },
"dyad_options": { "dyad_options": {
"files": [ "versioned_files": {
"fileIdToContent": {
"fd0f9b44a8d543177b124c3b9b5e62da7d0e2683379352e9e2c587d285c36686": "// File contents excluded from context",
"732a1ebb3b9b602d7104636b4009f8bb3f1d840c9fed3c3eb0dd56a3d299cbf2": "// a.ts\n",
"9a5461c208c95126e54da61c3159980e6447678d96cd065aaff1b87c3a9d1f95": "# AI_RULES.md\n",
"86524c67667ac0b50cc96ad10d0e35630e81c9eee53c90bdd4576779c146773d": "// exclude.ts: this file is not in any of the globs\n",
"923470fd746b2d90ec177920cc2ac10f9ecefff6272e8f6fa69ea714909478ab": "// exclude.tsx: this file is not in any of the globs\n",
"075b6697b2282dfd4cce18f78bcbc51bf5f0d9c0c0911c889b9d72243b9187c3": "[\"even json is included\"]\n",
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855": "",
"3d74d7280ec3f9cc2c7b73cbd4e201517b0a30f6a908cf7392adb49d61cef3fc": "// button.tsx\n",
"4478ae9a9ff89b3c68fc44309614668629664d86354a381662ffd07716ce20ce": "// helper.ts\n",
"2ba642df741f3bdeaf26894e4e0b56d2adacd4202977831e559ca1306e2cc039": "/* some.css */\n",
"2f653d8827ab78f82263eb63f722ef7c6be026d4fa5630c3ce6fb94612751e0c": "// foo.ts\n",
"50d0d59f927dc56f5f47adc37de69fc9a3334546a54f86a08d742b6c5cef07c9": "// sub/sub1.ts\n",
"51304e7cdc9cba392b7ed7f7ae1b8e276bc757bfa15267214e2f20b75a2dac6f": "// sub/sub2.tsx\n",
"444fd8107293606e0d88acf691ba98fa30de47c04b58c7930b2ee3e24c6ea17d": "// very-large-file.ts\n\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n"
},
"fileReferences": [
{ {
"path": ".env.foobar", "path": ".env.foobar",
"content": "// File contents excluded from context", "force": false,
"force": false "fileId": "fd0f9b44a8d543177b124c3b9b5e62da7d0e2683379352e9e2c587d285c36686"
}, },
{ {
"path": "a.ts", "path": "a.ts",
"content": "// a.ts\n", "force": true,
"force": true "fileId": "732a1ebb3b9b602d7104636b4009f8bb3f1d840c9fed3c3eb0dd56a3d299cbf2"
}, },
{ {
"path": "AI_RULES.md", "path": "AI_RULES.md",
"content": "# AI_RULES.md\n", "force": false,
"force": false "fileId": "9a5461c208c95126e54da61c3159980e6447678d96cd065aaff1b87c3a9d1f95"
}, },
{ {
"path": "exclude/exclude.ts", "path": "exclude/exclude.ts",
"content": "// exclude.ts: this file is not in any of the globs\n", "force": false,
"force": false "fileId": "86524c67667ac0b50cc96ad10d0e35630e81c9eee53c90bdd4576779c146773d"
}, },
{ {
"path": "exclude/exclude.tsx", "path": "exclude/exclude.tsx",
"content": "// exclude.tsx: this file is not in any of the globs\n", "force": false,
"force": false "fileId": "923470fd746b2d90ec177920cc2ac10f9ecefff6272e8f6fa69ea714909478ab"
}, },
{ {
"path": "manual/baz.json", "path": "manual/baz.json",
"content": "[\"even json is included\"]\n", "force": true,
"force": true "fileId": "075b6697b2282dfd4cce18f78bcbc51bf5f0d9c0c0911c889b9d72243b9187c3"
}, },
{ {
"path": "manual/file.ts", "path": "manual/file.ts",
"content": "", "force": true,
"force": true "fileId": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
}, },
{ {
"path": "manual/sub-manual/sub-manual.js", "path": "manual/sub-manual/sub-manual.js",
"content": "", "force": true,
"force": true "fileId": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
}, },
{ {
"path": "src/components/ui/button.tsx", "path": "src/components/ui/button.tsx",
"content": "// button.tsx\n", "force": false,
"force": false "fileId": "3d74d7280ec3f9cc2c7b73cbd4e201517b0a30f6a908cf7392adb49d61cef3fc"
}, },
{ {
"path": "src/components/ui/helper.ts", "path": "src/components/ui/helper.ts",
"content": "// helper.ts\n", "force": false,
"force": false "fileId": "4478ae9a9ff89b3c68fc44309614668629664d86354a381662ffd07716ce20ce"
}, },
{ {
"path": "src/dir/some.css", "path": "src/dir/some.css",
"content": "/* some.css */\n", "force": false,
"force": false "fileId": "2ba642df741f3bdeaf26894e4e0b56d2adacd4202977831e559ca1306e2cc039"
}, },
{ {
"path": "src/foo.ts", "path": "src/foo.ts",
"content": "// foo.ts\n", "force": false,
"force": false "fileId": "2f653d8827ab78f82263eb63f722ef7c6be026d4fa5630c3ce6fb94612751e0c"
}, },
{ {
"path": "src/sub/sub1.ts", "path": "src/sub/sub1.ts",
"content": "// sub/sub1.ts\n", "force": false,
"force": false "fileId": "50d0d59f927dc56f5f47adc37de69fc9a3334546a54f86a08d742b6c5cef07c9"
}, },
{ {
"path": "src/sub/sub2.tsx", "path": "src/sub/sub2.tsx",
"content": "// sub/sub2.tsx\n", "force": false,
"force": false "fileId": "51304e7cdc9cba392b7ed7f7ae1b8e276bc757bfa15267214e2f20b75a2dac6f"
}, },
{ {
"path": "src/very-large-file.ts", "path": "src/very-large-file.ts",
"content": "// very-large-file.ts\n\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n", "force": false,
"force": false "fileId": "444fd8107293606e0d88acf691ba98fa30de47c04b58c7930b2ee3e24c6ea17d"
} }
], ],
"messageIndexToFilePathToFileId": {
"1": {}
},
"hasExternalChanges": true
},
"enable_lazy_edits": true, "enable_lazy_edits": true,
"enable_smart_files_context": true, "enable_smart_files_context": true,
"smart_context_mode": "balanced", "smart_context_mode": "deep",
"app_id": 1 "app_id": 1
} }
}, },

View File

@@ -20,56 +20,72 @@
"budget_tokens": 4000 "budget_tokens": 4000
}, },
"dyad_options": { "dyad_options": {
"files": [ "versioned_files": {
"fileIdToContent": {
"732a1ebb3b9b602d7104636b4009f8bb3f1d840c9fed3c3eb0dd56a3d299cbf2": "// a.ts\n",
"075b6697b2282dfd4cce18f78bcbc51bf5f0d9c0c0911c889b9d72243b9187c3": "[\"even json is included\"]\n",
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855": "",
"4478ae9a9ff89b3c68fc44309614668629664d86354a381662ffd07716ce20ce": "// helper.ts\n",
"2f653d8827ab78f82263eb63f722ef7c6be026d4fa5630c3ce6fb94612751e0c": "// foo.ts\n",
"50d0d59f927dc56f5f47adc37de69fc9a3334546a54f86a08d742b6c5cef07c9": "// sub/sub1.ts\n",
"51304e7cdc9cba392b7ed7f7ae1b8e276bc757bfa15267214e2f20b75a2dac6f": "// sub/sub2.tsx\n",
"444fd8107293606e0d88acf691ba98fa30de47c04b58c7930b2ee3e24c6ea17d": "// very-large-file.ts\n\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n"
},
"fileReferences": [
{ {
"path": "a.ts", "path": "a.ts",
"content": "// a.ts\n", "force": true,
"force": true "fileId": "732a1ebb3b9b602d7104636b4009f8bb3f1d840c9fed3c3eb0dd56a3d299cbf2"
}, },
{ {
"path": "manual/baz.json", "path": "manual/baz.json",
"content": "[\"even json is included\"]\n", "force": true,
"force": true "fileId": "075b6697b2282dfd4cce18f78bcbc51bf5f0d9c0c0911c889b9d72243b9187c3"
}, },
{ {
"path": "manual/file.ts", "path": "manual/file.ts",
"content": "", "force": true,
"force": true "fileId": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
}, },
{ {
"path": "manual/sub-manual/sub-manual.js", "path": "manual/sub-manual/sub-manual.js",
"content": "", "force": true,
"force": true "fileId": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
}, },
{ {
"path": "src/components/ui/helper.ts", "path": "src/components/ui/helper.ts",
"content": "// helper.ts\n", "force": false,
"force": false "fileId": "4478ae9a9ff89b3c68fc44309614668629664d86354a381662ffd07716ce20ce"
}, },
{ {
"path": "src/foo.ts", "path": "src/foo.ts",
"content": "// foo.ts\n", "force": false,
"force": false "fileId": "2f653d8827ab78f82263eb63f722ef7c6be026d4fa5630c3ce6fb94612751e0c"
}, },
{ {
"path": "src/sub/sub1.ts", "path": "src/sub/sub1.ts",
"content": "// sub/sub1.ts\n", "force": false,
"force": false "fileId": "50d0d59f927dc56f5f47adc37de69fc9a3334546a54f86a08d742b6c5cef07c9"
}, },
{ {
"path": "src/sub/sub2.tsx", "path": "src/sub/sub2.tsx",
"content": "// sub/sub2.tsx\n", "force": false,
"force": false "fileId": "51304e7cdc9cba392b7ed7f7ae1b8e276bc757bfa15267214e2f20b75a2dac6f"
}, },
{ {
"path": "src/very-large-file.ts", "path": "src/very-large-file.ts",
"content": "// very-large-file.ts\n\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n// 1234567890\n", "force": false,
"force": false "fileId": "444fd8107293606e0d88acf691ba98fa30de47c04b58c7930b2ee3e24c6ea17d"
} }
], ],
"messageIndexToFilePathToFileId": {
"1": {}
},
"hasExternalChanges": true
},
"enable_lazy_edits": true, "enable_lazy_edits": true,
"enable_smart_files_context": true, "enable_smart_files_context": true,
"smart_context_mode": "balanced", "smart_context_mode": "deep",
"app_id": 1 "app_id": 1
} }
}, },

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -315,9 +315,8 @@ function SmartContextSelector({
if (settings?.proSmartContextOption === "balanced") { if (settings?.proSmartContextOption === "balanced") {
return "balanced"; return "balanced";
} }
// Keep in sync with getModelClient in get_model_client.ts // Keep logic in sync with isDeepContextEnabled in chat_stream_handlers.ts
// If enabled but no option set (undefined/falsey), it's balanced return "deep";
return "balanced";
}; };
const currentValue = getCurrentValue(); const currentValue = getCurrentValue();

View File

@@ -519,7 +519,9 @@ ${componentSnippet}
const isDeepContextEnabled = const isDeepContextEnabled =
isEngineEnabled && isEngineEnabled &&
settings.proSmartContextOption === "deep" && settings.enableProSmartFilesContextMode &&
// Anything besides balanced will use deep context.
settings.proSmartContextOption !== "balanced" &&
mentionedAppsCodebases.length === 0; mentionedAppsCodebases.length === 0;
logger.log(`isDeepContextEnabled: ${isDeepContextEnabled}`); logger.log(`isDeepContextEnabled: ${isDeepContextEnabled}`);
@@ -829,8 +831,7 @@ This conversation includes one or more image attachments. When the user uploads
} }
const smartContextMode: SmartContextMode = isDeepContextEnabled const smartContextMode: SmartContextMode = isDeepContextEnabled
? "deep" ? "deep"
: // Keep in sync with getCurrentValue in ProModeSelector.tsx : "balanced";
"balanced";
// Build provider options with correct Google/Vertex thinking config gating // Build provider options with correct Google/Vertex thinking config gating
const providerOptions: Record<string, any> = { const providerOptions: Record<string, any> = {
"dyad-engine": { "dyad-engine": {