Skip to content

fix(chat): show sent attachments immediately and preserve reading position - #4687

Merged
reachjalil merged 1 commit into
devfrom
fix/progressive-thread-reading
Sep 9, 2026
Merged

reachjalil merged 1 commit into
devfrom
fix/progressive-thread-reading

Conversation

@reachjalil

Copy link
Copy Markdown
Member

Summary

Make conversation feedback immediate without discarding readable history or fighting the person's scroll position.

  • Move submitted attachments out of the composer and into one optimistic user message immediately, including image-only sends and new-task handoffs. Preparation continues separately; newer typing and attachments survive failure/cancellation.
  • Keep local previews through message-created/text-only acknowledgements. Correlate native v2 acknowledgements using the exact prepared prompt text, pin the accepted message identity, and reclaim previews only once usable server attachments replace them.
  • Restore saved message anchors only after history is available; never save a temporary empty/clamped position. Cancel stale session callbacks, preserve native anchoring while reading, respect wheel/keyboard/selection dragging, and debounce persistent scroll writes.
  • Keep Markdown text and code readable immediately. Start optional syntax highlighting and diagram rendering near the viewport instead of enhancing every historical message on mount. Re-arm highlighting when a streaming answer becomes a settled document.

Rebased onto dev at 52a028817ec185df72c28d08bc87db90ba7c71a4. This preserves #4681's cached-history reuse and #4683's one-shot reveal of newly submitted messages, including oversized prompts.

Scope

No new virtualizer, smaller history limit, eager history prefetch, upload parallelism, or changes to task execution/admission. Server history pagination, snapshot/status decoupling, and split-pane stream scheduling are deferred rather than bundled into this change.

The v2 adapter still omits user file parts. Its acknowledged message retains the local preview while the app is open; this PR does not claim attachment persistence across a reload on that engine. Pending previews without a complete server replacement remain retained for recovery.

Verification — Incomplete

Candidate: f32d3f71d9819e45d811ca012d6399455cba9ea2.

Passed: 44 focused tests, 0 failures in the final selected invocations, plus app typecheck and whitespace validation.

From apps/app, run these as separate invocations:

bun test --isolate ./tests/session-scroll.test.tsx
# 14 passed, 0 failed
bun test --isolate ./tests/live-step-scroll.test.ts
# 10 passed, 0 failed
bun test --isolate ./tests/composer-focus-continuity.test.tsx
# 1 passed, 0 failed; 170 assertions
bun test --isolate ./tests/markdown-code-block.test.ts ./tests/markdown-mermaid.test.ts
# 19 passed, 0 failed

From the repository root:

pnpm --filter @openwork/app typecheck
git diff --check origin/dev...HEAD

Earlier failed check: combining the DOM component and Markdown tests in one Bun 1.3.4 invocation reported four Markdown wrapper/sanitizer assertions. That runtime does not advertise --isolate; the final invocations keep the DOM fixtures in separate processes. The Markdown-only command passed both here and in a clean base control. The combined failure is not classified as a pre-existing product defect.

Deferred / missing proof: the existing streamed-markdown-answer and attachment-upload-loading-state journeys were extended, but their real-app, exact-head runs and published test evidence have not been produced in this pass. No cloud test resources were provisioned. Focused component tests are not browser-layout or runtime proof; this is not a merge-readiness claim.

Remaining verification commands, with the pushed candidate selected for remote resources:

OPENWORK_EVAL_REF=f32d3f71d9819e45d811ca012d6399455cba9ea2 pnpm evals:e2e streamed-markdown-answer
OPENWORK_EVAL_REF=f32d3f71d9819e45d811ca012d6399455cba9ea2 pnpm evals:e2e attachment-upload-loading-state

Manual acceptance

  1. Scroll into a long conversation, switch away and return, then reload: the retained reading message should stay at the same viewport offset.
  2. While output streams, scroll or drag-select older text: it must not pull the view back down. Sending a new message should still reveal that specific row.
  3. Send an image with upload held or slow: one preview appears in the thread, the composer clears, and typing a new draft is not erased when preparation finishes or fails.
  4. Scroll toward older code and diagrams: readable source remains available, and optional formatting appears as it approaches the viewport.

@vercel

vercel Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
openwork-app Ready Ready Preview Sep 9, 2026 6:07pm UTC
openwork-den Ready Ready Preview Sep 9, 2026 6:07pm UTC
openwork-diagnostics Ready Ready Preview Sep 9, 2026 6:07pm UTC
openwork-landing Ready Ready Preview, v0 Sep 9, 2026 6:07pm UTC

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Passed · 1/1 tests · 2/2 assertions · 0 images

Commit f32d3f71d9819e45d811ca012d6399455cba9ea2 · selected evidence

Open review report

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (f32d3f71d9819e45d811ca012d6399455cba9ea2). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

This branch was successfully deployed

4 active deployments
Preview – openwork-landing — f32d3f71 Deployed Sep 9, 2026 by vercel[bot]
Preview – openwork-app — f32d3f71 Deployed Sep 9, 2026 by vercel[bot]
Preview – openwork-den — f32d3f71 Deployed Sep 9, 2026 by vercel[bot]
Preview – openwork-diagnostics — f32d3f71 Deployed Sep 9, 2026 by vercel[bot]
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