Skip to content

fix: use native fetch for CDM instance discovery - #232

Merged
k-rister merged 1 commit into
masterfrom
codex/cdm-native-fetch-discovery
Nov 19, 2026
Merged

k-rister merged 1 commit into
masterfrom
codex/cdm-native-fetch-discovery

Conversation

@k-rister

Copy link
Copy Markdown
Contributor

Summary

  • Use native fetch for OpenSearch instance discovery.
  • Preserve non-2xx handling and asynchronous discovery behavior.
  • Align discovery transport with the native-fetch path already used by asynchronous CDM queries.

Root Cause

The previous follow-up made getInstancesInfo() asynchronous but retained then-request. In the Crucible MCP integration artifacts, CDM metric queries succeed and then subsequent discovery refreshes log transport failures, marking the reachable OpenSearch instances offline. Later list_indexed_results calls therefore return no runs.

CDM's batched query path already uses native fetch specifically to avoid the legacy request transport. This change uses that same transport for discovery.

Validation

  • node --check cdm.js
  • Prettier check for cdm.js
  • npm run test:instance-discovery
  • npm test

Follow-up to #231.

— AI-signed: Codex | model: gpt-6.1-sol | effort: not specified | contribution: implemented transport change and PR description

Use the same native fetch transport as the asynchronous CDM query path for OpenSearch index discovery. This avoids the remaining then-request transport failures observed after metric queries in the Crucible MCP integration job.

Follow-up to #231

AI-Tool: Codex

AI-Model: gpt-6.1-sol

AI-Effort: not specified
@k-rister k-rister self-assigned this Nov 18, 2026
@k-rister
k-rister requested a review from a team November 18, 2026 14:19
@project-crucible-tracking project-crucible-tracking Bot moved this to In Progress in Crucible Tracking Nov 18, 2026

@atheurer atheurer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. getInstancesInfo() now uses native fetch instead of then-request/sync-rpc, matching the reported Crucible MCP discovery failure mode. Non-2xx responses are now rejected explicitly and host-offline handling is preserved; index/version discovery logic is unchanged.

Verified locally on 4b384d9:

  • node --check cdm.js — OK
  • npx prettier --check cdm.js — clean
  • npm run test:instance-discovery — 2/2 pass
  • npm test — all suites pass (32 tests, 0 failures)

Non-blocking nits (fine to follow up separately):

  • var thenRequest = require("then-request"); at cdm.js:3 is now unused; the direct then-request dependency in package.json can likely be dropped too.
  • No coverage for connection-refused or malformed-JSON discovery responses (the 503 case is covered).

@k-rister
k-rister merged commit c772965 into master Nov 19, 2026
84 of 86 checks passed
@k-rister
k-rister deleted the codex/cdm-native-fetch-discovery branch November 19, 2026 14:01
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Crucible Tracking Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants