Repository navigation
[3616 by Claude Opus 5.5] Package MCP servers: "Check" and save fail for every npm package against the public registry (502) - #3627
Conversation
…he public registry. All three extension call sites now use one shared `lookup` helper, `pinnedLookup`, which answers correctly whether Node asks for a list of addresses or a single one. I tested this against a local test server, not the live npm registry.
Cause. On Node 22, Node asks the custom `lookup` for a list of addresses (`all: true`). The old callback returned a single address, so every request failed with `ERR_INVALID_IP_ADDRESS` and was reported as 502.
Changes
- `endpointPolicy.ts`: new exported `pinnedLookup(address, family)`. It returns `[{ address, family }]` when Node asks for a list and the single address otherwise. It still only ever answers with the vetted address, so the public-address check is unchanged and redirects are still not followed. MCP tool discovery in `requestExtensionMcp` now uses it.
- `extensionOAuthHttp.ts` (OAuth discovery and token requests): now uses `pinnedLookup`. This path, like MCP tool discovery, dials the vetted IP directly, so Node probably never calls the lookup there. I changed both anyway, as the issue asked.
- `packageRegistry.ts`: `registryGet` now uses `pinnedLookup`. It is also exported and takes an optional `vet` argument, which defaults to the real public-address check; this is only so the test can point the pinned connection at a local server. A missing package or version now returns the existing 404 "was not found in the npm registry" instead of 502.
- `packages/api/mcp/clients.ts`: outside the extensions code, but it had the same single-address callback when fetching OAuth client metadata by hostname. I fixed it inline the same way.
Tests. The new `packages/core/test/extensionPinnedLookup.test.ts` sends real HTTP requests through `registryGet` to a local server. The hostname used doesn't resolve, so a request can only arrive through the custom lookup. It runs once with `all: true` and once with `all: false`, and checks both a found package (200) and a missing one (404). A third test checks the helper's return value in both cases.
- With the old callback put back, the `all: true` case fails, so the test catches the bug on Node 22.23.
- With the fix, the new tests and the existing extension package-server, OAuth and profile suites pass (48 tests across the final runs). The profile suite needs `PROPR_DEMO_MODE=true`, or it exits early on the GitHub-auth check.
- ESLint (zero warnings) and `tsc` pass for core, and API `tsc` passes. The new test file is ignored by core's ESLint config, so lint covers only `src/extensions`.
No visual previews, since nothing in the UI changed.
|
/ultrafix goal=8 max=6 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 6) First action:
|
|
✅ AI Code Review Complete requested by @propr-dev[bot] Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR correctly fixes the lookup callback shape while preserving address pinning. The change is focused and merge-ready within scope, conditional on the four pending test shards completing successfully. ✅ Correct callback shapes — ✅ Preserved security boundary — Production registry requests still vet the destination before connecting, and both callback shapes return only that vetted address. ✅ Focused regression coverage — The new tests exercise real sockets with both address-selection settings, checking successful and missing-package responses through an unresolvable hostname. This assessment is based on static review of the supplied diff and complete file contents; no commands were run. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Cover IPv6 callback resultsConsider parameterizing the helper test in ScoreThe implementation directly addresses the failure with focused regression tests and no verified introduced defects. Current checks report no failures, with four test shards still pending. Score: 9/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
AI Implementation Summary
Closes #3616
Branch:
3616/claude-opus-5-5-package-mcp-servers-check-20261117-0149-05pCommits: ✅ Changes committed (3eda7cb)
AI Processing Completed
Execution Details:
Summary:
I fixed the 502 when checking or saving npm package servers against the public registry. All three extension call sites now use one shared
lookuphelper,pinnedLookup, which answers correctly whether Node asks for a list of addresses or a single one. I tested this against a local test server, not the live npm registry.Cause. On Node 22, Node asks the custom
lookupfor a list of addresses (all: true). The old callback returned a single address, so every request failed withERR_INVALID_IP_ADDRESSand was reported as 502.Changes
endpointPolicy.ts: new exportedpinnedLookup(address, family). It returns[{ address, family }]when Node asks for a list and the single address otherwise. It still only ever answers with the vetted address, so the public-address check is unchanged and redirects are still not followed. MCP tool discovery inrequestExtensionMcpnow uses it.extensionOAuthHttp.ts(OAuth discovery and token requests): now usespinnedLookup. This path, like MCP tool discovery, dials the vetted IP directly, so Node probably never calls the lookup there. I changed both anyway, as the issue asked.packageRegistry.ts:registryGetnow usespinnedLookup. It is also exported and takes an optionalvetargument, which defaults to the real public-address check; this is only so the test can point the pinned connection at a local server. A missing package or version now returns the existing 404 "was not found in the npm registry" instead of 502.packages/api/mcp/clients.ts: outside the extensions code, but it had the same single-address callback when fetching OAuth client metadata by hostname. I fixed it inline the same way.Tests. The new
packages/core/test/extensionPinnedLookup.test.tssends real HTTP requests throughregistryGetto a local server. The hostname used doesn't resolve, so a request can only arrive through the custom lookup. It runs once withall: trueand once withall: false, and checks both a found package (200) and a missing one (404). A third test checks the helper's return value in both cases.all: truecase fails, so the test catches the bug on Node 22.23.PROPR_DEMO_MODE=true, or it exits early on the GitHub-auth check.tscpass for core, and APItscpasses. The new test file is ignored by core's ESLint config, so lint covers onlysrc/extensions.No visual previews, since nothing in the UI changed.
Review digest
Risk-tiered paths
packages/core/src/extensions/extensionOAuthHttp.ts(+2/−2): auth-looking pathpackages/api/mcp/clients.ts(+2/−1)packages/core/src/extensions/endpointPolicy.ts(+15/−2)packages/core/src/extensions/packageRegistry.ts(+12/−5)packages/core/test/extensionPinnedLookup.test.ts(added, +60/−0)Validation evidence
Diff size: 5 files changed, +91/−10 lines
Detailed Logs:
9a7f840b-002f-48d7-a637-092eedaff30bLog files stored at:
/usr/src/app/logs/executions/issue-3616-2026-11-17T01-58-18-964Z-conversation.json/usr/src/app/logs/executions/issue-3616-2026-11-17T01-58-18-964Z-output.txtLatest Conversation Messages
This PR was created automatically by ProPR after processing issue #3616.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!