4ea1bbb7a8058f4aff843a488240f6a6ca28e3a2
Session-2 (continuation of d614462 INCONCLUSIVE) executed disambiguation
plan and converged on a definitive verdict. Three independent observations
ruled out ALL architectural-failure hypotheses:
Step A: race-tolerant offscreen target attach (committed separately;
enabled visibility into the offscreen recorder + remux pipeline).
Step B: pre-kill and post-kill segment-count probes via the existing
`__mokoshOffscreenQuery 'get-segment-count'` bridge op (no new
test-only symbols introduced; FORBIDDEN_HOOK_STRINGS inventory
unchanged at 12 entries). Observed segments.length transition:
POST-PRIME=0 → PRE-KILL=3 → POST-KILL=3
Segments structurally survive the SW kill (offscreen still responds
to bridge query post-kill). Hypothesis A (architectural RAM loss
across SW termination) REFUTED.
Step C: SPIKE_SKIP_SW_KILL=1 env-var mode skips worker.close(). The
resulting videoSize is IDENTICAL to the canonical run (8505 bytes).
Hypothesis C (CDP-induced offscreen collateral teardown) REFUTED.
Since SW was not killed, its console listener stayed connected,
exposing the full Remux pipeline output:
[SW:Remux] Segment ts=1: 0 frames, duration=0ms, trackInfo=320x180
[SW:Remux] Segment ts=2: 0 frames, duration=0ms, trackInfo=320x180
[SW:Remux] Segment ts=3: 0 frames, duration=0ms, trackInfo=320x180
[SW:Remux] Remux complete: 0 frames, total timeline=0ms, output=8505 bytes
Each segment Blob has a valid track header (PixelWidth/Height parsed
successfully) but ZERO VP9 frames. Hypothesis B (canvas-captureStream
throttling in headless idle) CONFIRMED.
VERDICT: REFUTED-architecture (canvas-captureStream issue).
The architecture (offscreen-RAM `segments: Blob[] = []`) works
correctly; the spike's test methodology is invalid. The
`installFakeDisplayMedia` synthetic stream (canvas.captureStream(30)
on a hidden -9999px-offset 320x180 canvas) cannot sustain frame
production during a 5-min headless idle window despite the
`setInterval(drawFrame, 33ms)` belt-and-suspenders mitigation. This
matches the documented Chromium throttling of MediaRecorder on
invisible-canvas sources (Chrome bug 653548; auto-throttled-screen-capture
design doc; sendrec.eu blog "Why Canvas Breaks Your Screen Recorder").
ROUTING RECOMMENDATION (out of scope for this debug session):
- Do NOT proceed with the IndexedDB persistence plan-fix proposed by
Plan 04-04 SUMMARY. The plan-fix would NOT close SC #1 because the
spike would STILL produce 8505 bytes after IDB lands — the failure
is in the test's fake stream, not in segment persistence.
- Open a new plan slot (likely Plan 04-08 or a Phase 5 plan) that
reframes SC #1 verification methodology. Options:
(a) real getDisplayMedia in non-headless Puppeteer with
--auto-select-desktop-capture-source;
(b) video-file-backed MediaStream source (HTMLVideoElement
playing a bundled WebM) — bypasses canvas-captureStream
throttling entirely;
(c) reduce SC #1 wall-clock idle threshold to a value short
enough that canvas-captureStream survives (e.g., 30s) AND
add a separate manual operator-empirical test for 5-min.
ROADMAP SC #1 status: REMAINS OPEN. The architecture is sound; the
empirical verification gate is broken. Plan 04-04 SUMMARY's
characterization ("spike FAILED → architectural plan-fix needed") is
TECHNICALLY CORRECT on the first clause but INCORRECT on the second —
the spike's failure mode is in test infrastructure, not in production
code.
Files in this commit:
- tests/uat/spike-a33-sw-persistence.ts: added probeSegmentCount
helper using existing __mokoshOffscreenQuery bridge op; 3
checkpoints (POST-PRIME / PRE-KILL / POST-KILL); SPIKE_SKIP_SW_KILL=1
env-var skips worker.close() for Step C disambiguation.
- .planning/debug/sw-offscreen-persistence-investigation-session-2.md:
NEW session-2 debug note documenting full evidence trail + verdict
derivation + routing recommendation.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mokosh — Session Capture
Chrome MV3 extension that records operator sessions for bug reports.
Фаза 1 — Локальная запись + экспорт архива
Установка и запуск
Разработка
# Установка зависимостей
npm install
# Сборка для разработки с HMR
npm run dev
# Сборка для продакшена
npm run build
Установка расширения в Chrome
-
Соберите проект:
npm run build -
Откройте Chrome и перейдите по адресу:
chrome://extensions/ -
Включите "Режим разработчика" (Developer mode) в правом верхнем углу
-
Нажмите кнопку "Загрузить распакованное расширение" (Load unpacked)
-
Выберите папку
distв корне проекта -
Расширение установлено!
Использование
-
При первом открытии popup расширение запросит разрешение на запись экрана
-
Разрешение обязательно для работы расширения
-
Расширение автоматически начнет запись:
- Видео: последние 30 секунд (кольцевой буфер)
- DOM-события через rrweb: последние 10 минут
- Лог действий пользователя: последние 10 минут
-
Для сохранения отчета об ошибке:
- Нажмите на иконку расширения
- Нажмите кнопку "Сохранить отчёт об ошибке"
- Архив автоматически загрузится в папку "Загрузки"
Структура архива
Архив session_report_YYYY-MM-DD_HH-MM-SS.zip содержит:
session_report_2025-05-15_14-32-10.zip
├── video/
│ └── last_30sec.webm # склеенные чанки видеобуфера
├── rrweb/
│ └── session.json # массив DOM-событий rrweb
├── logs/
│ └── events.json # лог действий пользователя
├── screenshot.png # скриншот в момент сохранения
└── meta.json # метаданные сессии
Технический стек
- Тип расширения: Chrome Extension, Manifest V3
- Service Worker: Background script (Manifest V3)
- Захват экрана:
chrome.tabCaptureAPI - Захват DOM:
rrweb(npm: rrweb) - Лог событий: Content Script
- Упаковка архива:
JSZip(npm: jszip) - Сохранение файла:
chrome.downloadsAPI - Хранение буфера: In-memory (Service Worker + Content Script)
- Build: Vite + crxjs + TypeScript
Особенности
Маскирование чувствительных данных
- Пароли (
input[type=password]) маскируются автоматически в rrweb и логах - Поля с атрибутом
data-sensitive="true"также маскируются в rrweb
Записываемые события
Пользовательские события
- click — клик по любому элементу
- input — изменение значения поля (без паролей)
- navigation — переходы по страницам (popstate, hashchange, History API)
- js_error — JavaScript ошибки (window.onerror, unhandledrejection)
- network_error — сетевые ошибки (fetch/XHR с кодом ответа >= 400)
Кольцевой буфер
- Видео: 30 секунд, первый чанк (WebM заголовок) хранится всегда
- rrweb события: 10 минут, максимум 5000 событий
- Пользовательские события: 10 минут
Память
- Ожидаемое потребление: ~5-10 МБ в фоновом режиме
Критерии приёмки Фазы 1
- ✅ Расширение устанавливается в Chrome без ошибок
- ✅ Видеобуфер непрерывно работает на любой вкладке
- ✅ В буфере всегда есть не более 30 секунд видео
- ✅ rrweb пишет DOM-события без ошибок на типовых страницах
- ✅ Лог событий фиксирует клики, навигацию и сетевые ошибки
- ✅ При нажатии кнопки архив скачивается в "Загрузки" за < 5 секунд
- ✅ Архив открывается,
last_30sec.webmвоспроизводится в браузере - ✅ Пароли не попадают в лог и rrweb-снимки
- ✅ RAM-потребление расширения не превышает 50 МБ в фоне
Отладка
Console Logs
Расширение пишет подробные логи в консоль:
- Service Worker: Chrome DevTools → Extensions → Service Worker → Console
- Content Script: Chrome DevTools на любой странице → Console
- Popup: Правый клик по popup → Проверить
Структура проекта
ai-call-extension/
├── src/
│ ├── background/ # Service Worker
│ │ └── index.ts
│ ├── content/ # Content Script
│ │ └── index.ts
│ ├── popup/ # Popup UI
│ │ ├── index.html
│ │ ├── index.ts
│ │ └── style.css
│ └── shared/ # Общие типы и утилиты
│ ├── types.ts
│ └── logger.ts
├── icons/ # Иконки расширения
├── dist/ # Собранные файлы
├── manifest.json # Manifest расширения
├── vite.config.ts # Конфигурация Vite
├── tsconfig.json # Конфигурация TypeScript
└── package.json
Лицензия
MIT
Контакты
Для вопросов и предложений обращайтесь в support.
Description
Languages
TypeScript
91%
HTML
3.4%
CSS
2.8%
Shell
2%
JavaScript
0.8%