Skip to content

fix: await CDM instance discovery - #231

Merged
k-rister merged 1 commit into
masterfrom
codex/mcp-cdm-instance-discovery
Nov 17, 2026
Merged

k-rister merged 1 commit into
masterfrom
codex/mcp-cdm-instance-discovery

Conversation

@k-rister

Copy link
Copy Markdown
Contributor

Summary

  • Make OpenSearch instance discovery asynchronous with then-request.
  • Await every CDM Query Server route and CLI discovery refresh.
  • Preserve startup ordering by completing initial discovery before the server listens.
  • Mark non-2xx OpenSearch discovery responses offline instead of parsing their bodies.
  • Add regression coverage for pending discovery and HTTP 503 handling.

Root Cause

After CDM query requests became asynchronous, getInstancesInfo() remained synchronous and callers did not await it. This allowed route handlers to use partially refreshed instance metadata and, in the Crucible MCP integration failure, caused a reachable OpenSearch instance to be marked offline. Subsequent /api/v1/runs requests then returned no runs even though indexing and metric queries had succeeded.

Validation

  • node --check passes for all modified JavaScript files.
  • npm test passes: 63 tests, 0 failures.
  • Prettier reports all changed files correctly formatted.

Fixes #230

— AI-signed: Codex | model: gpt-6.1-sol | effort: not specified | contribution: implemented fix, tests, and PR description

Make OpenSearch instance discovery asynchronous, await all callers, and add regression coverage for pending discovery and HTTP error responses.

Fixes #230

AI-Tool: Codex

AI-Model: gpt-6.1-sol

AI-Effort: not specified
@k-rister k-rister self-assigned this Nov 17, 2026
@k-rister
k-rister requested a review from a team November 17, 2026 16:36
@project-crucible-tracking project-crucible-tracking Bot moved this to In Progress in Crucible Tracking Nov 17, 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.

Approve — verified async discovery fix preserves startup ordering and correctly awaits all route callers. Fixes #230. Minor follow-up nit: cdm.js:getInstancesInfo leaks globals (inst_idx/url/resp); recommend adding let/const to avoid cross-call clobber with async yields.

@atheurer

Copy link
Copy Markdown
Contributor

SSH identity check: ✅ PASS — no auth/QUADS changes; existing ~/.ssh/id_ed25519 reused per AGENTS.md (present locally, no generation needed).

Review summary: Startup now correctly awaits initial discovery before listen, and all 14 server.js call sites plus CLI entry points await getInstancesInfo. Non-2xx handling and new regression tests for pending/503 look good.

Nit (non-blocking): cdm.js loop vars leak to global scope (inst_idx, url, resp etc. missing let/const) — with async yields this could clobber on concurrent calls. Suggest follow-up to scope them.

@k-rister
k-rister merged commit 0ebcf54 into master Nov 17, 2026
46 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Crucible Tracking Nov 17, 2026
@k-rister
k-rister deleted the codex/mcp-cdm-instance-discovery branch November 17, 2026 20:23
k-rister added a commit to k-rister/CommonDataModel that referenced this pull request Nov 19, 2026
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 perftool-incubator#231

AI-Tool: Codex

AI-Model: gpt-6.1-sol

AI-Effort: not specified
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.

CDM instance discovery races after asynchronous query conversion

2 participants