CodeNomad/scripts
Pascal André 1840c71054
Some checks are pending
Publish help / build (push) Waiting to run
Publish help / deploy (push) Blocked by required conditions
fix(timeline): mirror every transcript block in order and keep clicks on the clicked marker (#1086)
## What changes for the user
The timeline now matches the transcript block for block, and a click
lands exactly where it should.

- **One marker per visible block, in transcript order:** each reply,
each thinking run, each tool (or collapsed tool group), each compaction
and each system context. Markers follow Message content: a block that is
hidden in the transcript is hidden in the timeline too.
- **The clicked marker stays active** until you scroll, and its own
block, not just the start of its message, is placed at the reading
position. This also works for history that is not loaded yet.
- **While scrolling,** the active marker is the first block below the
reading line.

## Reproduced in numbers before fixing
We replayed 45 of the user's real sessions (65,241 messages, exported
read-only) into the real `SessionView`, with the outline, windows and
previews served by the real server readers. Each session was measured at
1280×800 with two presets, using 16 real pointer clicks and 8 wheel
scrolls per run. Baseline and fix used the same seeds.

| Metric | Before, Complet | Before, Balanced | After, both presets |
|---|---|---|---|
| Sessions out of sync | 43/45 | 42/45 | 0/90 runs |
| Markers / expected | 68,949 / 130,818 | 68,949 / 98,759 | 130,818 /
130,818 and 98,759 / 98,759 |
| Click: clicked marker active | 53.6% (46.0% the one above) | 57.2% |
1,440 / 1,440 |
| Click: block at reading position | 41.5% (median off by 35 px) | 82.2%
| 1,440 / 1,440 (median 0.27 px) |
| Scroll: reading-line block active | 93.1% | 92.2% | 505 / 505 moving
wheels |

What was wrong with the markers in the Complet runs:
- 29,782 tool markers were collapsed into one marker per step.
- 31,777 thinking blocks and 282 system blocks had no marker.
- There were 10,232 order inversions.

## Causes
1. Once an outline existed, the outline projection replaced the markers
of loaded messages too (`message-section.tsx`). It collapsed a step's
tools into one marker placed before its reply, and dropped system
blocks.
2. Resident segments merged thinking into replies, dropped thinking-only
steps and skipped system parts.
3. After a click or a scroll, the active marker was the message's first
marker. The message itself came from a scroll offset that rounds a row
starting just below the top to the previous message.
4. Clicks navigated to the message, not to the block.
5. Jumps into unloaded history had no row to hold while the target was
not yet rendered.

## How
- **Server (outline):** each assistant step can now carry an optional
`layout` field. It lists the step's visible parts in order: thinking
runs, reply runs and each tool, at most 64 entries. It is computed in
the same bounded SQL. Older plugin copies don't send it, and the client
then falls back to the counts: thinking, then text, then tools.
- **Markers:** `buildTimelineSegments` emits one marker per block, keyed
`messageId:type:ordinal`. Loaded messages keep their exact markers.
Unloaded steps are placed at their native position from `layout`.
- **Click and scroll:** the list's `scrollToKey(key, selector)` holds
the selected block on every frame, survives row remounts, and follows
Virtua's estimate until the row renders. `timeline-transcript-blocks.ts`
maps markers to blocks and finds the block at the reading line.
- **Saved indexes:** outline indexes saved without `layout` are
revalidated once.
- **Docs and help:** updated in `dev-docs/SESSION_HISTORY_NAVIGATION.md`
and in the help pages for all 10 locales.

## Behaviour to be aware of
- **The timeline has more markers:** about +90% with Complet and +43%
with Balanced on this sample, because every tool, thinking and system
block now has its own marker.
- **Tool icons for unloaded steps:** a step not loaded yet shows its
first tool's icon on all of its tool markers, until its window loads.
- **Plugin requirement:** the pruning plugin must ship with the new
`layout` field.

## Validation
- **New regression test:** `tests/browser/timeline-sync.test.ts` passes
4/4 and fails 4/4 on unmodified dev. Fixtures are synthetic.
- **Measurement harness:** the opt-in qualification `npm run
qualify:browser:timeline-sync`.
- **Browser suites:**

  | Suite | Result |
  |---|---|
  | history-navigation | 65 |
  | message-scroll | 128 |
  | session-rendering | 47 |
  | render-cost | 17 |
  | full-source-copy | 12 |
  | search-highlight | 11 |
  | system-messages | 10 |
  | timeline-tool-filters | pass |
| streaming-outline (no full reprojection over 64 token deltas) | pass |
  | session-search | pass |
  | transcript-presets | pass |

- **Other checks:** UI unit tests 75/75, server session-pruning 70/70,
help 9/9 and the UI typecheck pass.
- **After rebasing on dev:** the typecheck passes, along with
timeline-sync 4/4, timeline-tool-filters, full-source-copy 12/12,
usage-metrics 5/5 and streaming-outline.

Oversized files touched: `message-section.tsx` (~1,637 lines),
`virtual-follow-list.tsx` (~1,368), `message-timeline.tsx` (~508),
`message-timeline.css` (204).
2026-10-22 05:32:43 +02:00
..
fixtures chore(opencode): retire adaptations for runtimes and events OpenCode V2 no longer produces (#1034) 2026-10-20 19:19:47 +02:00
missions-child-environment chore(opencode): retire adaptations for runtimes and events OpenCode V2 no longer produces (#1034) 2026-10-20 19:19:47 +02:00
recurring-simple-native feat(missions): coordinator hand-offs, task interrupts and native decision evidence (#1013) 2026-10-19 00:34:27 +02:00
winget build: ship the Linux deb from Electron and the Windows installer without a ZIP (#955) 2026-10-14 16:45:49 +02:00
benchmark-session-history.mjs fix(history): fill search pages and remove redundant counting (#839) 2026-10-03 11:36:04 +02:00
build-help.mjs docs(help): multilingual help site with in-app Help menu and palette entry (#859) 2026-10-14 22:44:56 +02:00
bump-version.js Fix bumpVersion script for both npm and tauri 2026-03-31 20:15:16 +01:00
compare-user-html-rendering.mjs fix(chat): display user HTML as literal source (#777) 2026-09-25 09:52:18 +02:00
desktop-server-resources.cjs feat(tauri): signed cross-platform updates with stable and preview feeds (#786) 2026-10-14 12:18:36 +02:00
desktop-server-resources.test.cjs feat(tauri): signed cross-platform updates with stable and preview feeds (#786) 2026-10-14 12:18:36 +02:00
native-fixture-diagnostics.mjs fix(ci): stabilize Windows native tests and artifact comments (#828) 2026-10-02 11:24:27 +02:00
native-fixture-diagnostics.test.mjs fix(ci): stabilize Windows native tests and artifact comments (#828) 2026-10-02 11:24:27 +02:00
native-fixture-guards.mjs feat(missions): native project coordination, briefings and tracking (#866) 2026-10-11 14:55:49 +02:00
native-fixture-guards.test.mjs feat(missions): native project coordination, briefings and tracking (#866) 2026-10-11 14:55:49 +02:00
native-product-fixture.mjs feat(plugins): native package check and update (6/8) (#794) 2026-10-15 02:54:19 +02:00
prepare-node-runtime.cjs feat(opencode): enforce stable runtime support and add managed setup 2026-09-20 16:09:36 +02:00
prepare-node-runtime.test.cjs feat(opencode): enforce stable runtime support and add managed setup 2026-09-20 16:09:36 +02:00
preview-git-history.mjs feat(files): unify Workspace, Changes and Commits with central previews (#797) 2026-10-01 11:10:50 +02:00
profile-outline-projection.mjs perf(ui): skip redundant outline and superseded Markdown work (#852) 2026-10-05 22:32:03 +02:00
profile-outline-responsiveness.mts fix: reduce compaction and cross-session responsiveness stalls 2026-10-02 00:40:45 +02:00
profile-streaming-responsiveness.mjs perf(ui): skip redundant outline and superseded Markdown work (#852) 2026-10-05 22:32:03 +02:00
profile-ui-motion.mjs fix(status): keep connected MCP indicators static at rest (#806) 2026-09-30 14:03:19 +02:00
run-session-pruning-native.mjs fix(ci): stabilize Windows native tests and artifact comments (#828) 2026-10-02 11:24:27 +02:00
smoke-packaged-resources.cjs feat(remote-control): add Remote Control over OpenTunnel alongside direct access (#668) 2026-10-09 12:43:25 +02:00
test-attachment-picker-desktop.mjs feat(composer): unify native device attachments and project references (#729) 2026-09-24 23:12:44 +02:00
test-automation-native.mjs chore(opencode): retire adaptations for runtimes and events OpenCode V2 no longer produces (#1034) 2026-10-20 19:19:47 +02:00
test-blank-session-cleanup-native.mjs fix(sessions): preserve populated sessions during automatic cleanup (#755) 2026-09-23 11:53:01 +02:00
test-codemode-jobs-native.mjs fix(opencode): qualify and require 2.1.2 for correct Code Mode execution (#1078) 2026-10-21 14:36:51 +02:00
test-compaction-isolation-native.mjs chore(opencode): retire adaptations for runtimes and events OpenCode V2 no longer produces (#1034) 2026-10-20 19:19:47 +02:00
test-electron-owner-close.mjs fix(electron): avoid destroyed window access on close (#785) 2026-09-28 13:12:07 +02:00
test-git-degraded-native.mjs feat(missions): native project coordination, briefings and tracking (#866) 2026-10-11 14:55:49 +02:00
test-git-init-native.mjs feat(files): initialize Git from the Files panel for plain folders (#933) 2026-10-13 03:11:00 +02:00
test-help-browser.mjs docs(help): multilingual help site with in-app Help menu and palette entry (#859) 2026-10-14 22:44:56 +02:00
test-help.mjs docs(help): list Remote Control before direct access (#990) 2026-10-17 13:27:43 +02:00
test-missions-native-contract.mjs chore(opencode): retire adaptations for runtimes and events OpenCode V2 no longer produces (#1034) 2026-10-20 19:19:47 +02:00
test-missions-native-family-control.mjs feat(missions): native project coordination, briefings and tracking (#866) 2026-10-11 14:55:49 +02:00
test-missions-native-trajectory.mjs feat(missions): add a "Compare two models" Mission template (#1026) 2026-10-20 13:55:12 +02:00
test-missions-native.mjs fix(missions): compact coordinator tool results and state the decision rule (#1011) 2026-10-18 22:28:39 +02:00
test-native-event-relay.mjs fix: reduce compaction and cross-session responsiveness stalls 2026-10-02 00:40:45 +02:00
test-native-worktree-management.mjs fix(events): prevent relay timeout on worktree discovery waits (#837) 2026-10-03 04:04:03 +02:00
test-opencode-history-migration.mjs chore(opencode): qualify 2.1.0 and adopt its native contracts (#1029) 2026-10-20 16:46:38 +02:00
test-opencode-install-native.mjs fix(opencode): share host plugin runtime and require 2.0.27 (#920) 2026-10-12 16:42:07 +02:00
test-opencode-legacy-replacement-native.mjs fix(opencode-setup): offer OpenCode 2 when an old or foreign OpenCode blocks setup (#982) 2026-10-16 15:44:17 +02:00
test-opencode-location-native.mjs chore(opencode): retire adaptations for runtimes and events OpenCode V2 no longer produces (#1034) 2026-10-20 19:19:47 +02:00
test-opencode-proxy-native.mjs fix(opencode): qualify 2.0.22 and fence parent session creation (#830) 2026-10-02 15:47:14 +02:00
test-opencode-setup-desktop.mjs fix(opencode): retire private runtime fallback and restore first-run setup (#760) 2026-09-24 00:25:40 +02:00
test-opencode-setup-wsl.mjs chore(opencode): retire adaptations for runtimes and events OpenCode V2 no longer produces (#1034) 2026-10-20 19:19:47 +02:00
test-opencode-upgrade-native.mjs fix(opencode): share host plugin runtime and require 2.0.27 (#920) 2026-10-12 16:42:07 +02:00
test-output-limit-native.mjs chore(opencode): qualify runtime 2.0.29 and align client/plugin pins (#948) 2026-10-14 15:06:35 +02:00
test-panel-extension-native.mjs feat(extensions): add bounded current-session assets for API 2 panels (#874) 2026-10-07 22:54:06 +02:00
test-pending-snapshot-native.mjs fix(pending): stop cold-worktree recovery fallback; qualify OpenCode 2.0.24 (#865) 2026-10-06 23:06:50 +02:00
test-permission-receipts-native.mjs chore(opencode): qualify 2.1.0 and adopt its native contracts (#1029) 2026-10-20 16:46:38 +02:00
test-plugin-packages-native.mjs feat(plugins): native package check and update (6/8) (#794) 2026-10-15 02:54:19 +02:00
test-plugin-runtime-native.mjs fix(opencode): share host plugin runtime and require 2.0.27 (#920) 2026-10-12 16:42:07 +02:00
test-promise-tool-failure-native.mjs chore(opencode): qualify runtime 2.0.29 and align client/plugin pins (#948) 2026-10-14 15:06:35 +02:00
test-prompt-skills-native.mjs feat(composer): native skill attachments (3/8) (#791) 2026-10-02 13:23:42 +02:00
test-provider-account-selection-native.mjs feat(accounts): native account controls and opt-in Codex quota selection (#793) 2026-10-02 17:36:23 +02:00
test-provider-accounts-native.mjs feat(accounts): native account controls and opt-in Codex quota selection (#793) 2026-10-02 17:36:23 +02:00
test-provider-usage-native.mjs fix(usage): use selected native V2 Codex credentials (#811) 2026-09-30 17:29:13 +02:00
test-recurring-simple-native.mjs feat(missions): native project coordination, briefings and tracking (#866) 2026-10-11 14:55:49 +02:00
test-release-workspace-version.mjs chore(release): prepare CodeNomad 1.0.0 versions (#1045) 2026-10-20 20:36:44 +02:00
test-render-cost-audit.mjs fix: reduce compaction and cross-session responsiveness stalls 2026-10-02 00:40:45 +02:00
test-service-usage-native.mjs fix(stats): restore cached totals and refresh only while visible (#1041) 2026-10-20 19:49:45 +02:00
test-session-aside-native.mjs feat(chat): add native /btw side questions 2026-09-21 17:23:11 +02:00
test-session-environment-native.mjs feat(missions): native project coordination, briefings and tracking (#866) 2026-10-11 14:55:49 +02:00
test-session-fork-native.mjs chore(opencode): retire adaptations for runtimes and events OpenCode V2 no longer produces (#1034) 2026-10-20 19:19:47 +02:00
test-session-history-native.mjs feat(extensions): add bounded current-session assets for API 2 panels (#874) 2026-10-07 22:54:06 +02:00
test-session-interrupt-native.mjs fix(sessions): keep Stop and double Escape from restarting the parent (#770) 2026-09-24 21:54:09 +02:00
test-session-lifecycle-native.mjs fix(sessions): wire finish, retry and usage signals to OpenCode V2 events (#1033) 2026-10-20 15:51:48 +02:00
test-session-navigation-native.mjs fix(timeline): mirror every transcript block in order and keep clicks on the clicked marker (#1086) 2026-10-22 05:32:43 +02:00
test-session-pruning-native.mjs test(pruning): align native UI journey with token grouping (#1040) 2026-10-20 19:37:16 +02:00
test-session-pruning-ui.mjs test(pruning): expect response usage to keep tool steps in one group (#1074) 2026-10-21 12:40:03 +02:00
test-subagent-depth-settings-native.mjs feat(missions): native project coordination, briefings and tracking (#866) 2026-10-11 14:55:49 +02:00
test-tauri-f6.ps1 test(tauri): fence F6 fixture profiles and post-input liveness 2026-10-08 00:24:06 +02:00
test-tauri-input-deadlock.mjs fix(tauri): prevent Windows input reentrancy deadlocks (#773) 2026-09-24 21:02:20 +02:00
test-tauri-macos-window-result.test.mjs fix(tauri): prevent macOS startup window event feedback (#821) 2026-10-01 14:58:32 +02:00
test-tauri-macos-window.mjs fix(tauri): prevent macOS startup window event feedback (#821) 2026-10-01 14:58:32 +02:00
test-tauri-runner-refcount.mjs ci: compare repacked deb hardlinks by type and accept callback faults in the Tauri negative control (#1083) 2026-10-21 16:44:23 +02:00
test-tauri-view-menu.mjs feat(timeline): follow Message content tool visibility (#1049) 2026-10-20 23:11:08 +02:00
test-temporary-workspaces-native.mjs feat: temporary instances that are kept or discarded when closed (#899) 2026-10-09 20:59:13 +02:00
test-websearch-settings-native.mjs feat(settings): scoped web search configuration (4/8) (#792) 2026-10-02 14:49:18 +02:00
test-worktree-families-native.mjs chore(opencode): retire adaptations for runtimes and events OpenCode V2 no longer produces (#1034) 2026-10-20 19:19:47 +02:00
verify-bundled-node.cjs build: bundle node runtime for desktop packages 2026-05-04 20:08:04 +01:00