feat: add local cross-agent message bus#14
feat: add local cross-agent message bus#14uttambharadwaj wants to merge 3 commits intowillynikes2:masterfrom
Conversation
fdd6ce3 to
3ce707b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fdd6ce3feb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| new ResourceTemplate('bus://{channel}', { | ||
| list: async () => ({ | ||
| resources: listBusChannels().map(channel => ({ | ||
| uri: `bus://${channel.channel}`, |
There was a problem hiding this comment.
Percent-encode channel IDs in bus resource URIs
Channel IDs are documented/tested with values like ticket:PF-1884, but this code injects them directly into bus://${channel}. That produces invalid URIs (the suffix is interpreted as an authority/port, so parsers like URL reject it), which can cause MCP clients to drop resource listings/subscriptions and miss resources/updated notifications for normal channel names. Encode channel IDs (or place them in the path/query portion) before building resource URIs.
Useful? React with 👍 / 👎.
| }); | ||
|
|
||
| let watcher = null; | ||
| if (existsSync(watchedDir)) { |
There was a problem hiding this comment.
Create bus directory before attaching fs watcher
The notifier only calls watch() when watchedDir already exists, so on a fresh machine the MCP process starts without a filesystem watcher and never re-attempts setup. If another local process creates ~/.claude/bus later and writes messages, cross-process bus://... resource updates are missed until restart. Ensuring storage exists (or retrying watcher initialization) before this check would make first-run behavior match the documented push-notification flow.
Useful? React with 👍 / 👎.
| const isDir = entry.isDirectory() || (entry.isSymbolicLink() && statSync(fullPath).isDirectory()); | ||
| const isFile = entry.isFile() || (entry.isSymbolicLink() && statSync(fullPath).isFile()); | ||
| if (isDir) { | ||
| walk(fullPath); |
There was a problem hiding this comment.
Avoid recursive symlink loops in vault scanner
This change descends into symlinked directories via walk(fullPath) without any visited-target tracking, so a symlink cycle (for example, a link pointing to an ancestor folder) can recurse indefinitely and hang/crash indexVault. Since symlink traversal is new in this commit, adding realpath-based cycle detection (and skipping already-seen targets) is needed to keep indexing robust.
Useful? React with 👍 / 👎.
Summary
bus://<channel>resource subscribers and fixkb registerto use an absolute Node entrypointTesting
node --testnode --test tests/register.test.js