fix(web): stop question answers from resetting the editor caret#11337

merged5
main
fix/web-question-answer-caret
openedSep 11, 2026bySshivam
View on GitHubTwo-way sync enabledPR last imported 23d ago

Selecting a skill in a pending question answer can leave the picker stuck and trigger Maximum call stack size exceeded. The answer callback reads the old editor snapshot and resets the caret before the new answer has rendered, re-entering Lexical with stale token offsets.

Let the editor retain its selection when reporting an answer change. Picker replacements already schedule their own caret placement. This removes the extra snapshot read and focus reset.

Refs #7805. This fixes the reproduced recursion and caret corruption; it preserves the existing skill picker. The broader request to make question answers plain text remains open. Rebased onto main.

Native Electron verification with two synthetic pending questions: the base leaves $bro unconverted, keeps 12 picker options open, and logs a stack overflow. The fix creates the Bro chip, closes the picker, and reports no errors. Typing/backspace works; Next starts empty, Previous preserves the first answer, and removing the request restores the original draft. No final answer was submitted to a provider. Web typecheck and 36 existing editor/answer tests pass; scoped lint exactly matches 17 base warnings.

Before/after images and video are captured. GitHub asset upload remains pending while its background browser connection is unavailable.

Model: GPT-6. Harness: Codex.

Rebased on main 20363c32c9bfdbf49c2716ef11d1f18483fcc01b. Scoped validation rerun after rebasing; existing native and human review limits remain.

Real-app testing (Oct 13, 2026)

Tested in the web app against a dev server on this branch and on main. Claude asked a real question with AskUserQuestion, and I answered it by typing $bro and picking the skill from the picker.

Main: no chip, and typing x lands mid-word ($bxro)This PR: the skill becomes a chip and typing continues after it
Main: clicking the Bro option also leaves plain textThis PR: clicking the Bro option creates the chip

Regular composer on this PR still works with a skill chip and an @-mention together:

Not reproduced: the "Maximum call stack size exceeded" error on main. Not tested: Next/Previous between several questions (each test question was single). A React flushSync warning shows when picking a skill, on main and on this PR, in both the answer box and the regular composer, so it isn't from this change.

Checks

24 successful Β· 10 skipped
All checks passed
88b2083
Synced from GitHub

Bugbot is paused β€” on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

Synced from GitHub

Approvability

Verdict: Approved at 1728ebb

Macroscope's review found this PR approvable β€” This is a focused, single-file fix that removes stale caret restoration during pending-question answer updates while preserving existing answer state handling and explicit replacement behavior. The runtime impact is narrow and readily accounted for, with no schema, deployment, security, billing, or configuration changes.

Notes:

  • Diff unchanged. Approvability was decided on eligibility alone.

No code changes detected at 88b2083. Prior analysis still applies.

You can add or adjust custom eligibility rules. Learn more.

Synced from GitHub

Thread transfer impact

βœ… Thread transfer remains within every enforced ceiling.

ProviderMetricMain baselineThis PRImpactPR ceiling
CodexTotal thread wire5.0 KiB4.9 KiBβˆ’23 B (βˆ’0.5%)6.8 KiBβœ…
CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiBβœ…
CodexLive turn WebSocket wire1.2 KiB1.2 KiBβˆ’23 B (βˆ’1.9%)2.0 KiBβœ…
CodexLive turn WebSocket decoded20.9 KiB20.8 KiBβˆ’41 B (βˆ’0.2%)29.3 KiBβœ…
CodexLive turn messages21βˆ’1 (βˆ’50.0%)8βœ…
ClaudeTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiBβœ…
ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiBβœ…
ClaudeLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiBβœ…
ClaudeLive turn WebSocket decoded21.2 KiB21.2 KiB0 B (0.0%)29.3 KiBβœ…
ClaudeLive turn messages220 (0.0%)8βœ…

Baseline: 85272ee Β· PR result: 88b2083 Β· Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

Synced from GitHub

Bugbot is paused β€” on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

Synced from GitHub

Review in Change Stack β†’

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▢️ Resume reviews
  • πŸ” Trigger review

No actionable comments were generated in the recent review. πŸŽ‰

ℹ️ Recent review info
βš™οΈ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c7173bc3-17dd-4c18-a538-7b9cc53bbf8c
πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between c5f06b451fe3836594375fc059560cf84cf200e2 and cac90ee06c587c438aad8b70e6edb866c9a8c5a1.

πŸ“’ Files selected for processing: 1
  • apps/web/src/components/ChatView.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

πŸ“ Walkthrough

The pending custom-answer callback now accepts the question ID and answer value. It no longer compares composer snapshots or restores focus at cursor offsets.

Changes: Composer Selection Ownership

Layer / File(s)Summary
Simplify custom-answer callback
apps/web/src/components/ChatView.tsx
The callback no longer receives cursor metadata or restores composer focus. Selection management is left to the editor.

Priority: βž– Normal

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Suggested reviewers: matthewferoz

Merge Risk: βšͺ Minimal Β· up to cac90

Pending-answer edits retain selection through the editor’s cursor state, and no concrete user-facing regression is established. The change appears ready for normal checks.

Pre-merge checks: Passed 4
Passed Passed checks: 4 passed
Check nameStatusExplanation
Title checkPassedThe title clearly and concisely describes the primary change: preventing question answers from resetting the editor caret.
Description checkPassedThe description covers the problem, change, scope reference, verification results, limitations, and UI evidence. It reports the relevant tests, real-app checks, known warning, and untested multi-quest…
Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches
πŸ“ Generate docstrings
  • Create stacked PR
  • Commit on current branch
πŸ§ͺ Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

Added 1 commit

  • fix(web): stop question answers from resetting the editor caret1728ebb

Added 4 commits

  • Merge branch 'main' into fix/web-question-answer-caretdd34435
  • Merge branch 'main' into fix/web-question-answer-caretc5f06b4
  • Merge branch 'main' into fix/web-question-answer-caretcac90ee
  • Merge branch 'main' into fix/web-question-answer-caret88b2083