Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Notes from a 2 AM On-Call: When Cursor Plugin Context Windows Silently Truncate

Описание и применение

Плагин Cursor пропустил каталог e2e из контекста из‑за ограничения токенов, что привело к сбою в продакшене после рефакторинга Pydantic. Добавление e2e в контекст, увеличение лимита токенов и проверка в pre‑commit предотвратили дальнейшие сбои.

Задача

Cursor AI plugin omitted critical e2e tests from context due to token budget, causing a production crash after refactoring Pydantic models.

Результат

By ensuring the e2e test directory is included in the Cursor plugin context and adding a pre‑commit gate, the team prevented silent context truncation and avoided production crashes. Token budget adjustments and relay caching reduced refactor costs by 60%.

Рабочий процесс

  • Configure Cursor plugin with "includeTests": true and maxTokens 4096.
  • Run CI tests; plugin indexes unit tests but omits e2e/ due to token limit.
  • Deploy to production; crash occurs on first request.
  • Investigate logs; identify missing e2e test case causing schema failure.
  • Update .cursorrules to enforce e2e coverage and increase maxTokens to 8192.
  • Add "includePaths": ["e2e/"] to plugin manifest.
  • Add pre‑commit hook to fail if e2e/ is missing from context.
  • Re‑run CI; verify Show Context panel includes e2e/.
  • Deploy again; service runs correctly.
  • Benchmark token usage across providers; adopt B‑Lost relay for cost savings.

Доказательства

our integration test that exercised the actual production schema path lived in a separate e2e/ directory outside the plugin's default file tree traversal

Источник

Cursor plugins use a breadth-first file traversal with token budget enforcement. When you hit maxTokens, later directories get silently omitted from context—no warning, no error.

Источник

The 3-line fix in .cursorrules: 1. ALWAYS run pytest e2e/ -v before claiming tests pass 2. Verify e2e/ directory is in working set via 'Show Context' panel 3. Reject any schema change if e2e coverage drops below baseline

Источник

  • Дата записи: 2026-10-18T23:41:07.294Z