Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): remove inserted citations on cancel #10518

Mergedextoci(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/10518/headmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

Canceling the cite prompt currently leaves the citation chip that the prompt inserted in the composer.

Mark citation targets created by the cite prompt for removal on cancel. Existing citation edits still close normally, while canceling a fresh citation removes it and returns focus to the composer.

Validation: 29 focused composer tests pass, web typecheck passes, targeted lint and formatting pass. Browser verification has not been run.

Model: GPT-5.6 Sol. Harness: Codex.

Note

Remove inserted citations when comment is cancelled in ComposerCitationDecorator

Adds an optional removeOnCancel flag to the ComposerCitationCommentTarget type so controlled citation comment requests can signal that their matched citation node should be deleted on cancel. ComposerCitationNode.tsx now passes the citation removal handler as the comment editor's cancel callback when that flag is set. AssistantCitationChip.tsx adds an optional onCancel callback to the comment editor; callers without the callback keep the existing close-only behavior.

Macroscope summarized 843cebe.

Summary by CodeRabbit

  • Bug Fixes
    • Canceling a newly inserted citation now removes it from the composer.
    • Citation cancellation consistently closes the citation editor when no removal action is needed.
  • Improvements
    • Citation comment targets support configurable behavior when cancellation occurs.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. Review Change Stack

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration

      Configuration used: Path: .coderabbit.yaml

      Review profile: CHILL

      Plan: Team

      Run ID: 100f0e72-e5d5-4bc8-ba25-627617d175bb

      📥 Commits

      Reviewing files that changed from the base of the PR and between 8b2838e0e8a73d3fa6476940445c372e47b99db4 and 843cebe1717fe4fadcedac749ac0db81d3eec43d.

      📒 Files selected for processing (2)
      • apps/web/src/components/ComposerCitationNode.tsx
      • apps/web/src/components/chat/AssistantCitationChip.tsx

      Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


      📝 Walkthrough

      Walkthrough

      Citation comment targets now track whether cancellation should remove inserted citations. The citation chip receives a shared target and invokes removal when required, while preserving popover closure as the default behavior.

      Changes

      Citation cancellation

      Layer / File(s)Summary
      Propagate citation cancellation state
      apps/web/src/components/ComposerCitationNode.tsx
      Citation targets gain removeOnCancel. Consumed citation requests set this state, and the decorator reuses one derived comment target for chip state, source anchoring, and cancellation handling.
      Handle citation cancellation
      apps/web/src/components/chat/AssistantCitationChip.tsx
      The comment editor accepts an optional onCancel callback. It invokes the callback when present and otherwise closes the popover.

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Merge Risk: ⚪ Minimal · up to 843ce

      Canceling a newly inserted citation now removes it and returns focus to the composer, while canceling edits to existing citations continues to close normally. No concrete merge-blocking risk remains.

      Suggested reviewers: juliusmarminge

      🚥 Pre-merge checks | ✅ 4 | ❌ 1

      ❌ Failed checks (1 warning)

      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files.Write docstrings for the functions missing them to satisfy the coverage threshold.
      ✅ Passed checks (4 passed)
      Check nameStatusExplanation
      Title check✅ PassedThe title clearly and concisely describes the main change: removing citations inserted by the cite prompt when the prompt is canceled.
      Description check✅ PassedThe description clearly explains what changed, why it changed, expected behavior, and validation results. It omits the template headings, checklist, and UI evidence, but the core information is comple…
      Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
      • Fix all pre-merge checks with AI
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests

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

      Verdict: Approved at 843cebe

      Macroscope's review found this PR approvable — This is a focused web bug fix that removes only citations newly inserted by the cite prompt when their comment editor is cancelled, while preserving normal cancellation for existing citations. The implementation is small, localized, and reuses the composer’s existing removal behavior without changing defaults, schemas, or sensitive infrastructure.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Yash-Singh1(GitHub profile, opens in a new tab) approved these changes

Sign in to join this conversation.