Repository navigation
fix: use internal Auth and MCP service bindings in staging - #53
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Reviewer's GuideImplementationRoute MCP and Auth health probes through configured service bindings while retaining public fallbacks, and extend MCP timeout and failure diagnostics.
DocumentationDocument the staging-only MCP and Auth service bindings, their fallback behavior, and the limitations of internal health checks.
TestsVerify MCP and CLI Auth probes use their configured internal service bindings and return healthy service results.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Hey - I've found 3 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="workers/control-api/worker.mjs" line_range="235" />
<code_context>
cache: "no-store",
redirect: "error",
- signal: AbortSignal.timeout(4000)
+ signal: AbortSignal.timeout(12000)
});
if (!initializeResponse.ok) {
</code_context>
<issue_to_address>
**Public probes hold capacity longer**
When anonymous clients repeatedly call the public probe routes while the MCP endpoint responds slowly but within each request timeout, `handleRequest` calls `probeMcpServer` on public MCP connection routes without authentication or throttling. Its three serial fetches can now keep each Worker request and its upstream requests open for up to 36 seconds, allowing repeated callers to exhaust capacity during a slow MCP response.
Apply a rate limit or cache probe results, and enforce an overall deadline for the handshake.
Also at `workers/control-api/worker.mjs:252`, `workers/control-api/worker.mjs:263`.
</issue_to_address>
### Comment 2
<location path="workers/control-api/worker.mjs" line_range="235" />
<code_context>
cache: "no-store",
redirect: "error",
- signal: AbortSignal.timeout(4000)
+ signal: AbortSignal.timeout(12000)
});
if (!initializeResponse.ok) {
</code_context>
<issue_to_address>
**Staging validation aborts early**
When the sequential MCP handshake takes longer than the staging checker’s 10-second `/services` budget, `probeMcpServer` can spend up to 36 seconds on its three sequential requests, so `check-control-api-staging.mjs` aborts before the probe returns and reports the staging result as unverified or failed.
Bound the total probe duration so it completes within the staging checker’s 10-second request budget.
Also at `workers/control-api/worker.mjs:251`, `workers/control-api/worker.mjs:263`.
</issue_to_address>
### Comment 3
<location path="workers/control-api/worker.mjs" line_range="281" />
<code_context>
};
- } catch {
+ } catch (error) {
+ console.warn(JSON.stringify({ event: "control_api.mcp_probe_failed", errorType: error?.name || "Error" }));
return {
state: "unavailable",
</code_context>
<issue_to_address>
**Failed handshakes lack diagnostics**
When the endpoint returns an HTTP error or an invalid handshake response, the HTTP-status and protocol-mismatch branches return `unavailable` or `unknown` without throwing, so they bypass the `catch` that logs `control_api.mcp_probe_failed`; callers see a failed probe without the failure diagnostic.
Emit the failure warning on the HTTP-status and protocol-mismatch return branches as well as in the `catch`.
</issue_to_address>Sourcery assessment
Approval pending. 3 findings to address first.
Blocking findings: workers/control-api/worker.mjs:235, workers/control-api/worker.mjs:235, workers/control-api/worker.mjs:281
| cache: "no-store", | ||
| redirect: "error", | ||
| signal: AbortSignal.timeout(4000) | ||
| signal: AbortSignal.timeout(12000) |
There was a problem hiding this comment.
🟡 Medium · Public probes hold capacity longer
When anonymous clients repeatedly call the public probe routes while the MCP endpoint responds slowly but within each request timeout, handleRequest calls probeMcpServer on public MCP connection routes without authentication or throttling. Its three serial fetches can now keep each Worker request and its upstream requests open for up to 36 seconds, allowing repeated callers to exhaust capacity during a slow MCP response.
Apply a rate limit or cache probe results, and enforce an overall deadline for the handshake.
Also at workers/control-api/worker.mjs:252, workers/control-api/worker.mjs:263.
Prompt for AI agents
In `workers/control-api/worker.mjs` at line 235:
**Public probes hold capacity longer**
When anonymous clients repeatedly call the public probe routes while the MCP endpoint responds slowly but within each request timeout, `handleRequest` calls `probeMcpServer` on public MCP connection routes without authentication or throttling. Its three serial fetches can now keep each Worker request and its upstream requests open for up to 36 seconds, allowing repeated callers to exhaust capacity during a slow MCP response.
Apply a rate limit or cache probe results, and enforce an overall deadline for the handshake.
Also at `workers/control-api/worker.mjs:252`, `workers/control-api/worker.mjs:263`.| cache: "no-store", | ||
| redirect: "error", | ||
| signal: AbortSignal.timeout(4000) | ||
| signal: AbortSignal.timeout(12000) |
There was a problem hiding this comment.
🟡 Medium · Staging validation aborts early
When the sequential MCP handshake takes longer than the staging checker’s 10-second /services budget, probeMcpServer can spend up to 36 seconds on its three sequential requests, so check-control-api-staging.mjs aborts before the probe returns and reports the staging result as unverified or failed.
Bound the total probe duration so it completes within the staging checker’s 10-second request budget.
Also at workers/control-api/worker.mjs:251, workers/control-api/worker.mjs:263.
Prompt for AI agents
In `workers/control-api/worker.mjs` at line 235:
**Staging validation aborts early**
When the sequential MCP handshake takes longer than the staging checker’s 10-second `/services` budget, `probeMcpServer` can spend up to 36 seconds on its three sequential requests, so `check-control-api-staging.mjs` aborts before the probe returns and reports the staging result as unverified or failed.
Bound the total probe duration so it completes within the staging checker’s 10-second request budget.
Also at `workers/control-api/worker.mjs:251`, `workers/control-api/worker.mjs:263`.| }; | ||
| } catch { | ||
| } catch (error) { | ||
| console.warn(JSON.stringify({ event: "control_api.mcp_probe_failed", errorType: error?.name || "Error" })); |
There was a problem hiding this comment.
🟡 Medium · Failed handshakes lack diagnostics
When the endpoint returns an HTTP error or an invalid handshake response, the HTTP-status and protocol-mismatch branches return unavailable or unknown without throwing, so they bypass the catch that logs control_api.mcp_probe_failed; callers see a failed probe without the failure diagnostic.
Emit the failure warning on the HTTP-status and protocol-mismatch return branches as well as in the catch.
Prompt for AI agents
In `workers/control-api/worker.mjs` at line 281:
**Failed handshakes lack diagnostics**
When the endpoint returns an HTTP error or an invalid handshake response, the HTTP-status and protocol-mismatch branches return `unavailable` or `unknown` without throwing, so they bypass the `catch` that logs `control_api.mcp_probe_failed`; callers see a failed probe without the failure diagnostic.
Emit the failure warning on the HTTP-status and protocol-mismatch return branches as well as in the `catch`.|
Deployment failed for project ocodejs.github.io with the following error: Learn More: https://vercel.com/ocodejs-co?upgradeToPro=build-rate-limit |
|
Deployment failed for project pages.ocodejs.theme with the following error: Learn More: https://vercel.com/ocodejs-co?upgradeToPro=build-rate-limit |
|
Deployment failed for project ocodejs.github.io with the following error: Learn More: https://vercel.com/ocodejs-co?upgradeToPro=build-rate-limit |
|
Deployment failed for project pages.ocodejs.theme with the following error: Learn More: https://vercel.com/ocodejs-co?upgradeToPro=build-rate-limit |
Summary
Staging deployment and verification
ocodejs-server-api-stagingin the Huynh Cloudflare account.MCP_SERVER→ocodejs-mcp-staging: healthy, MCP initialize/tools-list passed, 6 read-only tools discovered.CLI_AUTH→ocodejs-auth: healthy, internal health reports GitHub OAuth/PAT bindings configured.https://ocodejs.co: passed.Public Auth hostname remains unresolved
auth.ocodejs.devreturns HTTP 403 withcf-mitigated: challengebecause the activeocodejs.devzone is in Under Attack Mode.mcp-auth-ocodejs; the configured Auth backend with D1 and GitHub OAuth/PAT bindings is the separate Huynh-account Workerocodejs-auth.Identity/Auth.js portal, AI runtime, MCP manager, and queryable audit storage remain unconfigured; telemetry is degraded until its optional bindings/storage are attached.
No Production routing, DNS, secrets, or account-wide security settings changed. Keep unmerged pending review.