Skip to content

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

Merged
Yash-Singh1 merged 1 commit into
pingdotgg:mainfrom
extoci:t3code/fix-citation-cancel-behavior
Sep 7, 2026
Merged

fix(web): remove inserted citations on cancel#10518
Yash-Singh1 merged 1 commit into
pingdotgg:mainfrom
extoci:t3code/fix-citation-cancel-behavior

Conversation

@extoci

@extoci extoci commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Sep 7, 2026
@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

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 8b2838e and 843cebe.

📒 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 name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring 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 name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: removing citations inserted by the cite prompt when the prompt is canceled.
Description check ✅ Passed The 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 ✅ 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.
  • 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.

@macroscopeapp

macroscopeapp Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

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.

@Yash-Singh1
Yash-Singh1 merged commit fe07ffe into pingdotgg:main Sep 7, 2026
22 checks passed
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Sep 7, 2026
## What's Changed
* feat(web): group onboarding project import by repository by @t3dotgg in pingdotgg/t3code#10493
* fix(web): remove inserted citations on cancel by @extoci in pingdotgg/t3code#10518
* fix(mobile): match Working status color to desktop by @baptisteArno in pingdotgg/t3code#10515

## New Contributors
* @baptisteArno made their first contribution in pingdotgg/t3code#10515

**Full Changelog**: pingdotgg/t3code@v0.0.40-nightly.20260907.1346...v0.0.40-nightly.20260907.1359

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.40-nightly.20260907.1359
raman325 added a commit to raman325/t3code that referenced this pull request Sep 7, 2026
* origin/main: (675 commits)
  fix(web): tolerate servers that predate git identity in project import (pingdotgg#10547)
  chore(mobile): bump app version to 1.1.0
  fix(mobile): wait for native thread scroll before reveal (pingdotgg#10486)
  fix(mobile): match Working status color to desktop
  fix(web): remove inserted citations on cancel (pingdotgg#10518)
  feat(web): group onboarding project import by repository (pingdotgg#10493)
  fix(mobile): preserve chat rows when toggling commands (pingdotgg#10492)
  fix(mobile): restore assistant message bottom padding (pingdotgg#10491)
  fix(mobile): animate thread lifecycle transitions consistently (pingdotgg#10487)
  fix(mobile): release initial scroll target after dragging (pingdotgg#10483)
  fix(mobile): smooth composer status pill resizing (pingdotgg#10484)
  fix(mobile): prevent chat from disappearing when scrolling (pingdotgg#10479)
  fix(web): resize the floating preview from any edge (pingdotgg#10467)
  fix(web): keep composer toolbar controls anchored during transitions (pingdotgg#10478)
  fix(mobile): improve font-size slider performance and prevent maximum update depth errors (pingdotgg#7138)
  feat(mobile): start a new thread on an existing branch (pingdotgg#10359)
  fix(ios): scroll short source files from blank space (pingdotgg#10178)
  fix(mobile): hide changed-files navigator and restore refresh in raw diff fallback (pingdotgg#9828)
  fix(projects): prevent invalid script IDs from crashing threads (pingdotgg#10019)
  fix(devcontainer): make repository setup work (pingdotgg#7875)
  ...

# Conflicts:
#	apps/server/src/provider/builtInDrivers.ts
#	docs/README.md
#	docs/user/install.md
#	packages/contracts/src/settings.test.ts
#	packages/contracts/src/settings.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants