New detectors daemon for detection and quarantine#29
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
There was a problem hiding this comment.
All reported issues were addressed across 22 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…ting partial frames from the old stream.
There was a problem hiding this comment.
1 issue found across 21 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/main/detectord/socket.ts">
<violation number="1" location="src/main/detectord/socket.ts:54">
P2: A reconnect can lose a reply when the prior socket's delayed `close` fires after the new socket starts receiving data: this clears the shared buffer for the new stream. Associate close handling with its socket and ignore a stale socket's close event before clearing connection state/buffer.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
| this.connecting = new Promise<void>((resolve, reject) => { | ||
| // A new byte stream must start clean; never inherit a partial frame left | ||
| // in the buffer by a previous (abruptly closed) connection. | ||
| this.buf = '' |
There was a problem hiding this comment.
P2: A reconnect can lose a reply when the prior socket's delayed close fires after the new socket starts receiving data: this clears the shared buffer for the new stream. Associate close handling with its socket and ignore a stale socket's close event before clearing connection state/buffer.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/main/detectord/socket.ts, line 54:
<comment>A reconnect can lose a reply when the prior socket's delayed `close` fires after the new socket starts receiving data: this clears the shared buffer for the new stream. Associate close handling with its socket and ignore a stale socket's close event before clearing connection state/buffer.</comment>
<file context>
@@ -44,6 +49,9 @@ export class DetectordClient extends EventEmitter {
this.connecting = new Promise<void>((resolve, reject) => {
+ // A new byte stream must start clean; never inherit a partial frame left
+ // in the buffer by a previous (abruptly closed) connection.
+ this.buf = ''
const sock = createConnection(this.socketPath)
sock.setEncoding('utf8')
</file context>
IliaMManolov
left a comment
There was a problem hiding this comment.
See comments here: https://github.com/Edison-Watch/mcp-detector-lib/pull/2
Summary by cubic
Introduce a bundled detector daemon (
edison-detectord) that takes over MCP discovery, quarantine, and onboarding with a batched approval dialog, automatic bootstrap/enroll on app start, and stdio support. This centralizes policy, improves resiliency (local-enrollment fallback, robust socket reconnect, safer IPC), and lets the client mirror daemon activity into logs while standing down its own pipeline in primary mode.New Features
EW_DETECTORD_PRIMARY.list_servers(includes stdio) and falls back to local scan if unreachable or not enrolled.window.api.detectord.enroll,.setSecret(returnsoutcome), and.uninstall; renderer pushes credentials after sign-in; Org Key adoption flows to the daemon.scripts/build-detectord.shandnpm run build:detectord; bundle daemon viaelectron-builderextraResources; mac builds targetarm64only; clear-data teardown purges the daemon.Migration
npm run build:detectord(orcargo build --release --target aarch64-apple-darwinindetectord/formcp_detector_daemon).EW_DETECTORD_PRIMARY=0to use the existing TypeScript hooks/quarantine pipeline.arm64-only; no universal or x86_64 slice.Written for commit ef813f7. Summary will update on new commits.