Skip to content

Fix CVE-2025-66414 and reduce CLI method complexity - #50

Merged
clduab11 merged 5 commits into
branch-3-devtestfrom
copilot/sub-pr-48-again
Feb 13, 2026
Merged

Fix CVE-2025-66414 and reduce CLI method complexity#50
clduab11 merged 5 commits into
branch-3-devtestfrom
copilot/sub-pr-48-again

Conversation

Copilot AI commented Feb 13, 2026

Copy link
Copy Markdown
Contributor

CodeFactor flagged vulnerable @modelcontextprotocol/sdk dependency and three complex methods in src/cli/index.ts exceeding maintainability thresholds.

Changes

Security

  • Update @modelcontextprotocol/sdk 1.20.1 → 1.26.0 (fixes CVE-2025-66414)

Refactoring

Extract helper functions into dedicated modules to reduce method complexity:

src/cli/hive-mind-helpers.ts - orchestration lifecycle

  • executeGoapWorkflow() - GOAP execution
  • executeTaskWithConsensus() - task dispatch with timeout/voting
  • collectExecutionResults() - aggregate system metrics
  • renderExecutionSummary() - formatted output
  • setupWorkflowEventHandlers() - event subscription management

src/cli/doctor-helpers.ts - health checks

  • checkCliBuildArtifact(), checkCliExecution(), checkCodexAuth() - validation
  • renderHealthCheckResults() - diagnostic output

Type safety

  • Add ExecutionResultData interface replacing any types
  • JSDoc annotations on all exported functions

Example

Before (364-line monolithic handler):

.action(handleCommand('hive-mind.spawn', async (promptParts: string[], options) => {
  // 364 lines of GOAP setup, context building, orchestration, consensus, rendering...
}));

After (28-line orchestrator):

.action(handleCommand('hive-mind.spawn', async (promptParts: string[], options) => {
  // GOAP path
  if (strategy === 'goap') {
    await executeGoapWorkflow(system, manifest, goalId, originalPrompt, dryRun);
    return;
  }
  
  // Classic orchestration
  const { outcome, consensusResult, totalTime } = await executeTaskWithConsensus(/*...*/);
  const resultData = collectExecutionResults(/*...*/);
  await renderExecutionSummary(resultData, options);
}));

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits February 13, 2026 03:16
- Update @modelcontextprotocol/sdk from 1.20.1 to 1.26.0 (fixes CVE-2025-66414)
- Extract helper functions to reduce complexity in hive-mind spawn command
- Create hive-mind-helpers.ts with GOAP, task execution, and result rendering functions
- Create doctor-helpers.ts with health check functions
- Refactor doctor command to use extracted helper functions
- Reduce method complexity from 364+ lines to more maintainable chunks

Co-authored-by: clduab11 <185000089+clduab11@users.noreply.github.com>
Co-authored-by: clduab11 <185000089+clduab11@users.noreply.github.com>
- Restore original auth check logic using negative test for "not logged in"
- Change require() to dynamic import() for ES module consistency
- Ensure completion message is always shown before YAML output
- Make renderExecutionSummary async to support dynamic import

Co-authored-by: clduab11 <185000089+clduab11@users.noreply.github.com>
- Add ExecutionResultData interface for type safety
- Add comprehensive JSDoc comments with @param and @returns tags
- Remove unused checkMcpProfile function
- Update function signatures to use proper types instead of any

Co-authored-by: clduab11 <185000089+clduab11@users.noreply.github.com>

Copilot AI commented Feb 13, 2026

Copy link
Copy Markdown
Contributor Author

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.openai.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/codex-synaptic/codex-synaptic/dist/cli/index.js openai usage --json .mjs sh node_modules/.bin/node npm run build node n/node node n/ts�� run build k/codex-synaptic/codex-synaptic/node_modules/.bin/sh tsc &amp;&amp; node scricodex node es/.bin/sh sh (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Add MCP workflows and growth automation docs Fix CVE-2025-66414 and reduce CLI method complexity Feb 13, 2026
Copilot AI requested a review from clduab11 February 13, 2026 03:29
@clduab11 clduab11 added bug Something isn't working general improvements General QOL improvements and random small bug fixex and patches refactor Any and all changes leading to refactors domain → infrastructure (Linear) labels Feb 13, 2026
@clduab11
clduab11 marked this pull request as ready for review February 13, 2026 03:35
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@clduab11
clduab11 merged commit 546ca88 into branch-3-devtest Feb 13, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working domain → infrastructure (Linear) general improvements General QOL improvements and random small bug fixex and patches refactor Any and all changes leading to refactors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants