Skip to content

fix: address review of Tencent/WeKnora#2514 RAG answer wait status - #43

Draft
lyingbug wants to merge 2 commits into
cursor/rag-answer-wait-base-7a42from
cursor/rag-answer-wait-followup-7a42
Draft

fix: address review of Tencent/WeKnora#2514 RAG answer wait status#43
lyingbug wants to merge 2 commits into
cursor/rag-answer-wait-base-7a42from
cursor/rag-answer-wait-followup-7a42

Conversation

@lyingbug

@lyingbug lyingbug commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Description

Follow-up commits for the code review of Tencent/WeKnora#2514.

cursor[bot] has no push access to the PR head branch (ttommybot:fix/rag-answer-wait-statusmaintainerCanModify is a permission granted to maintainer accounts, not to this app installation), so these commits sit on a branch based on the PR head (dc17ffd4). The base of this PR is that same PR head, so the diff shown here is only the follow-up. Ready-to-apply patches are attached to the agent run as 0001-*.patch / 0002-*.patch (git am).

fix(frontend): cover attachment-only turns and stalled streams in the RAG wait row

  • The wait row required a completed knowledge_search step, so attachment-only turns (attachment_parsing / image_analysis with no KB hit — a case rag-pipeline-history.ts explicitly documents) still showed nothing between the last step and the first answer token. Waiting is now a three-state kind: model once retrieval finished, the neutral preparing row otherwise.
  • A dropped SSE connection never sets is_completed (streame.ts onerror only raises a toast), so the row promised an answer forever. It now stops claiming progress after RAG_WAIT_STALL_DELAY_MS and drops the shimmer.
  • Shares RAG_RETRIEVAL_TOOL_NAMES instead of repeating the knowledge_search / search_knowledge alias check, which was dead in the timeline context because RAG_TIMELINE_TOOL_NAMES never contains the alias.
  • Names the reveal delay instead of an inline 250, and renames the near-identical showModelAnswerWait / shouldShowModelAnswerWait pair.
  • Moves the reveal and stall timers into a controller with an injectable scheduler, so the timing is covered by real tests instead of source-string matching.

fix(frontend): announce RAG wait status from a persistent live region

role="status" lived on the wait row itself, so the live region was inserted together with its own text and screen readers had nothing to announce. The announcement now lives in an sr-only region that stays mounted for the whole turn, which also covers the pre-pipeline wait row that had no announcement at all.

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 📚 Documentation update
  • 🎨 Refactor
  • ⚡ Performance improvement
  • 🧪 Test
  • 🔧 Configuration / Build / CI

Related Issue

Follow-up to Tencent#2514.

Testing

  • npm test in frontend/: 307 passed, 0 failed (7 new, covering the three wait kinds plus debounce, in-place label swap, per-phase stall budget, and timer disposal against a fake clock).
  • npm run type-check: clean.
  • npm run build: clean.
  • git diff --check: clean.
  • Rendered the component in a throwaway Vite harness (not committed) driving five sessions, verified in Chrome.

Checklist

  • git diff --check origin/main...HEAD passes
  • Changed source files are formatted
  • Targeted tests for the changed packages/components pass
  • Diff-scoped lint passes where applicable (for Go: golangci-lint run --new-from-rev=origin/main ./...) — frontend-only change
  • Full-repository checks were run, or any unrelated/environment-dependent failures are documented above
  • Self-reviewed the code
  • Added/updated tests covering the change
  • Updated related documentation (README, docs/, Swagger annotations, etc.)
  • Breaking changes are clearly called out in the description above

Screenshots / Recordings

Wait rows immediately after retrieval completes. Panel 2 (retrieval still running) and panel 5 (answer streaming) correctly show no wait row; panel 4 is the attachment-only turn that previously showed nothing.

RAG wait rows right after retrieval completes

Same page 83 seconds in, with no answer ever arriving: panels 3 and 4 stop claiming progress and switch to the neutral stalled message.

RAG wait rows after the stall timeout

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

lyingbug and others added 2 commits August 4, 2026 04:34
… RAG wait row

The wait row only appeared once a completed knowledge_search step existed, so
attachment-only turns (attachment_parsing / image_analysis with no KB hit) still
showed nothing between the last step and the first answer token. Model waiting is
now a three-state kind: 'model' after retrieval finished, the neutral 'preparing'
row otherwise.

A dropped SSE connection never sets is_completed (the stream layer only raises a
toast), so the row used to promise an answer forever. It now stops claiming
progress after RAG_WAIT_STALL_DELAY_MS and drops the shimmer.

Also share RAG_RETRIEVAL_TOOL_NAMES instead of repeating the knowledge_search /
search_knowledge alias check, name the reveal delay, and move the reveal/stall
timers into a controller with an injectable scheduler so the timing is covered by
tests instead of by source-matching alone.

Co-authored-by: lyingbug <lyingbug@users.noreply.github.com>
role="status" lived on the wait row itself, so the live region was inserted
together with its own text and screen readers had nothing to announce. Move the
announcement to an sr-only region that stays mounted for the whole turn, which
also covers the pre-pipeline wait row that had no announcement at all.

Co-authored-by: lyingbug <lyingbug@users.noreply.github.com>
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