Skip to content

Merge the lane flags of a widened session search - #1929

Merged
realtonyyoung merged 2 commits into
mainfrom
tonyyoung/ai-3467-widened-search-lane-flags
Oct 25, 2026
Merged

realtonyyoung merged 2 commits into
mainfrom
tonyyoung/ai-3467-widened-search-lane-flags

Conversation

@realtonyyoung

@realtonyyoung realtonyyoung commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

AI-3467 (no GitHub issue)

What & why

When search_sessions widens to all repositories, the merged body kept only the pinned request's bounded_lanes and timed_out_lanes. It also read a null no_lexical_match, which means the transcript lane timed out, as true, so the merged response could claim no lexical match existed when the lane simply didn't finish

  • bounded_lanes and timed_out_lanes are the union of both requests' lanes. They stay null only when neither request ran a lexical search
  • no_lexical_match is false when either request matched, true only when both definitively did not, and null otherwise

Verification

Run Result
New and reshaped merge rows, before the fix 7 of 20 fail (widened-only bounded/timed-out lane, unknown kept as unknown)
McpSessionsServerTests, after 115/115 pass
dotnet publish src/Capacitor.Cli -c Release 0 IL warnings

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Session results now combine lane status indicators across scopes, keeping unique entries in their original order.
    • The “no lexical match” indicator is now merged consistently: a reported match takes precedence, while a no-match status is retained only when both results report it. If the indicator appears only in the widened result, that value is preserved.
    • Responses that cannot be parsed continue to use the original result unchanged.

A null no_lexical_match means the transcript lane timed out, so the merge treats it as unknown rather than as no match

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Oct 24, 2026

Copy link
Copy Markdown

AI-3467

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 13e62443-7495-4326-8205-0ee19cc11e21
Commits

Reviewing files that changed from the base of the PR and between f130862 and 818cfc8.

Files selected for processing: 2
  • src/Capacitor.Cli/Commands/McpSessionsServer.cs
  • test/Capacitor.Cli.Tests.Unit/Commands/McpSessionsServerTests.cs

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

Walkthrough

MergeWidenedBody now combines match-state and lane metadata from widened responses. Unit tests cover flag combinations, omitted and null values, and lane-array unions.

Changes: Widened session response merging

Layer / File(s) Summary
Merge response fields and test outcomes
src/Capacitor.Cli/Commands/McpSessionsServer.cs, test/Capacitor.Cli.Tests.Unit/Commands/McpSessionsServerTests.cs
MergeWidenedBody combines no_lexical_match values and unions distinct string entries in bounded_lanes and timed_out_lanes. Tests cover flag combinations, omitted and null fields, lane-array unions, and shared field assertions.

Priority: Normal

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

Change: Bug fix

Possibly related issues

  • kurrent-io/kcap-cli issue 1910: This change merges lane metadata and match state across widened session responses, which aligns with part of the issue’s session-search merging objective.

Suggested reviewers: alexeyzimarev

Merge Risk: Minimal · up to 818cf

No identified issue prevents merging after normal checks.

Security architecture risk: Minimal · up to 818cf

The change preserves uncertainty and timeout information when combining search responses. It does not expand repository access, add operations, or change the conditions for widening a search. No material security risk was identified in the reviewed change.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The introduced effect is limited to metadata delivered with already-fetched session-search results. The base-to-head change adds no request destination, repository-selection path, credential use, or session-content retrieval.

Trust Boundaries and Controls

  • observed — Existing repository-scope controls remain outside the modified helper: explicit nonblank repository selections prevent automatic widening, unresolved current-repository scope requires an explicit selection, and request values are URL-escaped. These client-side controls do not independently establish server-side session authorization.

Resilience and Maintainability Implications

  • observed — The merge mutates newly parsed local JSON rather than shared persistent state and returns the original first body on failure. The unchanged caller retains the successful first result when widening fails, is refused, or times out. This preserves failure containment without introducing a reservation, cleanup, or recovery lifecycle.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the primary change: merging lane flags from widened session searches.
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.
Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@realtonyyoung
realtonyyoung marked this pull request as ready for review October 25, 2026 00:09
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Merge lane flags across widened session searches

🐞 Bug fix 🧪 Tests 🕐 10-20 Minutes

Grey Divider

AI Description

• Union bounded and timed-out lanes from pinned and widened searches so neither scope’s flags are
 lost.
• Preserve unknown lexical-match results when a transcript lane times out.
• Add tests for lane unions and lexical flags that are true, false, null, or absent.
Diagram

graph TD
  P["Pinned response"] --> H["Merge hits"] --> L["Resolve lexical flag"] --> U["Union lane flags"] --> R["Merged response"]
  W["Widened response"] --> H
  W --> L
  W --> U
Loading
High-Level Assessment

Keep the fix in the existing response merger: it is a localized change to how two JSON bodies are combined. Introducing typed response models was considered, but would broaden this narrowly scoped correction.

Files changed (2) +66 / -16

Bug fix (1) +27 / -7
McpSessionsServer.csCombine lexical status and lane flags across both scopes +27/-7

Combine lexical status and lane flags across both scopes

• MergeWidenedBody now treats a null lexical-match flag as unknown, preserves the other scope’s answer when a flag is absent, and unions bounded and timed-out lane names. Lane flags remain null when neither response supplies an array.

src/Capacitor.Cli/Commands/McpSessionsServer.cs

Tests (1) +39 / -9
McpSessionsServerTests.csCover widened-search flag merge cases +39/-9

Cover widened-search flag merge cases

• Expands lexical-match cases to distinguish null from an absent field. Adds parameterized checks for lane unions, deduplication, empty arrays, and null or absent lane flags.

test/Capacitor.Cli.Tests.Unit/Commands/McpSessionsServerTests.cs

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can enable the Remediation agent and Qodo fixes findings in a dedicated fix PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@realtonyyoung
realtonyyoung merged commit b9e9b92 into main Oct 25, 2026
31 of 35 checks passed
@realtonyyoung
realtonyyoung deleted the tonyyoung/ai-3467-widened-search-lane-flags branch October 25, 2026 00:58
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