Skip to content

OPE-82 / OPE-88 / OPE-92: Stream deltas, TextMate highlighting, structure-first code blocks - #80

Merged
ivanfenenko merged 26 commits into
mainfrom
feature/ope-92-structure-first-code-blocks
Jul 31, 2026
Merged

ivanfenenko merged 26 commits into
mainfrom
feature/ope-92-structure-first-code-blocks

Conversation

@ivanfenenko

@ivanfenenko ivanfenenko commented Jul 31, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Combines the previous stacked PRs (#78, #79, #80) into one PR targeting main.

  • OPE-82: Wire SSE message.part.delta into Android and iOS MessageSync so assistant text streams live during replies; harden the assistant message pipeline and Session Chat streaming UI.
  • OPE-88: TextMate highlighting through Phase 3 scheduling/backpressure (plus Phases 1–2 foundation).
  • OPE-92: Structure-first code blocks — format markdown first, apply TextMate colors later — plus Phases 4–6, OnigScanner search cut, language toggles, and Session Chat keyboard/composer fixes.

Docs

  • docs/features/message-store/
  • docs/features/session-chat/
  • docs/features/message-repository/
  • docs/features/foreground-event-stream/

Linear

Supersedes

Test plan

  • Android unit tests for delta streaming, display pipeline, timeline projection, TextMate phases
  • iOS unit tests for MessageSync, display pipeline, TextMate admit/span upgrades, keyboard/composer
  • Manual: stream a long reply and confirm live text + deferred highlighting
  • Manual: open a large history and confirm scroll/composer/keyboard behavior

ivanfenenko and others added 24 commits July 26, 2026 21:03
Apply incremental SSE text deltas on both platforms, coalesce display
publishes at a flat cadence, and skip heavy markdown while large
replies are still streaming.

Co-authored-by: Cursor <[email protected]>
… pill

Paint session history before TextMate enrich so opens stay responsive, and show
the Android scroll-to-end pill as soon as the bottom anchor leaves the viewport.

Co-authored-by: Cursor <[email protected]>
Cache prepared markdown across leave/reopen and avoid MainActor stalls from
layoutIfNeeded and per-row enrich publishes so big histories open and scroll
like Android without reprinting messages.

Co-authored-by: Cursor <[email protected]>
Ship generation-gated prep modes, two-batch enrichment, bounded event staging
and iOS warm cache on both platforms, with verification and docs closeout.

Co-authored-by: Cursor <[email protected]>
Ship dual-lane plain-first decoration, stable block IDs, TimelineFrame
projection, and declared-ID hosts on both platforms; close the hardening
plan with soak docs and lock Phase 7b as coverage-only follow-up (OPE-86/87).

Co-authored-by: Cursor <[email protected]>
Separate content vs layout timeline applies, coalesce Android scroll-time updates, reuse unchanged rows, and pin iOS lists with absolute bottom offset plus unanimated self-sizing so opens and scroll-to-end land cleanly.

Co-authored-by: Cursor <[email protected]>
Default TextMate off behind a Settings toggle, fix Final upgrade after streaming placeholders, and close ```markdown fences on the first bare fence like CommonMark/web.

Co-authored-by: Cursor <[email protected]>
Adopt ConnectionEpoch on reconnect so MessageSync does not latch Recovering, and debounce Android SSE stop across photo/document pickers.

Co-authored-by: Cursor <[email protected]>
Keep plain/fallback publication responsive by moving priority, coalescing,
deadlines, trim, and queue metrics into a shared scheduler driven by each
platform owner.

Co-authored-by: Cursor <[email protected]>
Compile immutable grammar/rule programs, reuse prepared UTF-8 line buffers,
and coordinate weighted lease-safe grammar/rule/regex caches so Phase 5 can
add incremental unchanged-prefix reuse on a stable hot path.

Co-authored-by: Cursor <[email protected]>
Reuse unchanged-prefix line checkpoints with one-line backup and suffix
convergence so streaming revisions avoid full reparse while remaining equal
to full-reparse semantic spans.

Co-authored-by: Cursor <[email protected]>
Default TextMate on behind the top-ten language allowlist, wire memory and
thermal pressure into the engine, and record provisional host calibration so
Phases 1–6 can close without blocking on physical Tier B hardware.

Co-authored-by: Cursor <[email protected]>
Let Developer Tools opt out of promoted languages or force-enable packaged
ones, and show Fast/OK/Slow plus chars/ms throughput in the logbook. Top bar
titles use theme tokens so they stay readable in dark mode.

Co-authored-by: Cursor <[email protected]>
Gate per-search metrics by default, short-circuit earliest rule matches, reuse
Joni matchers, and scan with a two-pass findEarliest path for physical latency work.

Co-authored-by: Cursor <[email protected]>
Publish structured code-block chrome for streaming and history without leaving
raw markdown on screen; TextMate upgrades spans asynchronously. Fix commonMain
@volatile so the iOS KMP framework builds.

Co-authored-by: Cursor <[email protected]>
Tolerate Swift-omitted nil language in HighlightRequest decode so admit cannot
abort the process, and bump renderTreeVersion on attach so timeline equality
notices colored documents after format-first scaffolds.

Co-authored-by: Cursor <[email protected]>
Own keyboard overlap padding in Session Chat so the UIKit timeline host and
UITextView composer do not leave the input under the software keyboard.

Co-authored-by: Cursor <[email protected]>
Resign the composer first responder on drag because it sits outside the
UICollectionView host, where keyboardDismissMode alone is not enough.

Co-authored-by: Cursor <[email protected]>
@linear-code

linear-code Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
OPE-92 Structure-first code blocks while streaming

Streaming assistant replies briefly show raw markdown (literal fences) until decoration finishes, then jump into real code-block chrome. Publish a structure-only MarkdownDocument on the text-lane coalesce so fences render as monospace code blocks immediately; semantic/TextMate colors upgrade in place afterward.

Remaining:

  • ☑ Shared OpenCodeStructureOnlyHighlighter (empty spans, block structure only)
  • ☑ Android: attach structure-only doc in streaming plain publish; keep decoration for semantic upgrade
  • ☑ iOS parity for the same dual-lane behavior
  • ☑ Characterization tests: structured first paint without delaying text lane when highlighter is blocked
  • ☑ Docs under docs/features/native-rendered-markdown/
  • ☐ Device smoke: streaming fenced JS reply shows chrome before colors
  • ☐ PR

OPE-82 Stream assistant text from message.part.delta

OPE-82: Wire SSE message.part.delta into Android + iOS MessageSync so Session Chat streams assistant text live.

Remaining:

  • ☑ Handle message.part.delta in Android + iOS MessageSync (session filter, field=text, append via store)
  • ☑ Extend InMemoryMessageStore / MessagePatch with PartDelta (delta-by-partID without full part payload)
  • ☑ Mark streaming text with isStreaming: true; clear on final message.part.updated / REST reload
  • ☑ Add message.part.delta to event recognition (OpencodeEvent message-refresh sets)
  • ☑ Replace tests that put delta on message.part.updated with real message.part.delta fixtures; cover append + UI isStreaming
  • ☑ Update docs: docs/features/message-store/, docs/features/message-repository/parity-gaps.md

Acceptance

  • While an assistant reply is in progress, Session Chat text grows incrementally on iOS and Android (not only after completion).
  • Final part update / idle still leaves a non-streaming complete message.
  • Missing part / wrong session / non-text field deltas are ignored safely.

Docs

  • docs/features/message-store/
  • docs/features/message-repository/
  • docs/features/foreground-event-stream/

Branch

fix/ope-82-message-part-delta

OPE-88 TextMate Phase 3 scheduling and backpressure

Add TextMate engine priority scheduling, latest-wins coalescing, work limits, deadlines, trim handling, and queue/cancellation metrics so plain publication cannot stall behind a blocked highlighter.

Remaining:

  • ☑ Shared scheduler policy with injectable clock
  • ☑ Platform adapters drive one active job; Phase 3 trim wired
  • ☑ Queue/cancellation metrics on observations
  • ☑ Pathological/blocked highlighter plain-publication gate tests
  • ☑ iOS simulator TextMate tests against the scheduler bridge

Docs: docs/features/native-rendered-markdown/
Plan: docs/features/native-rendered-markdown/textmate-pipeline-improvement-plan.md Phase 3
Triage: Phase 3 decisions locked 2026-07-29
Branch: feature/ope-88-textmate-phase-3-scheduling

Review in Linear

@ivanfenenko
ivanfenenko changed the base branch from feature/ope-88-textmate-phase-3-scheduling to main July 31, 2026 07:55
@ivanfenenko ivanfenenko changed the title Feature/ope 92 structure first code blocks OPE-82 / OPE-88 / OPE-92: Stream deltas, TextMate highlighting, structure-first code blocks Jul 31, 2026
@blacksmith-sh

This comment has been minimized.

ivanfenenko and others added 2 commits July 31, 2026 11:03
Force-enable unpromoted languages in TextMate coverage suites, restore iOS
empty-parts timeline fallback, and align structure-first / logbook expectations.

Co-authored-by: Cursor <[email protected]>
…n targets

Structure-first frames were clearing awaitingTextMateUpgrade on sibling rows,
and Android decoration targeting ignored tool-boundary runs. Sync docs for
Phase 6 default-on format-always.

Co-authored-by: Cursor <[email protected]>
@ivanfenenko
ivanfenenko merged commit 6d0bcbd into main Jul 31, 2026
3 checks passed
@ivanfenenko
ivanfenenko deleted the feature/ope-92-structure-first-code-blocks branch July 31, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant