Skip to content

Connectors list linked conversations once when a listener attaches - #49410

Merged
brennanb2025 merged 1 commit into
mainfrom
brennanb2025/sta-18473-connector-watch-one-enumeration
Nov 26, 2026
Merged

brennanb2025 merged 1 commit into
mainfrom
brennanb2025/sta-18473-connector-watch-one-enumeration

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When a connector starts listening, Orca went through every linked conversation twice. Now it goes through them once.

What Changed

ConversationEvents.watch() pruned leftover turn dates by listing every link, then listed every link again to build the first snapshot. The prune now uses the pane keys from that one snapshot pass, run right after it. The snapshot only reads dates for linked panes and the prune only removes unlinked ones, so the result is the same.

Why

Each listener attach cost an extra full link enumeration (and two arrays sized to the link count) on the main process. This is the release-blocker regression from #48604.

Linked Issue

STA-18473

Visual Proof

N/A: no UI change; main-process work count only.

Testing

  • Throwaway bench on the real ConversationEvents.watch() (2,000 links, 10 attaches), not committed: link visits 40,000 → 20,000, allLinks passes 20 → 10, time ~23 ms either way (the index cache makes each pass cheap).
  • pnpm check:changed passes on this head (Linux).
  • No test added: a two-line ordering change with no new logic; the existing connector tests cover the snapshot.

Performance

Less work: one link enumeration per connector listener attach instead of two. No new timers, triggers or consumers; idle wakeups 0 → 0.

Risk

Level: Low. Pruning now runs after the snapshot instead of before. Both touch only in-memory turn dates for panes the other leaves alone. Back out with a plain revert.

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

ConversationEvents.watch now reads the initial snapshot before retaining chat turn dates. It retains dates only for pane keys present in that snapshot.

Merge Risk: Minimal · up to c6de3

Attaching a connector listener now enumerates linked conversations once instead of twice, with no expected change in results. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the connector's once-per-attach link enumeration, which is the main change in the summary (prune now reuses the snapshot's pane keys so links are listed once). It is specific and accur…
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.
Description check Passed The description covers most template sections with substance. It explains the change: the prune now uses pane keys from the single snapshot pass, so link enumeration drops from two passes to one per l…
Full details: Title check

Explanation

The title names the connector's once-per-attach link enumeration, which is the main change in the summary (prune now reuses the snapshot's pane keys so links are listed once). It is specific and accurate, though it does not mention the prune-ordering mechanism.

Full details: Description check

Explanation

The description covers most template sections with substance. It explains the change: the prune now uses pane keys from the single snapshot pass, so link enumeration drops from two passes to one per listener attach. It gives the motivation (a release-blocker regression from #48604), a concrete benchmark (link visits 40,000 to 20,000, allLinks passes 20 to 10, about 23 ms either way), a Performance line, a Risk level with a back-out plan (plain revert), and a Testing section. Gaps: the Linked Issue section lists only 'STA-18473' without the 'Fixes #' form the template asks for, and the template's required Testing checkboxes for manual testing and test anti-patterns are not clearly addressed. The author also states no test was added, with a short justification. The AI Disclosure section is left empty, though the template says it may be skipped for internal team members. The ELI5 and the Visual Proof N/A are present.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 174b3095-c10f-47f5-8691-f5d7ce355aac
Commits

Reviewing files that changed from the base of the PR and between d3e67bf and c6de39e.

Files selected for processing: 1

  • src/main/external-conversations/external-conversation-events.ts

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

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Status. The problem: when a connector started listening, it went through every linked conversation twice. Now it goes through them once and gets the same result. There is no visible change.

Perf scan (fresh reviewer, head c6de39e): PASS.

  • Each listener attach now does one link enumeration instead of two.
  • No new triggers, timers or consumers. Idle wakeups stay at 0/s for main, renderer and daemon.
  • Benchmark on the real watch path (2,000 links, 10 attaches): link visits went from 40,000 to 20,000. Time was the same either way, about 23 ms.

Review: the code review is clean. One wording problem in the PR description has been fixed. Nothing is deferred.

Verified: CI is green and pnpm check:changed passes. QA used tests only; this is main-process code with no UI.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Benchmark: head=c6de39e7bf401af49ba545f03467725129e56299 gate=PASS. Corpus: 2,000 linked conversations, 10 connector listener attaches on the real ConversationEvents.watch() (Linux, vitest, throwaway file not committed). Before: 20 link passes and 40,000 link visits, 22.9 ms. After: 10 passes and 20,000 visits, 24.0 ms. Listeners mounted: connector watch only. Measured on 936c372. Its src/main/external-conversations/ matches this head exactly, apart from the bench file.

@brennanb2025
brennanb2025 merged commit 2986270 into main Nov 26, 2026
56 checks passed
registered2nd pushed a commit to registered2nd/orca that referenced this pull request Nov 26, 2026
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