Skip to content

Port fuzzy search, display settings, and copilot abort fix#10

Merged
aaditagrawal merged 3 commits intomainfrom
feat/zortos-ports
Mar 12, 2026
Merged

Port fuzzy search, display settings, and copilot abort fix#10
aaditagrawal merged 3 commits intomainfrom
feat/zortos-ports

Conversation

@aaditagrawal
Copy link
Copy Markdown
Owner

@aaditagrawal aaditagrawal commented Mar 12, 2026

Summary

  • Fuzzy workspace search: Adds subsequence matching to file search with penalty-scored ranking (first-match position, gaps, span width, string length). Uses ranked binary-search insertion for efficient top-N without sorting the full index.
  • Display settings: Two new toggles (showCommandOutput, showFileChangeDiffs) in Settings > Display to reduce visual clutter. Gates command output in the chat timeline and diff rendering in the side panel.
  • Copilot abort fix: Handles turn.aborted events in ProviderRuntimeIngestion so sessions transition to interrupted status instead of getting stuck in running with a stale activeTurnId. Finalizes buffered assistant messages and cleans up accumulated usage on abort.

Ported from zortos293/t3code-copilot PRs #15, #18, #16 — adapted to our multi-provider architecture.

Test plan

  • Type cmp in the @-mention file picker and verify Composer.tsx / composePrompt.ts appear via fuzzy match
  • Toggle "Show command output" off in Settings and verify command text/detail is hidden in the chat timeline
  • Toggle "Show file change diffs" off in Settings and verify the diff panel shows the placeholder message
  • Start a Copilot turn, click stop, and verify the session transitions to interrupted (not stuck on running)
  • Verify existing exact/prefix/contains search ranking still works correctly

Summary by CodeRabbit

  • New Features

    • Added Display settings to toggle visibility of command output and file change diffs in the chat timeline.
  • Improvements

    • Enhanced workspace search with fuzzy subsequence scoring and ranked results for better relevance.
    • Improved runtime handling of aborted turns so aborted events propagate and finalize like completed turns with interrupted status.
  • Bug

    • Display settings section was duplicated in the Settings UI and may appear twice.

- Add fuzzy subsequence matching to workspace file search with ranked
  insertion for efficient top-N retrieval
- Add showCommandOutput and showFileChangeDiffs display settings with
  toggles in the settings page
- Handle turn.aborted in ProviderRuntimeIngestion so Copilot sessions
  don't get stuck in running state after user clicks stop
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bf8f6969-3686-4228-9c4d-c6c32a7657a0

📥 Commits

Reviewing files that changed from the base of the PR and between e9e1a31 and 9c25368.

📒 Files selected for processing (3)
  • apps/server/src/workspaceEntries.ts
  • apps/web/src/appSettings.ts
  • apps/web/src/routes/_chat.settings.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/src/appSettings.ts

📝 Walkthrough

Walkthrough

Adds handling for a new turn.aborted event across provider runtime ingestion, implements fuzzy subsequence ranking for workspace entry search, and exposes two UI settings (showCommandOutput, showFileChangeDiffs) with corresponding chat UI conditional rendering.

Changes

Cohort / File(s) Summary
Provider Runtime Event Handling
apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts
Adds pervasive handling for turn.aborted: included in lifecycle guards, event filtering, nextActiveTurnId logic, status/outcome mapping (interrupted), token-usage accumulation/cleanup, assistant segment & proposed-plan finalization, and timeline propagation.
Search Ranking Enhancement
apps/server/src/workspaceEntries.ts
Introduces fuzzy subsequence scoring (scoreSubsequenceMatch), ranking utilities (compareRankedEntries, findInsertionIndex, insertRankedEntry), and refactors searchWorkspaceEntries to build ranked results for non-empty queries while preserving API signature.
App Settings Schema
apps/web/src/appSettings.ts
Adds two boolean settings to the AppSettings schema: showCommandOutput and showFileChangeDiffs (both default true), updating the derived AppSettings type.
Settings UI (Chat)
apps/web/src/routes/_chat.settings.tsx
Adds a Display section with toggles for the two new settings and a "Restore defaults" control; note: duplicate Display blocks were added (two identical UI blocks).
Settings-Driven UI Rendering
apps/web/src/components/DiffPanel.tsx, apps/web/src/components/chat/MessagesTimeline.tsx
Wires useAppSettings to conditionally render file-diff messages and command output/work entry details based on the new settings.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐇 I nibble through code with a twitchy nose,
An aborted turn where the wild wind blows.
Fuzzy searches hop, results align,
Toggles hide diffs and show command lines.
A rabbit cheers: small changes, big prose!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the three main changes: fuzzy search, display settings, and copilot abort fix, matching the primary features in the PR.
Description check ✅ Passed The description includes all required template sections with clear explanations of changes, rationale, and a comprehensive test plan with checkboxes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/zortos-ports
📝 Coding Plan for PR comments
  • Generate coding plan

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

@github-actions github-actions bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Mar 12, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/web/src/routes/_chat.settings.tsx (1)

1-1: ⚠️ Potential issue | 🟡 Minor

Fix formatting to pass CI.

The pipeline indicates a formatting issue detected by oxfmt. Run bun run fmt to resolve this before merging.

As per coding guidelines: "All of bun fmt, bun lint, and bun typecheck must pass before considering tasks completed."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/src/routes/_chat.settings.tsx` at line 1, The file
apps/web/src/routes/_chat.settings.tsx has formatting violations (seen at the
import of createFileRoute) that fail oxfmt CI; run the project formatter (e.g.,
bun run fmt or bun fmt), review and stage the resulting changes for
apps/web/src/routes/_chat.settings.tsx (and any other modified files), then
commit and push so the CI formatting check passes.
apps/web/src/appSettings.ts (1)

1-1: ⚠️ Potential issue | 🟡 Minor

Fix formatting to pass CI.

The pipeline indicates a formatting issue detected by oxfmt. Run bun run fmt to resolve this before merging.

As per coding guidelines: "All of bun fmt, bun lint, and bun typecheck must pass before considering tasks completed."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/src/appSettings.ts` at line 1, The file import line in
apps/web/src/appSettings.ts is failing oxfmt; run the repo formatter (e.g., `bun
run fmt` or `bun fmt`) and reformat this file so the import statement (`import {
useCallback, useSyncExternalStore } from "react";`) and the rest of
appSettings.ts conform to the project's formatting rules, then re-run `bun lint`
and `bun typecheck` to ensure CI will pass.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/server/src/workspaceEntries.ts`:
- Around line 469-529: CI reports oxfmt failures in this block; run the
formatter and related checks and commit the changes so the findInsertionIndex,
insertRankedEntry, and searchWorkspaceEntries implementations are properly
formatted. Specifically, run the project's formatting/lint/typecheck pipeline
(e.g., bun run fmt or bun fmt, then bun lint and bun typecheck as required),
review the updated whitespace/linebreaks around the normalizedQuery logic and
the ranked insertion loop, and commit the resulting changes so the oxford-style
formatting error is resolved.
- Around line 483-490: The function insertRankedEntry improperly reads the tail
element when limit can be 0; update the guard in insertRankedEntry to
early-return when limit <= 0 (or otherwise check limit first) before evaluating
ranked[ranked.length - 1].score so you never dereference ranked[-1]; ensure the
condition checks limit <= 0 (or ranked.length === 0) before comparing score to
the last element to avoid the runtime exception.
- Around line 469-497: The current binary-insert logic in findInsertionIndex and
the early-return in insertRankedEntry only compare score, causing equal-score
ties to preserve scan order instead of using the lexical path tiebreaker; update
both functions to compare a secondary key (entry.path) when scores are equal:
change findInsertionIndex to treat (score, path) as the sort key (compare score
first, and when equal compare path lexically), and in insertRankedEntry update
the early-return check to allow insertion when score equals the last element but
entry.path is lexically smaller than ranked[ranked.length-1].entry.path so the
proper tie winner is kept. Ensure references to ProjectEntry.path are used for
the lexical comparison.

---

Outside diff comments:
In `@apps/web/src/appSettings.ts`:
- Line 1: The file import line in apps/web/src/appSettings.ts is failing oxfmt;
run the repo formatter (e.g., `bun run fmt` or `bun fmt`) and reformat this file
so the import statement (`import { useCallback, useSyncExternalStore } from
"react";`) and the rest of appSettings.ts conform to the project's formatting
rules, then re-run `bun lint` and `bun typecheck` to ensure CI will pass.

In `@apps/web/src/routes/_chat.settings.tsx`:
- Line 1: The file apps/web/src/routes/_chat.settings.tsx has formatting
violations (seen at the import of createFileRoute) that fail oxfmt CI; run the
project formatter (e.g., bun run fmt or bun fmt), review and stage the resulting
changes for apps/web/src/routes/_chat.settings.tsx (and any other modified
files), then commit and push so the CI formatting check passes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2dccb24a-2cb8-4eee-bb32-455ad618e323

📥 Commits

Reviewing files that changed from the base of the PR and between 2818d09 and e9e1a31.

📒 Files selected for processing (6)
  • apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts
  • apps/server/src/workspaceEntries.ts
  • apps/web/src/appSettings.ts
  • apps/web/src/components/DiffPanel.tsx
  • apps/web/src/components/chat/MessagesTimeline.tsx
  • apps/web/src/routes/_chat.settings.tsx

- Add limit <= 0 guard in insertRankedEntry to prevent ranked[-1]
  dereference when limit is zero
- Add path tiebreaker via compareRankedEntries so equal-score entries
  are ordered lexically by path instead of scan order
- Pass full candidate object to findInsertionIndex for composite
  comparison
@aaditagrawal aaditagrawal merged commit ca2f8b9 into main Mar 12, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

1 participant