Commit Graph

1 Commits

Author SHA1 Message Date
Will Chen
3701886505 Fallback to balanced smart context for mentioned apps because not sup… (#1886)
…ported in deep context

Fixes https://github.com/dyad-sh/dyad/issues/1715

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Deep context now only applies with no app mentions; otherwise we
fallback to balanced and pass the effective mode to the engine, with
updated history limits and new e2e coverage.
> 
> - **Smart Context behavior**:
> - Deep mode activates only when no `@app:` mentions are present;
otherwise uses `balanced`.
> - Max chat turns set to 201 only for deep-without-mentions; otherwise
use configured limit.
> - **Engine integration**:
> - Send effective smart context mode via `dyadSmartContextMode` and map
to `dyad_options.smart_context_mode` in `llm_engine_provider`.
> - Add `SmartContextMode` schema (`balanced|conservative|deep`) and use
it in settings/types.
> - Remove static `smartContextMode` from engine options; use
per-request mode instead.
> - **Tests**:
> - Add e2e test `smart context deep - mention app should fallback to
balanced` with snapshot asserting `smart_context_mode: "balanced"` and
mentioned app files.
> - **Misc**:
>   - Tighten app path validation regex in `rename-app` handler.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
5aada2bd246e297d7b35e36738f75c8531b897ae. 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
Fallback to balanced smart context when an app is mentioned in deep
mode, since deep doesn’t support mentioned apps. This keeps context
limits correct and updates engine config, with new e2e coverage.

- **Bug Fixes**
- Deep mode only applies when no apps are mentioned; otherwise we use
balanced.
- Max chat turns: 201 only for deep without mentions; otherwise use
configured limit.
- Plumb smart context mode via dyadSmartContextMode to the engine; add
SmartContextMode schema.
- Add e2e test to verify fallback in deep mode when an app is mentioned.

<sup>Written for commit 5aada2bd246e297d7b35e36738f75c8531b897ae.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-12-04 15:19:37 -08:00