Skip to content

fix(commands): broadcast location catalog events to all stream clients - #406

Merged
chriswritescode-dev merged 3 commits into
mainfrom
fix/command-catalog-refresh
Oct 8, 2026
Merged

chriswritescode-dev merged 3 commits into
mainfrom
fix/command-catalog-refresh

Conversation

@chriswritescode-dev

@chriswritescode-dev chriswritescode-dev commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

Summary

Location-scoped catalog events (command.updated, agent.updated, skill.updated) were only delivered to clients subscribed to the originating directory. A client attached to another location never saw the change, so its slash menu stayed on the builtin commands. These events now route through the resolved-event broadcast so every connected client receives them.

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation

Checklist

  • Code follows project style (no comments, named imports)
  • TypeScript types are properly defined
  • Tests added/updated (80% coverage target)
  • pnpm lint passes locally
  • pnpm typecheck passes locally

Backend sse-aggregator tests pass (38/38), backend lint reports 0 errors, and backend typecheck passes.

Summary by CodeRabbit

  • Bug Fixes
    • Updates to commands, agents, and skills are now delivered to all connected clients, while listeners retain the event’s actual directory.
    • Other directory-scoped events, such as session status updates, remain limited to clients subscribed to that directory.
    • Commands now refresh correctly when switching between directories, so the selected directory’s commands are shown.

Location-scoped command, agent and skill catalog events were only delivered to clients subscribed to the originating directory, so a client attached to another location never saw a catalog change and its slash menu stayed on the builtin commands. Route command.updated, agent.updated and skill.updated through the resolved-event broadcast so every connected client receives them.
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b3e97063-7ccd-44cb-9a75-485279df4dd5
📥 Commits

Reviewing files that changed from the base of the PR and between b16f1f8 and 79d6ba2.

📒 Files selected for processing (2)
  • frontend/src/hooks/useCommands.test.tsx
  • frontend/src/hooks/useCommands.ts
 ___________________________________________________________________________________________________________________
< Work with a user to think like a user. It's the best way to gain insight into how the system will really be used. >
 -------------------------------------------------------------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 57f5e72f-830f-425a-94cc-226f190b12ed
📥 Commits

Reviewing files that changed from the base of the PR and between e7dc106 and b16f1f8.

📒 Files selected for processing (2)
  • backend/src/services/sse-aggregator.ts
  • backend/test/services/sse-aggregator.test.ts

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


📝 Walkthrough

Walkthrough

The SSE aggregator now broadcasts directory-bearing command.updated, agent.updated, and skill.updated events to all clients with a null directory envelope. Listeners receive the event’s actual directory. Other directory-bearing events remain scoped to clients subscribed to that directory.

Changes

Location-catalog event broadcast

Layer / File(s) Summary
Catalog event delivery
backend/src/services/sse-aggregator.ts, backend/test/services/sse-aggregator.test.ts
The aggregator routes directory-bearing catalog events through resolved delivery. Tests check delivery to subscribed and unsubscribed clients, verify the listener receives the actual directory, and check that a subsequent session.status event is not delivered to either client.

Priority: ⬇️ Low

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

Change: Bug fix

Merge Risk: ⚪ Minimal · up to b16f1

This change delivers command, agent, and skill catalog updates to all connected clients, which is the stated intent. No merge-blocking risk was found.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 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 describes the main change: broadcasting location catalog events to all stream clients. It is concise and directly related to the implementation.
Description check ✅ Passed The description includes the required Summary, Type of Change, and Checklist sections. It explains the affected events, the behavior change, and the reported test, lint, and typecheck results.
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 docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · 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

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

…builtin seed

The commands query seeded every new directory key with the builtin commands as initialData. With the app's 10s staleTime, React Query treated that seed as freshly fetched data, so switching to a session in another project never requested that location's commands and the slash menu showed only the builtins until some later invalidation.

Mark the seed as stale with initialDataUpdatedAt: 0 so each directory fetches its commands on mount.
The slash menu prefixed every command with the Command (⌘) glyph, which the leading "/" already conveys and which only consumed horizontal space. Render the kind icon only for kinds that have one, so command rows start at the label while agent, skill and file rows keep theirs.
@chriswritescode-dev
chriswritescode-dev merged commit fc83b7d into main Oct 8, 2026
1 check passed
@chriswritescode-dev
chriswritescode-dev deleted the fix/command-catalog-refresh branch October 8, 2026 20:23
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