Skip to content

fix(runtime): fall back Responses relay discovery to /v1 - #3797

Open
Sandu1213 wants to merge 1 commit into
apache:mainfrom
Sandu1213:fix/responses-relay-api-base-url
Open

fix(runtime): fall back Responses relay discovery to /v1#3797
Sandu1213 wants to merge 1 commit into
apache:mainfrom
Sandu1213:fix/responses-relay-api-base-url

Conversation

@Sandu1213

@Sandu1213Sandu1213 commented Aug 25, 2026

Copy link
Copy Markdown

Summary

A custom OpenAI Responses relay configured with its host root can pass the connection probe at <root>/responses while publishing its model catalog at /v1/models. Discovery previously stopped after <root>/models returned 404, so the connection looked verified but its catalog never refreshed.

This revision preserves the configured API base as the primary contract and adds a narrow discovery fallback:

  1. Send and probe keep using the configured Responses endpoint.
  2. Discovery first requests <configured-base>/models.
  3. Only when a pathless root returns 404, discovery retries the same-origin /v1/models route once.
  4. Authorization, network, and invalid-response failures remain authoritative; no POST request is replayed.
  5. Endpoint-form overrides such as …/v1/responses are reduced to their API base before deriving …/v1/models.
configuredsend / probediscovery
http://relay.example:3000/responses/models, then /v1/models only after 404
https://relay.example/v1/v1/responses/v1/models
https://relay.example/v1/responses/v1/responses/v1/models
https://relay.example/relay/v1/relay/v1/responses/relay/v1/models

Fixes#3320

Compatibility and review response

This supersedes the earlier root → /v1 normalization and addresses the P2 compatibility review: persisted root-mounted relays continue to use /responses and /models exactly as before. The fallback is provider-scoped to openai-responses-compatible, same-origin, GET-only, 404-only, and attempted once. Built-in providers such as DeepSeek retain their unversioned root behavior.

Regression coverage now locks:

  • a root-mounted relay succeeds without any /v1 request;
  • a relay whose root /models route is absent falls back once to /v1/models while probe/send stay at /responses;
  • a 401 is not hidden behind the fallback;
  • endpoint-form and built-in-provider send behavior remain unchanged.

Verification

Passed:

  • npm --workspace @maka/core run build
  • npm --workspace @maka/runtime run build
  • node --test dist/__tests__/provider-conformance.test.js dist/__tests__/provider-contract-matrix.test.js dist/__tests__/responses-wire-contract.test.js in packages/runtime — 171 passed, 0 failed
  • npx biome check on the six touched source/test files — clean

The full npm --workspace @maka/runtime run test:dist run completed with 3 failures outside this PR's changed paths (3,129 passed, 13 skipped): two existing Responses-reasoning expectations and tool-catalog-derive.test.js, which currently cannot import the unexported @maka/core/tool-catalog subpath. The changed relay suites are green.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Opus 5 performed the original investigation and implementation. OpenAI Codex (GPT-5.6) traced the compatibility path, replaced the root-rewriting behavior with the 404-only discovery fallback, added the compatibility/error-boundary regressions, rebased the branch, and updated this PR. The author owns the submission.

Checklist

  • Tests cover the change and fail on the missing fallback
  • The affected package build, targeted suites, lint, and format checks pass

Does this PR entail a change in behavior?

  • Yes — described under Summary and Compatibility above
  • No

@Astro-HanAstro-Han 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.

I reviewed this head and found no blocking issues.

The relay base normalization now consistently heals bare roots to /v1 and strips trailing /responses at the endpoint, aligning probe, discovery, and send. Scoped only to openai-responses-compatible to avoid breaking built-in providers that serve both paths. Tests lock the five normalization cases.

No P0-P2. Checks on afb7b5d have no hosted report yet — not green.

简体中文该头未发现阻断。

@M4n5ter
M4n5terforce-pushed the fix/responses-relay-api-base-url branch 3 times, most recently from 5487df2 to fb95dc1CompareAugust 26, 2026 09:56
@github-actionsgithub-actionsBot added the effort/M Under 500 readable lines label Aug 27, 2026

@Astro-HanAstro-Han 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.

Thanks for working on the probe/discovery/send drift. I need to supersede my earlier review on afb7b5d: it missed the existing root-mounted custom-relay configuration described inline.

The single-base direction is sound, but choosing /v1 for every pathless custom relay is a product-contract change rather than a universally safe normalization. I’m leaving this as a P2 COMMENT—not a request for changes—but I would not approve until the intended compatibility behavior is explicit.

Exact head reviewed: fb95dc1a0f5136b5b1501e9123da01972fa31651. Hosted checks are green.

中文对照

需要纠正我在旧 head 上的结论:统一入口的方向正确,但把所有无路径 Relay 自动改成 /v1 会改变已有配置含义。这里定为 P2 Comment,不发 Request Changes,但建议先明确兼容契约再批准。

AI-assisted review: Codex traced the compatibility path and drafted this feedback; the maintainer verified the conclusion and severity.

return baseUrl;
}
const basePath = stripTrailing(url.pathname).replace(/\/responses$/i, '');
url.pathname = basePath === '' ? '/v1' : basePath;

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.

[P2] Preserve or explicitly migrate the existing root-mounted relay contract

Thanks for centralizing the URL derivation. This line does more than normalize equivalent spellings, though: a pathless custom Responses relay previously meant /responses and /models at the configured root, while it now always means /v1/responses and /v1/models.

Root-mounted custom relays are a valid existing configuration, so this silently breaks them on the normal send/discovery path. Please either preserve root semantics and use a deterministic /v1 fallback, or make /v1 the explicit product contract with migration/UI/documentation and a regression showing the old shape is intentionally unsupported.

Because this changes the meaning of persisted user configuration, a Discussion establishing the contract would also be preferable to treating it as an implementation-only correction.

中文对照

这里不只是统一 URL 写法,而是把已有的“根路径提供 /responses/models”配置重新解释成 /v1。这会直接破坏合法的现有自定义 Relay。建议保留根路径语义并确定性 fallback 到 /v1,或者明确迁移产品契约;这种行为变化最好先通过 Discussion 达成共识。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed in b8ff53a69 after rebasing onto the latest main.

The bare-root → /v1 rewrite is removed. A root-mounted relay remains authoritative for send, probe, and the first discovery request (/responses and /models). Only a 404 from that pathless root model route triggers one same-origin GET fallback to /v1/models; 401/network/invalid-response failures do not fall back, and POST requests are never replayed. Endpoint-form overrides still reduce to their API base for discovery.

Regression coverage now proves the existing root contract, the 404-only fallback, the authorization boundary, and unchanged DeepSeek root behavior. The PR title/body and verification notes have also been updated.

A root-mounted custom OpenAI Responses relay remains authoritative for send,
probe, and discovery. When only its root /models route returns 404, retry
discovery once at /v1/models; do not retry authorization failures or POST
requests.
Endpoint-form overrides still reduce to their API base before discovery, so
/v1/responses discovers through /v1/models without changing persisted root
semantics.
Refs apache#3320
Generated-by: Claude Opus 5
Generated-by: OpenAI Codex (GPT-5.6)
@Sandu1213
Sandu1213force-pushed the fix/responses-relay-api-base-url branch from fb95dc1 to b8ff53aCompareAugust 30, 2026 13:38
@Sandu1213Sandu1213 changed the title fix(runtime): resolve a Responses relay from one API basefix(runtime): fall back Responses relay discovery to /v1Aug 30, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/MUnder 500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom OpenAI Responses relay does not append /v1 when fetching models

2 participants

@Sandu1213@Astro-Han
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
fix(runtime): fall back Responses relay discovery to /v1 by Sandu1213 · Pull Request #3797 · apache/maka · GitHub
Skip to content

fix(runtime): fall back Responses relay discovery to /v1 - #3797

Open
Sandu1213 wants to merge 1 commit into
apache:mainfrom
Sandu1213:fix/responses-relay-api-base-url
Open

fix(runtime): fall back Responses relay discovery to /v1#3797
Sandu1213 wants to merge 1 commit into
apache:mainfrom
Sandu1213:fix/responses-relay-api-base-url

Conversation

@Sandu1213

@Sandu1213Sandu1213 commented Aug 25, 2026

Copy link
Copy Markdown

Summary

A custom OpenAI Responses relay configured with its host root can pass the connection probe at <root>/responses while publishing its model catalog at /v1/models. Discovery previously stopped after <root>/models returned 404, so the connection looked verified but its catalog never refreshed.

This revision preserves the configured API base as the primary contract and adds a narrow discovery fallback:

  1. Send and probe keep using the configured Responses endpoint.
  2. Discovery first requests <configured-base>/models.
  3. Only when a pathless root returns 404, discovery retries the same-origin /v1/models route once.
  4. Authorization, network, and invalid-response failures remain authoritative; no POST request is replayed.
  5. Endpoint-form overrides such as …/v1/responses are reduced to their API base before deriving …/v1/models.
configuredsend / probediscovery
http://relay.example:3000/responses/models, then /v1/models only after 404
https://relay.example/v1/v1/responses/v1/models
https://relay.example/v1/responses/v1/responses/v1/models
https://relay.example/relay/v1/relay/v1/responses/relay/v1/models

Fixes#3320

Compatibility and review response

This supersedes the earlier root → /v1 normalization and addresses the P2 compatibility review: persisted root-mounted relays continue to use /responses and /models exactly as before. The fallback is provider-scoped to openai-responses-compatible, same-origin, GET-only, 404-only, and attempted once. Built-in providers such as DeepSeek retain their unversioned root behavior.

Regression coverage now locks:

  • a root-mounted relay succeeds without any /v1 request;
  • a relay whose root /models route is absent falls back once to /v1/models while probe/send stay at /responses;
  • a 401 is not hidden behind the fallback;
  • endpoint-form and built-in-provider send behavior remain unchanged.

Verification

Passed:

  • npm --workspace @maka/core run build
  • npm --workspace @maka/runtime run build
  • node --test dist/__tests__/provider-conformance.test.js dist/__tests__/provider-contract-matrix.test.js dist/__tests__/responses-wire-contract.test.js in packages/runtime — 171 passed, 0 failed
  • npx biome check on the six touched source/test files — clean

The full npm --workspace @maka/runtime run test:dist run completed with 3 failures outside this PR's changed paths (3,129 passed, 13 skipped): two existing Responses-reasoning expectations and tool-catalog-derive.test.js, which currently cannot import the unexported @maka/core/tool-catalog subpath. The changed relay suites are green.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Opus 5 performed the original investigation and implementation. OpenAI Codex (GPT-5.6) traced the compatibility path, replaced the root-rewriting behavior with the 404-only discovery fallback, added the compatibility/error-boundary regressions, rebased the branch, and updated this PR. The author owns the submission.

Checklist

  • Tests cover the change and fail on the missing fallback
  • The affected package build, targeted suites, lint, and format checks pass

Does this PR entail a change in behavior?

  • Yes — described under Summary and Compatibility above
  • No

@Astro-HanAstro-Han 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.

I reviewed this head and found no blocking issues.

The relay base normalization now consistently heals bare roots to /v1 and strips trailing /responses at the endpoint, aligning probe, discovery, and send. Scoped only to openai-responses-compatible to avoid breaking built-in providers that serve both paths. Tests lock the five normalization cases.

No P0-P2. Checks on afb7b5d have no hosted report yet — not green.

简体中文该头未发现阻断。

@M4n5ter
M4n5terforce-pushed the fix/responses-relay-api-base-url branch 3 times, most recently from 5487df2 to fb95dc1CompareAugust 26, 2026 09:56
@github-actionsgithub-actionsBot added the effort/M Under 500 readable lines label Aug 27, 2026

@Astro-HanAstro-Han 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.

Thanks for working on the probe/discovery/send drift. I need to supersede my earlier review on afb7b5d: it missed the existing root-mounted custom-relay configuration described inline.

The single-base direction is sound, but choosing /v1 for every pathless custom relay is a product-contract change rather than a universally safe normalization. I’m leaving this as a P2 COMMENT—not a request for changes—but I would not approve until the intended compatibility behavior is explicit.

Exact head reviewed: fb95dc1a0f5136b5b1501e9123da01972fa31651. Hosted checks are green.

中文对照

需要纠正我在旧 head 上的结论:统一入口的方向正确,但把所有无路径 Relay 自动改成 /v1 会改变已有配置含义。这里定为 P2 Comment,不发 Request Changes,但建议先明确兼容契约再批准。

AI-assisted review: Codex traced the compatibility path and drafted this feedback; the maintainer verified the conclusion and severity.

return baseUrl;
}
const basePath = stripTrailing(url.pathname).replace(/\/responses$/i, '');
url.pathname = basePath === '' ? '/v1' : basePath;

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.

[P2] Preserve or explicitly migrate the existing root-mounted relay contract

Thanks for centralizing the URL derivation. This line does more than normalize equivalent spellings, though: a pathless custom Responses relay previously meant /responses and /models at the configured root, while it now always means /v1/responses and /v1/models.

Root-mounted custom relays are a valid existing configuration, so this silently breaks them on the normal send/discovery path. Please either preserve root semantics and use a deterministic /v1 fallback, or make /v1 the explicit product contract with migration/UI/documentation and a regression showing the old shape is intentionally unsupported.

Because this changes the meaning of persisted user configuration, a Discussion establishing the contract would also be preferable to treating it as an implementation-only correction.

中文对照

这里不只是统一 URL 写法,而是把已有的“根路径提供 /responses/models”配置重新解释成 /v1。这会直接破坏合法的现有自定义 Relay。建议保留根路径语义并确定性 fallback 到 /v1,或者明确迁移产品契约;这种行为变化最好先通过 Discussion 达成共识。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed in b8ff53a69 after rebasing onto the latest main.

The bare-root → /v1 rewrite is removed. A root-mounted relay remains authoritative for send, probe, and the first discovery request (/responses and /models). Only a 404 from that pathless root model route triggers one same-origin GET fallback to /v1/models; 401/network/invalid-response failures do not fall back, and POST requests are never replayed. Endpoint-form overrides still reduce to their API base for discovery.

Regression coverage now proves the existing root contract, the 404-only fallback, the authorization boundary, and unchanged DeepSeek root behavior. The PR title/body and verification notes have also been updated.

A root-mounted custom OpenAI Responses relay remains authoritative for send,
probe, and discovery. When only its root /models route returns 404, retry
discovery once at /v1/models; do not retry authorization failures or POST
requests.
Endpoint-form overrides still reduce to their API base before discovery, so
/v1/responses discovers through /v1/models without changing persisted root
semantics.
Refs apache#3320
Generated-by: Claude Opus 5
Generated-by: OpenAI Codex (GPT-5.6)
@Sandu1213
Sandu1213force-pushed the fix/responses-relay-api-base-url branch from fb95dc1 to b8ff53aCompareAugust 30, 2026 13:38
@Sandu1213Sandu1213 changed the title fix(runtime): resolve a Responses relay from one API basefix(runtime): fall back Responses relay discovery to /v1Aug 30, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/MUnder 500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom OpenAI Responses relay does not append /v1 when fetching models

2 participants

@Sandu1213@Astro-Han
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' fix(runtime): fall back Responses relay discovery to /v1 by Sandu1213 · Pull Request #3797 · apache/maka · GitHub
Skip to content

fix(runtime): fall back Responses relay discovery to /v1 - #3797

Open
Sandu1213 wants to merge 1 commit into
apache:mainfrom
Sandu1213:fix/responses-relay-api-base-url
Open

fix(runtime): fall back Responses relay discovery to /v1#3797
Sandu1213 wants to merge 1 commit into
apache:mainfrom
Sandu1213:fix/responses-relay-api-base-url

Conversation

@Sandu1213

@Sandu1213Sandu1213 commented Aug 25, 2026

Copy link
Copy Markdown

Summary

A custom OpenAI Responses relay configured with its host root can pass the connection probe at <root>/responses while publishing its model catalog at /v1/models. Discovery previously stopped after <root>/models returned 404, so the connection looked verified but its catalog never refreshed.

This revision preserves the configured API base as the primary contract and adds a narrow discovery fallback:

  1. Send and probe keep using the configured Responses endpoint.
  2. Discovery first requests <configured-base>/models.
  3. Only when a pathless root returns 404, discovery retries the same-origin /v1/models route once.
  4. Authorization, network, and invalid-response failures remain authoritative; no POST request is replayed.
  5. Endpoint-form overrides such as …/v1/responses are reduced to their API base before deriving …/v1/models.
configuredsend / probediscovery
http://relay.example:3000/responses/models, then /v1/models only after 404
https://relay.example/v1/v1/responses/v1/models
https://relay.example/v1/responses/v1/responses/v1/models
https://relay.example/relay/v1/relay/v1/responses/relay/v1/models

Fixes#3320

Compatibility and review response

This supersedes the earlier root → /v1 normalization and addresses the P2 compatibility review: persisted root-mounted relays continue to use /responses and /models exactly as before. The fallback is provider-scoped to openai-responses-compatible, same-origin, GET-only, 404-only, and attempted once. Built-in providers such as DeepSeek retain their unversioned root behavior.

Regression coverage now locks:

  • a root-mounted relay succeeds without any /v1 request;
  • a relay whose root /models route is absent falls back once to /v1/models while probe/send stay at /responses;
  • a 401 is not hidden behind the fallback;
  • endpoint-form and built-in-provider send behavior remain unchanged.

Verification

Passed:

  • npm --workspace @maka/core run build
  • npm --workspace @maka/runtime run build
  • node --test dist/__tests__/provider-conformance.test.js dist/__tests__/provider-contract-matrix.test.js dist/__tests__/responses-wire-contract.test.js in packages/runtime — 171 passed, 0 failed
  • npx biome check on the six touched source/test files — clean

The full npm --workspace @maka/runtime run test:dist run completed with 3 failures outside this PR's changed paths (3,129 passed, 13 skipped): two existing Responses-reasoning expectations and tool-catalog-derive.test.js, which currently cannot import the unexported @maka/core/tool-catalog subpath. The changed relay suites are green.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Opus 5 performed the original investigation and implementation. OpenAI Codex (GPT-5.6) traced the compatibility path, replaced the root-rewriting behavior with the 404-only discovery fallback, added the compatibility/error-boundary regressions, rebased the branch, and updated this PR. The author owns the submission.

Checklist

  • Tests cover the change and fail on the missing fallback
  • The affected package build, targeted suites, lint, and format checks pass

Does this PR entail a change in behavior?

  • Yes — described under Summary and Compatibility above
  • No

@Astro-HanAstro-Han 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.

I reviewed this head and found no blocking issues.

The relay base normalization now consistently heals bare roots to /v1 and strips trailing /responses at the endpoint, aligning probe, discovery, and send. Scoped only to openai-responses-compatible to avoid breaking built-in providers that serve both paths. Tests lock the five normalization cases.

No P0-P2. Checks on afb7b5d have no hosted report yet — not green.

简体中文该头未发现阻断。

@M4n5ter
M4n5terforce-pushed the fix/responses-relay-api-base-url branch 3 times, most recently from 5487df2 to fb95dc1CompareAugust 26, 2026 09:56
@github-actionsgithub-actionsBot added the effort/M Under 500 readable lines label Aug 27, 2026

@Astro-HanAstro-Han 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.

Thanks for working on the probe/discovery/send drift. I need to supersede my earlier review on afb7b5d: it missed the existing root-mounted custom-relay configuration described inline.

The single-base direction is sound, but choosing /v1 for every pathless custom relay is a product-contract change rather than a universally safe normalization. I’m leaving this as a P2 COMMENT—not a request for changes—but I would not approve until the intended compatibility behavior is explicit.

Exact head reviewed: fb95dc1a0f5136b5b1501e9123da01972fa31651. Hosted checks are green.

中文对照

需要纠正我在旧 head 上的结论:统一入口的方向正确,但把所有无路径 Relay 自动改成 /v1 会改变已有配置含义。这里定为 P2 Comment,不发 Request Changes,但建议先明确兼容契约再批准。

AI-assisted review: Codex traced the compatibility path and drafted this feedback; the maintainer verified the conclusion and severity.

return baseUrl;
}
const basePath = stripTrailing(url.pathname).replace(/\/responses$/i, '');
url.pathname = basePath === '' ? '/v1' : basePath;

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.

[P2] Preserve or explicitly migrate the existing root-mounted relay contract

Thanks for centralizing the URL derivation. This line does more than normalize equivalent spellings, though: a pathless custom Responses relay previously meant /responses and /models at the configured root, while it now always means /v1/responses and /v1/models.

Root-mounted custom relays are a valid existing configuration, so this silently breaks them on the normal send/discovery path. Please either preserve root semantics and use a deterministic /v1 fallback, or make /v1 the explicit product contract with migration/UI/documentation and a regression showing the old shape is intentionally unsupported.

Because this changes the meaning of persisted user configuration, a Discussion establishing the contract would also be preferable to treating it as an implementation-only correction.

中文对照

这里不只是统一 URL 写法,而是把已有的“根路径提供 /responses/models”配置重新解释成 /v1。这会直接破坏合法的现有自定义 Relay。建议保留根路径语义并确定性 fallback 到 /v1,或者明确迁移产品契约;这种行为变化最好先通过 Discussion 达成共识。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed in b8ff53a69 after rebasing onto the latest main.

The bare-root → /v1 rewrite is removed. A root-mounted relay remains authoritative for send, probe, and the first discovery request (/responses and /models). Only a 404 from that pathless root model route triggers one same-origin GET fallback to /v1/models; 401/network/invalid-response failures do not fall back, and POST requests are never replayed. Endpoint-form overrides still reduce to their API base for discovery.

Regression coverage now proves the existing root contract, the 404-only fallback, the authorization boundary, and unchanged DeepSeek root behavior. The PR title/body and verification notes have also been updated.

A root-mounted custom OpenAI Responses relay remains authoritative for send,
probe, and discovery. When only its root /models route returns 404, retry
discovery once at /v1/models; do not retry authorization failures or POST
requests.
Endpoint-form overrides still reduce to their API base before discovery, so
/v1/responses discovers through /v1/models without changing persisted root
semantics.
Refs apache#3320
Generated-by: Claude Opus 5
Generated-by: OpenAI Codex (GPT-5.6)
@Sandu1213
Sandu1213force-pushed the fix/responses-relay-api-base-url branch from fb95dc1 to b8ff53aCompareAugust 30, 2026 13:38
@Sandu1213Sandu1213 changed the title fix(runtime): resolve a Responses relay from one API basefix(runtime): fall back Responses relay discovery to /v1Aug 30, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/MUnder 500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom OpenAI Responses relay does not append /v1 when fetching models

2 participants

@Sandu1213@Astro-Han
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' fix(runtime): fall back Responses relay discovery to /v1 by Sandu1213 · Pull Request #3797 · apache/maka · GitHub
Skip to content

fix(runtime): fall back Responses relay discovery to /v1 - #3797

Open
Sandu1213 wants to merge 1 commit into
apache:mainfrom
Sandu1213:fix/responses-relay-api-base-url
Open

fix(runtime): fall back Responses relay discovery to /v1#3797
Sandu1213 wants to merge 1 commit into
apache:mainfrom
Sandu1213:fix/responses-relay-api-base-url

Conversation

@Sandu1213

@Sandu1213Sandu1213 commented Aug 25, 2026

Copy link
Copy Markdown

Summary

A custom OpenAI Responses relay configured with its host root can pass the connection probe at <root>/responses while publishing its model catalog at /v1/models. Discovery previously stopped after <root>/models returned 404, so the connection looked verified but its catalog never refreshed.

This revision preserves the configured API base as the primary contract and adds a narrow discovery fallback:

  1. Send and probe keep using the configured Responses endpoint.
  2. Discovery first requests <configured-base>/models.
  3. Only when a pathless root returns 404, discovery retries the same-origin /v1/models route once.
  4. Authorization, network, and invalid-response failures remain authoritative; no POST request is replayed.
  5. Endpoint-form overrides such as …/v1/responses are reduced to their API base before deriving …/v1/models.
configuredsend / probediscovery
http://relay.example:3000/responses/models, then /v1/models only after 404
https://relay.example/v1/v1/responses/v1/models
https://relay.example/v1/responses/v1/responses/v1/models
https://relay.example/relay/v1/relay/v1/responses/relay/v1/models

Fixes#3320

Compatibility and review response

This supersedes the earlier root → /v1 normalization and addresses the P2 compatibility review: persisted root-mounted relays continue to use /responses and /models exactly as before. The fallback is provider-scoped to openai-responses-compatible, same-origin, GET-only, 404-only, and attempted once. Built-in providers such as DeepSeek retain their unversioned root behavior.

Regression coverage now locks:

  • a root-mounted relay succeeds without any /v1 request;
  • a relay whose root /models route is absent falls back once to /v1/models while probe/send stay at /responses;
  • a 401 is not hidden behind the fallback;
  • endpoint-form and built-in-provider send behavior remain unchanged.

Verification

Passed:

  • npm --workspace @maka/core run build
  • npm --workspace @maka/runtime run build
  • node --test dist/__tests__/provider-conformance.test.js dist/__tests__/provider-contract-matrix.test.js dist/__tests__/responses-wire-contract.test.js in packages/runtime — 171 passed, 0 failed
  • npx biome check on the six touched source/test files — clean

The full npm --workspace @maka/runtime run test:dist run completed with 3 failures outside this PR's changed paths (3,129 passed, 13 skipped): two existing Responses-reasoning expectations and tool-catalog-derive.test.js, which currently cannot import the unexported @maka/core/tool-catalog subpath. The changed relay suites are green.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Opus 5 performed the original investigation and implementation. OpenAI Codex (GPT-5.6) traced the compatibility path, replaced the root-rewriting behavior with the 404-only discovery fallback, added the compatibility/error-boundary regressions, rebased the branch, and updated this PR. The author owns the submission.

Checklist

  • Tests cover the change and fail on the missing fallback
  • The affected package build, targeted suites, lint, and format checks pass

Does this PR entail a change in behavior?

  • Yes — described under Summary and Compatibility above
  • No

@Astro-HanAstro-Han 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.

I reviewed this head and found no blocking issues.

The relay base normalization now consistently heals bare roots to /v1 and strips trailing /responses at the endpoint, aligning probe, discovery, and send. Scoped only to openai-responses-compatible to avoid breaking built-in providers that serve both paths. Tests lock the five normalization cases.

No P0-P2. Checks on afb7b5d have no hosted report yet — not green.

简体中文该头未发现阻断。

@M4n5ter
M4n5terforce-pushed the fix/responses-relay-api-base-url branch 3 times, most recently from 5487df2 to fb95dc1CompareAugust 26, 2026 09:56
@github-actionsgithub-actionsBot added the effort/M Under 500 readable lines label Aug 27, 2026

@Astro-HanAstro-Han 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.

Thanks for working on the probe/discovery/send drift. I need to supersede my earlier review on afb7b5d: it missed the existing root-mounted custom-relay configuration described inline.

The single-base direction is sound, but choosing /v1 for every pathless custom relay is a product-contract change rather than a universally safe normalization. I’m leaving this as a P2 COMMENT—not a request for changes—but I would not approve until the intended compatibility behavior is explicit.

Exact head reviewed: fb95dc1a0f5136b5b1501e9123da01972fa31651. Hosted checks are green.

中文对照

需要纠正我在旧 head 上的结论:统一入口的方向正确,但把所有无路径 Relay 自动改成 /v1 会改变已有配置含义。这里定为 P2 Comment,不发 Request Changes,但建议先明确兼容契约再批准。

AI-assisted review: Codex traced the compatibility path and drafted this feedback; the maintainer verified the conclusion and severity.

return baseUrl;
}
const basePath = stripTrailing(url.pathname).replace(/\/responses$/i, '');
url.pathname = basePath === '' ? '/v1' : basePath;

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.

[P2] Preserve or explicitly migrate the existing root-mounted relay contract

Thanks for centralizing the URL derivation. This line does more than normalize equivalent spellings, though: a pathless custom Responses relay previously meant /responses and /models at the configured root, while it now always means /v1/responses and /v1/models.

Root-mounted custom relays are a valid existing configuration, so this silently breaks them on the normal send/discovery path. Please either preserve root semantics and use a deterministic /v1 fallback, or make /v1 the explicit product contract with migration/UI/documentation and a regression showing the old shape is intentionally unsupported.

Because this changes the meaning of persisted user configuration, a Discussion establishing the contract would also be preferable to treating it as an implementation-only correction.

中文对照

这里不只是统一 URL 写法,而是把已有的“根路径提供 /responses/models”配置重新解释成 /v1。这会直接破坏合法的现有自定义 Relay。建议保留根路径语义并确定性 fallback 到 /v1,或者明确迁移产品契约;这种行为变化最好先通过 Discussion 达成共识。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed in b8ff53a69 after rebasing onto the latest main.

The bare-root → /v1 rewrite is removed. A root-mounted relay remains authoritative for send, probe, and the first discovery request (/responses and /models). Only a 404 from that pathless root model route triggers one same-origin GET fallback to /v1/models; 401/network/invalid-response failures do not fall back, and POST requests are never replayed. Endpoint-form overrides still reduce to their API base for discovery.

Regression coverage now proves the existing root contract, the 404-only fallback, the authorization boundary, and unchanged DeepSeek root behavior. The PR title/body and verification notes have also been updated.

A root-mounted custom OpenAI Responses relay remains authoritative for send,
probe, and discovery. When only its root /models route returns 404, retry
discovery once at /v1/models; do not retry authorization failures or POST
requests.
Endpoint-form overrides still reduce to their API base before discovery, so
/v1/responses discovers through /v1/models without changing persisted root
semantics.
Refs apache#3320
Generated-by: Claude Opus 5
Generated-by: OpenAI Codex (GPT-5.6)
@Sandu1213
Sandu1213force-pushed the fix/responses-relay-api-base-url branch from fb95dc1 to b8ff53aCompareAugust 30, 2026 13:38
@Sandu1213Sandu1213 changed the title fix(runtime): resolve a Responses relay from one API basefix(runtime): fall back Responses relay discovery to /v1Aug 30, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/MUnder 500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom OpenAI Responses relay does not append /v1 when fetching models

2 participants

@Sandu1213@Astro-Han
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' fix(runtime): fall back Responses relay discovery to /v1 by Sandu1213 · Pull Request #3797 · apache/maka · GitHub
Skip to content

fix(runtime): fall back Responses relay discovery to /v1 - #3797

Open
Sandu1213 wants to merge 1 commit into
apache:mainfrom
Sandu1213:fix/responses-relay-api-base-url
Open

fix(runtime): fall back Responses relay discovery to /v1#3797
Sandu1213 wants to merge 1 commit into
apache:mainfrom
Sandu1213:fix/responses-relay-api-base-url

Conversation

@Sandu1213

@Sandu1213Sandu1213 commented Aug 25, 2026

Copy link
Copy Markdown

Summary

A custom OpenAI Responses relay configured with its host root can pass the connection probe at <root>/responses while publishing its model catalog at /v1/models. Discovery previously stopped after <root>/models returned 404, so the connection looked verified but its catalog never refreshed.

This revision preserves the configured API base as the primary contract and adds a narrow discovery fallback:

  1. Send and probe keep using the configured Responses endpoint.
  2. Discovery first requests <configured-base>/models.
  3. Only when a pathless root returns 404, discovery retries the same-origin /v1/models route once.
  4. Authorization, network, and invalid-response failures remain authoritative; no POST request is replayed.
  5. Endpoint-form overrides such as …/v1/responses are reduced to their API base before deriving …/v1/models.
configuredsend / probediscovery
http://relay.example:3000/responses/models, then /v1/models only after 404
https://relay.example/v1/v1/responses/v1/models
https://relay.example/v1/responses/v1/responses/v1/models
https://relay.example/relay/v1/relay/v1/responses/relay/v1/models

Fixes#3320

Compatibility and review response

This supersedes the earlier root → /v1 normalization and addresses the P2 compatibility review: persisted root-mounted relays continue to use /responses and /models exactly as before. The fallback is provider-scoped to openai-responses-compatible, same-origin, GET-only, 404-only, and attempted once. Built-in providers such as DeepSeek retain their unversioned root behavior.

Regression coverage now locks:

  • a root-mounted relay succeeds without any /v1 request;
  • a relay whose root /models route is absent falls back once to /v1/models while probe/send stay at /responses;
  • a 401 is not hidden behind the fallback;
  • endpoint-form and built-in-provider send behavior remain unchanged.

Verification

Passed:

  • npm --workspace @maka/core run build
  • npm --workspace @maka/runtime run build
  • node --test dist/__tests__/provider-conformance.test.js dist/__tests__/provider-contract-matrix.test.js dist/__tests__/responses-wire-contract.test.js in packages/runtime — 171 passed, 0 failed
  • npx biome check on the six touched source/test files — clean

The full npm --workspace @maka/runtime run test:dist run completed with 3 failures outside this PR's changed paths (3,129 passed, 13 skipped): two existing Responses-reasoning expectations and tool-catalog-derive.test.js, which currently cannot import the unexported @maka/core/tool-catalog subpath. The changed relay suites are green.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Opus 5 performed the original investigation and implementation. OpenAI Codex (GPT-5.6) traced the compatibility path, replaced the root-rewriting behavior with the 404-only discovery fallback, added the compatibility/error-boundary regressions, rebased the branch, and updated this PR. The author owns the submission.

Checklist

  • Tests cover the change and fail on the missing fallback
  • The affected package build, targeted suites, lint, and format checks pass

Does this PR entail a change in behavior?

  • Yes — described under Summary and Compatibility above
  • No

@Astro-HanAstro-Han 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.

I reviewed this head and found no blocking issues.

The relay base normalization now consistently heals bare roots to /v1 and strips trailing /responses at the endpoint, aligning probe, discovery, and send. Scoped only to openai-responses-compatible to avoid breaking built-in providers that serve both paths. Tests lock the five normalization cases.

No P0-P2. Checks on afb7b5d have no hosted report yet — not green.

简体中文该头未发现阻断。

@M4n5ter
M4n5terforce-pushed the fix/responses-relay-api-base-url branch 3 times, most recently from 5487df2 to fb95dc1CompareAugust 26, 2026 09:56
@github-actionsgithub-actionsBot added the effort/M Under 500 readable lines label Aug 27, 2026

@Astro-HanAstro-Han 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.

Thanks for working on the probe/discovery/send drift. I need to supersede my earlier review on afb7b5d: it missed the existing root-mounted custom-relay configuration described inline.

The single-base direction is sound, but choosing /v1 for every pathless custom relay is a product-contract change rather than a universally safe normalization. I’m leaving this as a P2 COMMENT—not a request for changes—but I would not approve until the intended compatibility behavior is explicit.

Exact head reviewed: fb95dc1a0f5136b5b1501e9123da01972fa31651. Hosted checks are green.

中文对照

需要纠正我在旧 head 上的结论:统一入口的方向正确,但把所有无路径 Relay 自动改成 /v1 会改变已有配置含义。这里定为 P2 Comment,不发 Request Changes,但建议先明确兼容契约再批准。

AI-assisted review: Codex traced the compatibility path and drafted this feedback; the maintainer verified the conclusion and severity.

return baseUrl;
}
const basePath = stripTrailing(url.pathname).replace(/\/responses$/i, '');
url.pathname = basePath === '' ? '/v1' : basePath;

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.

[P2] Preserve or explicitly migrate the existing root-mounted relay contract

Thanks for centralizing the URL derivation. This line does more than normalize equivalent spellings, though: a pathless custom Responses relay previously meant /responses and /models at the configured root, while it now always means /v1/responses and /v1/models.

Root-mounted custom relays are a valid existing configuration, so this silently breaks them on the normal send/discovery path. Please either preserve root semantics and use a deterministic /v1 fallback, or make /v1 the explicit product contract with migration/UI/documentation and a regression showing the old shape is intentionally unsupported.

Because this changes the meaning of persisted user configuration, a Discussion establishing the contract would also be preferable to treating it as an implementation-only correction.

中文对照

这里不只是统一 URL 写法,而是把已有的“根路径提供 /responses/models”配置重新解释成 /v1。这会直接破坏合法的现有自定义 Relay。建议保留根路径语义并确定性 fallback 到 /v1,或者明确迁移产品契约;这种行为变化最好先通过 Discussion 达成共识。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed in b8ff53a69 after rebasing onto the latest main.

The bare-root → /v1 rewrite is removed. A root-mounted relay remains authoritative for send, probe, and the first discovery request (/responses and /models). Only a 404 from that pathless root model route triggers one same-origin GET fallback to /v1/models; 401/network/invalid-response failures do not fall back, and POST requests are never replayed. Endpoint-form overrides still reduce to their API base for discovery.

Regression coverage now proves the existing root contract, the 404-only fallback, the authorization boundary, and unchanged DeepSeek root behavior. The PR title/body and verification notes have also been updated.

A root-mounted custom OpenAI Responses relay remains authoritative for send,
probe, and discovery. When only its root /models route returns 404, retry
discovery once at /v1/models; do not retry authorization failures or POST
requests.
Endpoint-form overrides still reduce to their API base before discovery, so
/v1/responses discovers through /v1/models without changing persisted root
semantics.
Refs apache#3320
Generated-by: Claude Opus 5
Generated-by: OpenAI Codex (GPT-5.6)
@Sandu1213
Sandu1213force-pushed the fix/responses-relay-api-base-url branch from fb95dc1 to b8ff53aCompareAugust 30, 2026 13:38
@Sandu1213Sandu1213 changed the title fix(runtime): resolve a Responses relay from one API basefix(runtime): fall back Responses relay discovery to /v1Aug 30, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/MUnder 500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom OpenAI Responses relay does not append /v1 when fetching models

2 participants

@Sandu1213@Astro-Han
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' fix(runtime): fall back Responses relay discovery to /v1 by Sandu1213 · Pull Request #3797 · apache/maka · GitHub
Skip to content

fix(runtime): fall back Responses relay discovery to /v1 - #3797

Open
Sandu1213 wants to merge 1 commit into
apache:mainfrom
Sandu1213:fix/responses-relay-api-base-url
Open

fix(runtime): fall back Responses relay discovery to /v1#3797
Sandu1213 wants to merge 1 commit into
apache:mainfrom
Sandu1213:fix/responses-relay-api-base-url

Conversation

@Sandu1213

@Sandu1213Sandu1213 commented Aug 25, 2026

Copy link
Copy Markdown

Summary

A custom OpenAI Responses relay configured with its host root can pass the connection probe at <root>/responses while publishing its model catalog at /v1/models. Discovery previously stopped after <root>/models returned 404, so the connection looked verified but its catalog never refreshed.

This revision preserves the configured API base as the primary contract and adds a narrow discovery fallback:

  1. Send and probe keep using the configured Responses endpoint.
  2. Discovery first requests <configured-base>/models.
  3. Only when a pathless root returns 404, discovery retries the same-origin /v1/models route once.
  4. Authorization, network, and invalid-response failures remain authoritative; no POST request is replayed.
  5. Endpoint-form overrides such as …/v1/responses are reduced to their API base before deriving …/v1/models.
configuredsend / probediscovery
http://relay.example:3000/responses/models, then /v1/models only after 404
https://relay.example/v1/v1/responses/v1/models
https://relay.example/v1/responses/v1/responses/v1/models
https://relay.example/relay/v1/relay/v1/responses/relay/v1/models

Fixes#3320

Compatibility and review response

This supersedes the earlier root → /v1 normalization and addresses the P2 compatibility review: persisted root-mounted relays continue to use /responses and /models exactly as before. The fallback is provider-scoped to openai-responses-compatible, same-origin, GET-only, 404-only, and attempted once. Built-in providers such as DeepSeek retain their unversioned root behavior.

Regression coverage now locks:

  • a root-mounted relay succeeds without any /v1 request;
  • a relay whose root /models route is absent falls back once to /v1/models while probe/send stay at /responses;
  • a 401 is not hidden behind the fallback;
  • endpoint-form and built-in-provider send behavior remain unchanged.

Verification

Passed:

  • npm --workspace @maka/core run build
  • npm --workspace @maka/runtime run build
  • node --test dist/__tests__/provider-conformance.test.js dist/__tests__/provider-contract-matrix.test.js dist/__tests__/responses-wire-contract.test.js in packages/runtime — 171 passed, 0 failed
  • npx biome check on the six touched source/test files — clean

The full npm --workspace @maka/runtime run test:dist run completed with 3 failures outside this PR's changed paths (3,129 passed, 13 skipped): two existing Responses-reasoning expectations and tool-catalog-derive.test.js, which currently cannot import the unexported @maka/core/tool-catalog subpath. The changed relay suites are green.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Opus 5 performed the original investigation and implementation. OpenAI Codex (GPT-5.6) traced the compatibility path, replaced the root-rewriting behavior with the 404-only discovery fallback, added the compatibility/error-boundary regressions, rebased the branch, and updated this PR. The author owns the submission.

Checklist

  • Tests cover the change and fail on the missing fallback
  • The affected package build, targeted suites, lint, and format checks pass

Does this PR entail a change in behavior?

  • Yes — described under Summary and Compatibility above
  • No

@Astro-HanAstro-Han 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.

I reviewed this head and found no blocking issues.

The relay base normalization now consistently heals bare roots to /v1 and strips trailing /responses at the endpoint, aligning probe, discovery, and send. Scoped only to openai-responses-compatible to avoid breaking built-in providers that serve both paths. Tests lock the five normalization cases.

No P0-P2. Checks on afb7b5d have no hosted report yet — not green.

简体中文该头未发现阻断。

@M4n5ter
M4n5terforce-pushed the fix/responses-relay-api-base-url branch 3 times, most recently from 5487df2 to fb95dc1CompareAugust 26, 2026 09:56
@github-actionsgithub-actionsBot added the effort/M Under 500 readable lines label Aug 27, 2026

@Astro-HanAstro-Han 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.

Thanks for working on the probe/discovery/send drift. I need to supersede my earlier review on afb7b5d: it missed the existing root-mounted custom-relay configuration described inline.

The single-base direction is sound, but choosing /v1 for every pathless custom relay is a product-contract change rather than a universally safe normalization. I’m leaving this as a P2 COMMENT—not a request for changes—but I would not approve until the intended compatibility behavior is explicit.

Exact head reviewed: fb95dc1a0f5136b5b1501e9123da01972fa31651. Hosted checks are green.

中文对照

需要纠正我在旧 head 上的结论:统一入口的方向正确,但把所有无路径 Relay 自动改成 /v1 会改变已有配置含义。这里定为 P2 Comment,不发 Request Changes,但建议先明确兼容契约再批准。

AI-assisted review: Codex traced the compatibility path and drafted this feedback; the maintainer verified the conclusion and severity.

return baseUrl;
}
const basePath = stripTrailing(url.pathname).replace(/\/responses$/i, '');
url.pathname = basePath === '' ? '/v1' : basePath;

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.

[P2] Preserve or explicitly migrate the existing root-mounted relay contract

Thanks for centralizing the URL derivation. This line does more than normalize equivalent spellings, though: a pathless custom Responses relay previously meant /responses and /models at the configured root, while it now always means /v1/responses and /v1/models.

Root-mounted custom relays are a valid existing configuration, so this silently breaks them on the normal send/discovery path. Please either preserve root semantics and use a deterministic /v1 fallback, or make /v1 the explicit product contract with migration/UI/documentation and a regression showing the old shape is intentionally unsupported.

Because this changes the meaning of persisted user configuration, a Discussion establishing the contract would also be preferable to treating it as an implementation-only correction.

中文对照

这里不只是统一 URL 写法,而是把已有的“根路径提供 /responses/models”配置重新解释成 /v1。这会直接破坏合法的现有自定义 Relay。建议保留根路径语义并确定性 fallback 到 /v1,或者明确迁移产品契约;这种行为变化最好先通过 Discussion 达成共识。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed in b8ff53a69 after rebasing onto the latest main.

The bare-root → /v1 rewrite is removed. A root-mounted relay remains authoritative for send, probe, and the first discovery request (/responses and /models). Only a 404 from that pathless root model route triggers one same-origin GET fallback to /v1/models; 401/network/invalid-response failures do not fall back, and POST requests are never replayed. Endpoint-form overrides still reduce to their API base for discovery.

Regression coverage now proves the existing root contract, the 404-only fallback, the authorization boundary, and unchanged DeepSeek root behavior. The PR title/body and verification notes have also been updated.

A root-mounted custom OpenAI Responses relay remains authoritative for send,
probe, and discovery. When only its root /models route returns 404, retry
discovery once at /v1/models; do not retry authorization failures or POST
requests.
Endpoint-form overrides still reduce to their API base before discovery, so
/v1/responses discovers through /v1/models without changing persisted root
semantics.
Refs apache#3320
Generated-by: Claude Opus 5
Generated-by: OpenAI Codex (GPT-5.6)
@Sandu1213
Sandu1213force-pushed the fix/responses-relay-api-base-url branch from fb95dc1 to b8ff53aCompareAugust 30, 2026 13:38
@Sandu1213Sandu1213 changed the title fix(runtime): resolve a Responses relay from one API basefix(runtime): fall back Responses relay discovery to /v1Aug 30, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/MUnder 500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom OpenAI Responses relay does not append /v1 when fetching models

2 participants

@Sandu1213@Astro-Han
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' fix(runtime): fall back Responses relay discovery to /v1 by Sandu1213 · Pull Request #3797 · apache/maka · GitHub
Skip to content

fix(runtime): fall back Responses relay discovery to /v1 - #3797

Open
Sandu1213 wants to merge 1 commit into
apache:mainfrom
Sandu1213:fix/responses-relay-api-base-url
Open

fix(runtime): fall back Responses relay discovery to /v1#3797
Sandu1213 wants to merge 1 commit into
apache:mainfrom
Sandu1213:fix/responses-relay-api-base-url

Conversation

@Sandu1213

@Sandu1213Sandu1213 commented Aug 25, 2026

Copy link
Copy Markdown

Summary

A custom OpenAI Responses relay configured with its host root can pass the connection probe at <root>/responses while publishing its model catalog at /v1/models. Discovery previously stopped after <root>/models returned 404, so the connection looked verified but its catalog never refreshed.

This revision preserves the configured API base as the primary contract and adds a narrow discovery fallback:

  1. Send and probe keep using the configured Responses endpoint.
  2. Discovery first requests <configured-base>/models.
  3. Only when a pathless root returns 404, discovery retries the same-origin /v1/models route once.
  4. Authorization, network, and invalid-response failures remain authoritative; no POST request is replayed.
  5. Endpoint-form overrides such as …/v1/responses are reduced to their API base before deriving …/v1/models.
configuredsend / probediscovery
http://relay.example:3000/responses/models, then /v1/models only after 404
https://relay.example/v1/v1/responses/v1/models
https://relay.example/v1/responses/v1/responses/v1/models
https://relay.example/relay/v1/relay/v1/responses/relay/v1/models

Fixes#3320

Compatibility and review response

This supersedes the earlier root → /v1 normalization and addresses the P2 compatibility review: persisted root-mounted relays continue to use /responses and /models exactly as before. The fallback is provider-scoped to openai-responses-compatible, same-origin, GET-only, 404-only, and attempted once. Built-in providers such as DeepSeek retain their unversioned root behavior.

Regression coverage now locks:

  • a root-mounted relay succeeds without any /v1 request;
  • a relay whose root /models route is absent falls back once to /v1/models while probe/send stay at /responses;
  • a 401 is not hidden behind the fallback;
  • endpoint-form and built-in-provider send behavior remain unchanged.

Verification

Passed:

  • npm --workspace @maka/core run build
  • npm --workspace @maka/runtime run build
  • node --test dist/__tests__/provider-conformance.test.js dist/__tests__/provider-contract-matrix.test.js dist/__tests__/responses-wire-contract.test.js in packages/runtime — 171 passed, 0 failed
  • npx biome check on the six touched source/test files — clean

The full npm --workspace @maka/runtime run test:dist run completed with 3 failures outside this PR's changed paths (3,129 passed, 13 skipped): two existing Responses-reasoning expectations and tool-catalog-derive.test.js, which currently cannot import the unexported @maka/core/tool-catalog subpath. The changed relay suites are green.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Opus 5 performed the original investigation and implementation. OpenAI Codex (GPT-5.6) traced the compatibility path, replaced the root-rewriting behavior with the 404-only discovery fallback, added the compatibility/error-boundary regressions, rebased the branch, and updated this PR. The author owns the submission.

Checklist

  • Tests cover the change and fail on the missing fallback
  • The affected package build, targeted suites, lint, and format checks pass

Does this PR entail a change in behavior?

  • Yes — described under Summary and Compatibility above
  • No

@Astro-HanAstro-Han 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.

I reviewed this head and found no blocking issues.

The relay base normalization now consistently heals bare roots to /v1 and strips trailing /responses at the endpoint, aligning probe, discovery, and send. Scoped only to openai-responses-compatible to avoid breaking built-in providers that serve both paths. Tests lock the five normalization cases.

No P0-P2. Checks on afb7b5d have no hosted report yet — not green.

简体中文该头未发现阻断。

@M4n5ter
M4n5terforce-pushed the fix/responses-relay-api-base-url branch 3 times, most recently from 5487df2 to fb95dc1CompareAugust 26, 2026 09:56
@github-actionsgithub-actionsBot added the effort/M Under 500 readable lines label Aug 27, 2026

@Astro-HanAstro-Han 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.

Thanks for working on the probe/discovery/send drift. I need to supersede my earlier review on afb7b5d: it missed the existing root-mounted custom-relay configuration described inline.

The single-base direction is sound, but choosing /v1 for every pathless custom relay is a product-contract change rather than a universally safe normalization. I’m leaving this as a P2 COMMENT—not a request for changes—but I would not approve until the intended compatibility behavior is explicit.

Exact head reviewed: fb95dc1a0f5136b5b1501e9123da01972fa31651. Hosted checks are green.

中文对照

需要纠正我在旧 head 上的结论:统一入口的方向正确,但把所有无路径 Relay 自动改成 /v1 会改变已有配置含义。这里定为 P2 Comment,不发 Request Changes,但建议先明确兼容契约再批准。

AI-assisted review: Codex traced the compatibility path and drafted this feedback; the maintainer verified the conclusion and severity.

return baseUrl;
}
const basePath = stripTrailing(url.pathname).replace(/\/responses$/i, '');
url.pathname = basePath === '' ? '/v1' : basePath;

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.

[P2] Preserve or explicitly migrate the existing root-mounted relay contract

Thanks for centralizing the URL derivation. This line does more than normalize equivalent spellings, though: a pathless custom Responses relay previously meant /responses and /models at the configured root, while it now always means /v1/responses and /v1/models.

Root-mounted custom relays are a valid existing configuration, so this silently breaks them on the normal send/discovery path. Please either preserve root semantics and use a deterministic /v1 fallback, or make /v1 the explicit product contract with migration/UI/documentation and a regression showing the old shape is intentionally unsupported.

Because this changes the meaning of persisted user configuration, a Discussion establishing the contract would also be preferable to treating it as an implementation-only correction.

中文对照

这里不只是统一 URL 写法,而是把已有的“根路径提供 /responses/models”配置重新解释成 /v1。这会直接破坏合法的现有自定义 Relay。建议保留根路径语义并确定性 fallback 到 /v1,或者明确迁移产品契约;这种行为变化最好先通过 Discussion 达成共识。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed in b8ff53a69 after rebasing onto the latest main.

The bare-root → /v1 rewrite is removed. A root-mounted relay remains authoritative for send, probe, and the first discovery request (/responses and /models). Only a 404 from that pathless root model route triggers one same-origin GET fallback to /v1/models; 401/network/invalid-response failures do not fall back, and POST requests are never replayed. Endpoint-form overrides still reduce to their API base for discovery.

Regression coverage now proves the existing root contract, the 404-only fallback, the authorization boundary, and unchanged DeepSeek root behavior. The PR title/body and verification notes have also been updated.

A root-mounted custom OpenAI Responses relay remains authoritative for send,
probe, and discovery. When only its root /models route returns 404, retry
discovery once at /v1/models; do not retry authorization failures or POST
requests.
Endpoint-form overrides still reduce to their API base before discovery, so
/v1/responses discovers through /v1/models without changing persisted root
semantics.
Refs apache#3320
Generated-by: Claude Opus 5
Generated-by: OpenAI Codex (GPT-5.6)
@Sandu1213
Sandu1213force-pushed the fix/responses-relay-api-base-url branch from fb95dc1 to b8ff53aCompareAugust 30, 2026 13:38
@Sandu1213Sandu1213 changed the title fix(runtime): resolve a Responses relay from one API basefix(runtime): fall back Responses relay discovery to /v1Aug 30, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/MUnder 500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom OpenAI Responses relay does not append /v1 when fetching models

2 participants

@Sandu1213@Astro-Han
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); fix(runtime): fall back Responses relay discovery to /v1 by Sandu1213 · Pull Request #3797 · apache/maka · GitHub
Skip to content

fix(runtime): fall back Responses relay discovery to /v1 - #3797

Open
Sandu1213 wants to merge 1 commit into
apache:mainfrom
Sandu1213:fix/responses-relay-api-base-url
Open

fix(runtime): fall back Responses relay discovery to /v1#3797
Sandu1213 wants to merge 1 commit into
apache:mainfrom
Sandu1213:fix/responses-relay-api-base-url

Conversation

@Sandu1213

@Sandu1213Sandu1213 commented Aug 25, 2026

Copy link
Copy Markdown

Summary

A custom OpenAI Responses relay configured with its host root can pass the connection probe at <root>/responses while publishing its model catalog at /v1/models. Discovery previously stopped after <root>/models returned 404, so the connection looked verified but its catalog never refreshed.

This revision preserves the configured API base as the primary contract and adds a narrow discovery fallback:

  1. Send and probe keep using the configured Responses endpoint.
  2. Discovery first requests <configured-base>/models.
  3. Only when a pathless root returns 404, discovery retries the same-origin /v1/models route once.
  4. Authorization, network, and invalid-response failures remain authoritative; no POST request is replayed.
  5. Endpoint-form overrides such as …/v1/responses are reduced to their API base before deriving …/v1/models.
configuredsend / probediscovery
http://relay.example:3000/responses/models, then /v1/models only after 404
https://relay.example/v1/v1/responses/v1/models
https://relay.example/v1/responses/v1/responses/v1/models
https://relay.example/relay/v1/relay/v1/responses/relay/v1/models

Fixes#3320

Compatibility and review response

This supersedes the earlier root → /v1 normalization and addresses the P2 compatibility review: persisted root-mounted relays continue to use /responses and /models exactly as before. The fallback is provider-scoped to openai-responses-compatible, same-origin, GET-only, 404-only, and attempted once. Built-in providers such as DeepSeek retain their unversioned root behavior.

Regression coverage now locks:

  • a root-mounted relay succeeds without any /v1 request;
  • a relay whose root /models route is absent falls back once to /v1/models while probe/send stay at /responses;
  • a 401 is not hidden behind the fallback;
  • endpoint-form and built-in-provider send behavior remain unchanged.

Verification

Passed:

  • npm --workspace @maka/core run build
  • npm --workspace @maka/runtime run build
  • node --test dist/__tests__/provider-conformance.test.js dist/__tests__/provider-contract-matrix.test.js dist/__tests__/responses-wire-contract.test.js in packages/runtime — 171 passed, 0 failed
  • npx biome check on the six touched source/test files — clean

The full npm --workspace @maka/runtime run test:dist run completed with 3 failures outside this PR's changed paths (3,129 passed, 13 skipped): two existing Responses-reasoning expectations and tool-catalog-derive.test.js, which currently cannot import the unexported @maka/core/tool-catalog subpath. The changed relay suites are green.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Opus 5 performed the original investigation and implementation. OpenAI Codex (GPT-5.6) traced the compatibility path, replaced the root-rewriting behavior with the 404-only discovery fallback, added the compatibility/error-boundary regressions, rebased the branch, and updated this PR. The author owns the submission.

Checklist

  • Tests cover the change and fail on the missing fallback
  • The affected package build, targeted suites, lint, and format checks pass

Does this PR entail a change in behavior?

  • Yes — described under Summary and Compatibility above
  • No

@Astro-HanAstro-Han 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.

I reviewed this head and found no blocking issues.

The relay base normalization now consistently heals bare roots to /v1 and strips trailing /responses at the endpoint, aligning probe, discovery, and send. Scoped only to openai-responses-compatible to avoid breaking built-in providers that serve both paths. Tests lock the five normalization cases.

No P0-P2. Checks on afb7b5d have no hosted report yet — not green.

简体中文该头未发现阻断。

@M4n5ter
M4n5terforce-pushed the fix/responses-relay-api-base-url branch 3 times, most recently from 5487df2 to fb95dc1CompareAugust 26, 2026 09:56
@github-actionsgithub-actionsBot added the effort/M Under 500 readable lines label Aug 27, 2026

@Astro-HanAstro-Han 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.

Thanks for working on the probe/discovery/send drift. I need to supersede my earlier review on afb7b5d: it missed the existing root-mounted custom-relay configuration described inline.

The single-base direction is sound, but choosing /v1 for every pathless custom relay is a product-contract change rather than a universally safe normalization. I’m leaving this as a P2 COMMENT—not a request for changes—but I would not approve until the intended compatibility behavior is explicit.

Exact head reviewed: fb95dc1a0f5136b5b1501e9123da01972fa31651. Hosted checks are green.

中文对照

需要纠正我在旧 head 上的结论:统一入口的方向正确,但把所有无路径 Relay 自动改成 /v1 会改变已有配置含义。这里定为 P2 Comment,不发 Request Changes,但建议先明确兼容契约再批准。

AI-assisted review: Codex traced the compatibility path and drafted this feedback; the maintainer verified the conclusion and severity.

return baseUrl;
}
const basePath = stripTrailing(url.pathname).replace(/\/responses$/i, '');
url.pathname = basePath === '' ? '/v1' : basePath;

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.

[P2] Preserve or explicitly migrate the existing root-mounted relay contract

Thanks for centralizing the URL derivation. This line does more than normalize equivalent spellings, though: a pathless custom Responses relay previously meant /responses and /models at the configured root, while it now always means /v1/responses and /v1/models.

Root-mounted custom relays are a valid existing configuration, so this silently breaks them on the normal send/discovery path. Please either preserve root semantics and use a deterministic /v1 fallback, or make /v1 the explicit product contract with migration/UI/documentation and a regression showing the old shape is intentionally unsupported.

Because this changes the meaning of persisted user configuration, a Discussion establishing the contract would also be preferable to treating it as an implementation-only correction.

中文对照

这里不只是统一 URL 写法,而是把已有的“根路径提供 /responses/models”配置重新解释成 /v1。这会直接破坏合法的现有自定义 Relay。建议保留根路径语义并确定性 fallback 到 /v1,或者明确迁移产品契约;这种行为变化最好先通过 Discussion 达成共识。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed in b8ff53a69 after rebasing onto the latest main.

The bare-root → /v1 rewrite is removed. A root-mounted relay remains authoritative for send, probe, and the first discovery request (/responses and /models). Only a 404 from that pathless root model route triggers one same-origin GET fallback to /v1/models; 401/network/invalid-response failures do not fall back, and POST requests are never replayed. Endpoint-form overrides still reduce to their API base for discovery.

Regression coverage now proves the existing root contract, the 404-only fallback, the authorization boundary, and unchanged DeepSeek root behavior. The PR title/body and verification notes have also been updated.

A root-mounted custom OpenAI Responses relay remains authoritative for send,
probe, and discovery. When only its root /models route returns 404, retry
discovery once at /v1/models; do not retry authorization failures or POST
requests.
Endpoint-form overrides still reduce to their API base before discovery, so
/v1/responses discovers through /v1/models without changing persisted root
semantics.
Refs apache#3320
Generated-by: Claude Opus 5
Generated-by: OpenAI Codex (GPT-5.6)
@Sandu1213
Sandu1213force-pushed the fix/responses-relay-api-base-url branch from fb95dc1 to b8ff53aCompareAugust 30, 2026 13:38
@Sandu1213Sandu1213 changed the title fix(runtime): resolve a Responses relay from one API basefix(runtime): fall back Responses relay discovery to /v1Aug 30, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/MUnder 500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom OpenAI Responses relay does not append /v1 when fetching models

2 participants

@Sandu1213@Astro-Han