Skip to content

Harden web transcript streaming and brain responsiveness#896

Merged
arul28 merged 2 commits into
mainfrom
ade/start-skill-heres-what-happened-0bd4b38e
Jul 24, 2026
Merged

Harden web transcript streaming and brain responsiveness#896
arul28 merged 2 commits into
mainfrom
ade/start-skill-heres-what-happened-0bd4b38e

Conversation

@arul28

@arul28 arul28 commented Jul 24, 2026

Copy link
Copy Markdown
Owner

ADE   Open in ADE  ·  ade/start-skill-heres-what-happened-0bd4b38e branch  ·  PR #896

Summary by CodeRabbit

  • New Features

    • Added reliable transcript paging with bounded byte-based cursors across desktop, web, and iOS.
    • Added automatic loading of older chat history, “Jump to latest,” and retry controls for temporary failures.
    • Added support for compressed chat transcripts and improved transcript caching.
  • Bug Fixes

    • Prevented chat updates from being lost or duplicated during subscription refreshes.
    • Preserved the current project and GitHub status when reconnect refreshes fail.
    • Improved responsiveness by making credential, GitHub, and transcript operations non-blocking.

Greptile Summary

This PR adds bounded transcript paging and compressed transcript support across the chat stack. The main changes are:

  • Byte-cursor chat history pages for desktop, web, sync, iOS, and headless flows.
  • Smaller initial web chat snapshots with older-history loading and retry controls.
  • Transparent compressed-history reads with bounded gzip inflation and caching.
  • Async credential, GitHub status, and transcript operations to avoid blocking refresh paths.
  • Subscription hydration handling to avoid lost or duplicated chat events during reconnects.

Confidence Score: 5/5

This PR appears safe to merge based on the reviewed changed paths.

The changes are broad but include focused tests for race handling, pagination, compression, and UI behavior. No blocking or non-blocking issues were identified.

No files require special attention.

T-Rex T-Rex Logs

What T-Rex did

  • Launched a real UI session with the web client to observe chat paging behavior and baseline state.
  • Captured an initial desktop webclient render before navigating or seeding chat state to document the pre-seed UI.
  • Executed a focused component test for AgentChatMessageList.tsx covering the paging controls: jump-to-latest, automatically backfills, and stops automatic retries; the test run targeted src/renderer/components/chat/AgentChatMessageList.test.tsx with verbose results.
  • Collected and reviewed test-run logs that confirm the three paging-control tests passed in the captured log.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
apps/desktop/src/main/services/storage/historyCompression.ts Implements transparent compressed-history range reads with small memory cache, large temp-file cache, bounds, and inflation admission.
apps/desktop/src/main/services/chat/chatTranscriptHistoryPager.ts Implements bounded byte-offset JSONL transcript paging with stable cursors.
apps/desktop/src/main/services/chat/agentChatService.ts Adds async transcript tail reads and byte-offset older-history pagination for agent chat sessions.
apps/ade-cli/src/services/sync/syncHostService.ts Adds chat subscription hydration barriers, bounded transcript snapshot reads, and compressed transcript support.
apps/ade-cli/src/services/sync/syncRemoteCommandService.ts Registers chat event history page remote commands and routes byte-cursor transcript pagination.
apps/desktop/src/renderer/components/chat/AgentChatPane.tsx Manages transcript paging cursors, older page fetches, retry state, and detached historical windows.
apps/desktop/src/renderer/components/chat/AgentChatMessageList.tsx Adds scroll-triggered older-history loading, prepend anchoring, retry UI, and jump-to-latest behavior.
apps/desktop/src/renderer/webclient/adapter/agentChat.ts Bounds web chat snapshots/pages and manages visible-session subscriptions with event dedupe.
apps/ios/ADE/Services/SyncService.swift Adds iOS sync support for byte-cursor chat history paging and subscription hydration state.

Sequence Diagram

sequenceDiagram
participant UI as Chat UI / Web / iOS
participant Adapter as Renderer or Sync Adapter
participant Host as Sync Remote Command / IPC
participant Chat as AgentChatService
participant Pager as ChatTranscriptHistoryPager
participant Storage as HistoryCompression

UI->>Adapter: Request initial chat history
Adapter->>Host: chat.getChatEventHistory(maxBytes)
Host->>Chat: getChatEventHistory(sessionId)
Chat->>Storage: read bounded transcript tail
Storage-->>Chat: events + tailStartOffset
Chat-->>UI: snapshot with byte cursor

UI->>Adapter: Scroll near top / retry older page
Adapter->>Host: chat.getChatEventHistoryPage(beforeOffset, maxBytes)
Host->>Chat: getChatEventHistoryPage(sessionId, beforeOffset)
Chat->>Pager: readTranscriptHistoryPage(...)
Pager->>Storage: readHistoryFileRange(plain or gzip)
Storage-->>Pager: bounded byte window
Pager-->>Chat: envelopes + startOffset + hasMore
Chat-->>UI: prepend page + next cursor
Loading

Reviews (1): Last reviewed commit: "Fix transcript cache and keychain races" | Re-trigger Greptile

@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
ade Ignored Ignored Preview Jul 24, 2026 11:50am

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR converts credential, GitHub, transcript, compression, synchronization, and chat UI operations to bounded asynchronous flows. It adds cancellation propagation, byte-based pagination and caching, hydration barriers, reconnect-safe GitHub refreshes, retryable history loading, and iOS cursor-mode support.

Changes

Async storage and GitHub services

Layer / File(s) Summary
Async credential and GitHub operations
apps/ade-cli/src/headlessLinearServices.ts, apps/ade-cli/src/services/credentials/*, apps/ade-cli/src/bootstrap.ts
Credential, token, GitHub status, and headless Git operations use async APIs with deduplication and generation-safe cache updates.
Bounded history storage
apps/desktop/src/main/services/storage/historyCompression.ts, apps/desktop/src/main/services/chat/chatTranscriptHistoryPager.ts
Plain and gzip history support bounded range reads, caching, serialized inflation, cancellation, and async reinflation.

Async chat history and synchronization

Layer / File(s) Summary
Agent chat transcript service
apps/desktop/src/main/services/chat/agentChatService.ts
Transcript persistence, history reads, subagent hydration, summaries, paging, and exported endpoints become asynchronous and signal-aware.
Sync and remote command propagation
apps/ade-cli/src/services/sync/*, apps/desktop/src/main/services/{adeActions,ipc}/*, apps/ade-cli/src/services/personalChats/*
Abort signals, bounded page arguments, readable compressed paths, and byte cursor metadata are propagated through host and personal-chat APIs.
Hydration barriers and tests
apps/ade-cli/src/services/sync/syncHostService.*, apps/desktop/src/main/services/chat/*test.ts
Chat subscription hydration suppresses concurrent live delivery and restores prior state after failures; tests cover compressed reads, paging, cancellation, and concurrency.

Renderer and iOS transcript flows

Layer / File(s) Summary
Renderer history caps and recovery
apps/desktop/src/renderer/components/chat/*, apps/desktop/src/renderer/index.css
Chat history uses byte-based resident/cache caps, detached-session recovery, top-sentinel loading, retry controls, jump-to-latest callbacks, and scroll anchoring styles.
Reconnect-safe GitHub refresh
apps/desktop/src/renderer/components/app/AppShell.*, apps/desktop/src/renderer/webclient/adapter/*
Transport status emits sync updates without domain GitHub work; AppShell performs delayed, context-checked forced refreshes after reconnects.
iOS cursor handling
apps/ios/ADE/Services/SyncService.swift, apps/ios/ADE/Views/Work/*, apps/ios/ADETests/ADETests.swift
Transcript pages expose cursor kinds, Work merges byte-cursor pages by ordered overlap, persists cursor state, and uses an explicit exhausted sentinel.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

  • arul28/ADE#175 — Related desktop chat history hydration and snapshot handling.
  • arul28/ADE#797 — Related compressed-history and reinflation changes.
  • arul28/ADE#846 — Related web-client transport and GitHub status refresh behavior.

Suggested labels: desktop, ios, docs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes around hardening web transcript streaming and improving responsiveness.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ade/start-skill-heres-what-happened-0bd4b38e

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@arul28
arul28 force-pushed the ade/start-skill-heres-what-happened-0bd4b38e branch from c908b6d to f5d532b Compare July 24, 2026 11:38

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/ade-cli/src/services/credentials/credentialStore.ts (1)

551-625: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Clear the negative cache when the sync writer creates the keychain item.

readOrCreateMacKeychainMaterial() creates the Mac keychain secret synchronously and updates cachedDefaultOsBoundKeyMaterial, but it never resets lastMissingDefaultOsBoundKeyMaterialAt. A concurrent async read that is still in the 30s negative-cache window can still return null, derive the machine-key-only key, and fail to decrypt the OS-bound envelope. Reset the negative-cache timestamp from the sync path, too.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/ade-cli/src/services/credentials/credentialStore.ts` around lines 551 -
625, Update readOrCreateMacKeychainMaterial so that whenever it successfully
creates or obtains the keychain material and updates
cachedDefaultOsBoundKeyMaterial, it also resets
lastMissingDefaultOsBoundKeyMaterialAt to 0. Keep the async read behavior
unchanged.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/ios/ADE/Views/Work/WorkSessionDestinationView.swift`:
- Line 309: Update the cache-hit restoration logic around transcriptCursorKind
so byte-mode restores transcriptEntriesByIndex from the cached fallbackEntries,
not only the presentation list. Apply this consistently at the related cursor
and cache restoration sites, preserving the cached cursor while ensuring
subsequent tail refreshes merge with the full restored scrollback.

---

Outside diff comments:
In `@apps/ade-cli/src/services/credentials/credentialStore.ts`:
- Around line 551-625: Update readOrCreateMacKeychainMaterial so that whenever
it successfully creates or obtains the keychain material and updates
cachedDefaultOsBoundKeyMaterial, it also resets
lastMissingDefaultOsBoundKeyMaterialAt to 0. Keep the async read behavior
unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e1a32fd3-8588-4cba-acd3-24851632d001

📥 Commits

Reviewing files that changed from the base of the PR and between bfe1281 and c908b6d.

⛔ Files ignored due to path filters (5)
  • docs/ARCHITECTURE.md is excluded by !docs/**
  • docs/features/sync-and-multi-device/README.md is excluded by !docs/**
  • docs/features/sync-and-multi-device/ios-companion.md is excluded by !docs/**
  • docs/features/sync-and-multi-device/remote-commands.md is excluded by !docs/**
  • docs/features/web-client/README.md is excluded by !docs/**
📒 Files selected for processing (42)
  • .agents/skills/ade-perf-work/SKILL.md
  • apps/ade-cli/src/bootstrap.ts
  • apps/ade-cli/src/headlessLinearServices.test.ts
  • apps/ade-cli/src/headlessLinearServices.ts
  • apps/ade-cli/src/multiProjectRpcServer.ts
  • apps/ade-cli/src/services/credentials/credentialStore.test.ts
  • apps/ade-cli/src/services/credentials/credentialStore.ts
  • apps/ade-cli/src/services/personalChats/personalChatScope.test.ts
  • apps/ade-cli/src/services/personalChats/personalChatScope.ts
  • apps/ade-cli/src/services/sync/rosterBuilder.test.ts
  • apps/ade-cli/src/services/sync/rosterBuilder.ts
  • apps/ade-cli/src/services/sync/syncHostService.test.ts
  • apps/ade-cli/src/services/sync/syncHostService.ts
  • apps/ade-cli/src/services/sync/syncRemoteCommandService.test.ts
  • apps/ade-cli/src/services/sync/syncRemoteCommandService.ts
  • apps/desktop/src/main/services/adeActions/registry.ts
  • apps/desktop/src/main/services/ai/tools/orchestrationTools.test.ts
  • apps/desktop/src/main/services/chat/agentChatService.test.ts
  • apps/desktop/src/main/services/chat/agentChatService.ts
  • apps/desktop/src/main/services/chat/chatTranscriptHistoryPager.test.ts
  • apps/desktop/src/main/services/chat/chatTranscriptHistoryPager.ts
  • apps/desktop/src/main/services/ipc/registerIpc.ts
  • apps/desktop/src/main/services/pty/ptyService.test.ts
  • apps/desktop/src/main/services/pty/ptyService.ts
  • apps/desktop/src/main/services/storage/historyCompression.test.ts
  • apps/desktop/src/main/services/storage/historyCompression.ts
  • apps/desktop/src/renderer/browserMock.ts
  • apps/desktop/src/renderer/components/app/AppShell.aiStatus.test.tsx
  • apps/desktop/src/renderer/components/app/AppShell.tsx
  • apps/desktop/src/renderer/components/chat/AgentChatMessageList.test.tsx
  • apps/desktop/src/renderer/components/chat/AgentChatMessageList.tsx
  • apps/desktop/src/renderer/components/chat/AgentChatPane.test.tsx
  • apps/desktop/src/renderer/components/chat/AgentChatPane.tsx
  • apps/desktop/src/renderer/index.css
  • apps/desktop/src/renderer/webclient/adapter/__tests__/adapter.test.ts
  • apps/desktop/src/renderer/webclient/adapter/agentChat.ts
  • apps/desktop/src/renderer/webclient/adapter/misc.ts
  • apps/desktop/src/renderer/webclient/adapter/personalChats.ts
  • apps/desktop/src/shared/types/personalChats.ts
  • apps/ios/ADE/Services/SyncService.swift
  • apps/ios/ADE/Views/Work/WorkSessionDestinationView.swift
  • apps/ios/ADETests/ADETests.swift

Comment thread apps/ios/ADE/Views/Work/WorkSessionDestinationView.swift
@arul28 arul28 changed the title web-transcript-brain-crash -> Primary Harden web transcript streaming and brain responsiveness Jul 24, 2026
@arul28
arul28 merged commit 9e689c5 into main Jul 24, 2026
34 checks passed
@arul28
arul28 deleted the ade/start-skill-heres-what-happened-0bd4b38e branch July 24, 2026 22:39
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