Skip to content

fix(openai): enable prompt cache keys for Azure#98259

Open
BSG2000 wants to merge 4 commits into
openclaw:mainfrom
BSG2000:fix-azure-openai-prompt-cache-key
Open

fix(openai): enable prompt cache keys for Azure#98259
BSG2000 wants to merge 4 commits into
openclaw:mainfrom
BSG2000:fix-azure-openai-prompt-cache-key

Conversation

@BSG2000

@BSG2000 BSG2000 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • centralize Azure OpenAI chat-completions prompt-cache-key detection in the shared completions compat defaults
  • apply that default in the legacy provider builder, boundary-aware OpenAI transport, and embedded-agent extra-params retention eligibility path
  • include traditional Azure hosts, Azure AI Foundry project hosts, and regional .api.cognitive.microsoft.com Foundry hosts
  • preserve Azure long prompt-cache retention (prompt_cache_retention: "24h") when callers request cacheRetention: "long", and preserve explicit cacheRetention: "none"
  • add regression coverage for Azure prompt-cache key emission, long/disabled retention, extra-params propagation, and both request paths

What Problem This Solves

OpenClaw already gates OpenAI-compatible prompt cache keys behind compat.supportsPromptCacheKey, but Azure OpenAI chat-completions endpoints were not auto-detected. Azure users therefore needed explicit per-model compat config before stable session prompt-cache keys were forwarded, which can silently reduce prompt-cache hit opportunities for long stable prefixes.

The change treats Azure OpenAI chat-completions endpoints (azure-openai, .openai.azure.com, .cognitiveservices.azure.com, .services.ai.azure.com, and .api.cognitive.microsoft.com) as prompt-cache-key capable by default. The default now lives in the shared completions compat path used by both request builders and by embedded-agent extra-param cache-retention eligibility; explicit compat.supportsPromptCacheKey / compat.supportsLongCacheRetention overrides continue to win.

Evidence

{"label":"warmup","status":200,"ok":true,"model":"gpt-5.5-2026-04-24","elapsedMs":1328,"promptTokens":4090,"completionTokens":8,"cachedTokens":0,"hasPromptCacheKey":true,"requestedRetention":"24h","errorCode":null,"errorMessage":null}
{"label":"repeat-prefix","status":200,"ok":true,"model":"gpt-5.5-2026-04-24","elapsedMs":1204,"promptTokens":4090,"completionTokens":5,"cachedTokens":3840,"hasPromptCacheKey":true,"requestedRetention":"24h","errorCode":null,"errorMessage":null}

Test plan

  • pnpm exec vitest run src/llm/providers/openai-completions.test.ts --config test/vitest/vitest.unit.config.ts
  • pnpm exec vitest run src/agents/openai-transport-stream.test.ts --config test/vitest/vitest.agents.config.ts
  • node scripts/test-projects.mjs src/agents/openai-completions-compat.test.ts
  • node scripts/test-projects.mjs src/agents/embedded-agent-runner-extraparams.test.ts
  • pnpm exec oxfmt --check --threads=1 src/agents/embedded-agent-runner/extra-params.ts src/agents/embedded-agent-runner-extraparams.test.ts src/agents/openai-completions-compat.ts src/agents/openai-completions-compat.test.ts src/agents/openai-transport-stream.ts src/agents/openai-transport-stream.test.ts src/llm/providers/openai-completions.ts src/llm/providers/openai-completions.test.ts

@openclaw-barnacle openclaw-barnacle Bot added size: S triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jun 30, 2026
@clawsweeper

clawsweeper Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed July 25, 2026, 6:49 AM ET / 10:49 UTC.

ClawSweeper review

What this changes

The PR moves prompt-cache-key enablement into the shared OpenAI Chat Completions compatibility rules so direct OpenAI and Azure OpenAI endpoints automatically send stable session cache keys.

Merge readiness

⚠️ Needs maintainer review before merge - 3 items remain

Keep this PR open for one narrow correction: its shared Azure-host rule still omits regional Azure AI Foundry *.api.cognitive.microsoft.com endpoints, despite the stated scope and prior review. The direct Azure live proof is strong for the tested host. Likely related people: damselem (medium confidence) introduced the existing prompt-cache compatibility contract that this change extends.

Priority: P2
Reviewed head: 4a8738ad5f3e6346fe6df264cff07ec5de999459

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Strong direct Azure proof and focused tests support the intended behavior, but one previously identified Azure endpoint family is still missing from the shared rule.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body provides redacted terminal output from a real Azure OpenAI deployment showing successful after-fix requests and a repeat-prefix cache hit; it is sufficient for the tested *.openai.azure.com path, though not for the omitted regional Foundry host.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides redacted terminal output from a real Azure OpenAI deployment showing successful after-fix requests and a repeat-prefix cache hit; it is sufficient for the tested *.openai.azure.com path, though not for the omitted regional Foundry host.
Evidence reviewed 4 items Final PR diff omits the regional Foundry suffix: The Azure compatibility rule enables azure-openai, *.openai.azure.com, *.services.ai.azure.com, and *.cognitiveservices.azure.com, but not *.api.cognitive.microsoft.com; the PR body says regional Foundry hosts are included.
Prior review identified the same uncovered endpoint family: The earlier P2 review explicitly named https://westus.api.cognitive.microsoft.com/openai/v1; the final diff’s host list still has no corresponding suffix, so the prior blocker remains unresolved.
Direct Azure behavior proof is positive but narrower than the advertised scope: The PR body reports two successful live requests to an *.openai.azure.com deployment, including a repeat-prefix cache hit with 3,840 cached tokens; it does not prove the omitted regional Foundry hostname path.
Findings 1 actionable finding [P2] Recognize regional Azure AI Foundry endpoints
Security None None.

How this fits together

OpenClaw resolves a model’s provider and endpoint compatibility before building OpenAI Chat Completions requests. Those resolved capabilities determine whether session cache-routing fields and long cache retention reach the upstream Azure or OpenAI endpoint.

flowchart LR
  A[Model and endpoint config] --> B[Completions compatibility rules]
  B --> C[Resolved cache capabilities]
  C --> D[Legacy and boundary-aware request builders]
  D --> E[Azure OpenAI Chat Completions]
  E --> F[Prompt-cache usage metrics]
Loading

Before merge

  • Recognize regional Azure AI Foundry endpoints (P2) - Add the missing *.api.cognitive.microsoft.com suffix. The PR claims regional Foundry support and prior review named this exact endpoint family, but the final host list still cannot match westus.api.cognitive.microsoft.com, leaving those users without the automatic cache key.
  • Resolve merge risk (P1) - Merging with the current host list leaves regional Azure AI Foundry Chat Completions users on *.api.cognitive.microsoft.com without the advertised automatic cache-key behavior, while nearby Azure host families receive it.
  • Complete next step (P2) - A narrow mechanical repair can complete the stated Azure endpoint coverage without changing the compatibility design or adding configuration.

Findings

  • [P2] Recognize regional Azure AI Foundry endpoints — packages/ai/src/providers/openai-completions-compat.ts:70-72
Agent review details

Security

None.

PR surface

Source +58, Tests +43, Docs 0. Total +101 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 2 63 5 +58
Tests 2 44 1 +43
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 108 7 +101

Review metrics

Metric Value Why it matters
Azure endpoint coverage 3 host suffix families enabled; 1 claimed regional Foundry family omitted The shared default is endpoint-driven, so a missing hostname family produces a silent behavior gap for otherwise equivalent Azure deployments.

Stored data model

Persistent data-model change detected: persistent cache schema: docs/reference/prompt-caching.md, persistent cache schema: packages/ai/src/providers/openai-completions.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Complete the Azure endpoint taxonomy (recommended)
    Add the missing regional Foundry hostname suffix and an adjacent compatibility regression before merging so all documented Azure host families receive the same default.
  2. Narrow the advertised scope
    If regional Foundry endpoints are intentionally unsupported, remove that claim from the PR body and keep the documentation limited to the tested host families.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Add `*.api.cognitive.microsoft.com` to the Azure completions compatibility rule, cover it with a resolved-compat regression, and align the prompt-caching reference text.

Technical review

Best possible solution:

Add the regional *.api.cognitive.microsoft.com hostname suffix to the shared Azure rule, document it with the other Azure families, and add a regression case that proves the resolved compatibility enables the cache key without an explicit override.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: resolve compatibility for a custom OpenAI-compatible model with base URL https://westus.api.cognitive.microsoft.com/openai/v1; the displayed Azure suffix list cannot match that hostname, so the automatic cache-key capability remains disabled.

Is this the best way to solve the issue?

No. Centralizing the behavior in shared completions compatibility is the right shape, but the current implementation is not the best complete fix until it includes the regional Azure AI Foundry hostname family it claims to support.

Full review comments:

  • [P2] Recognize regional Azure AI Foundry endpoints — packages/ai/src/providers/openai-completions-compat.ts:70-72
    Add the missing *.api.cognitive.microsoft.com suffix. The PR claims regional Foundry support and prior review named this exact endpoint family, but the final host list still cannot match westus.api.cognitive.microsoft.com, leaving those users without the automatic cache key.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.93

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b8bb08a1ad37.

Labels

Label changes:

  • add merge-risk: 🚨 compatibility: This changes automatic endpoint capability defaults; the incomplete hostname taxonomy makes equivalent Azure deployments behave differently after merge.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides redacted terminal output from a real Azure OpenAI deployment showing successful after-fix requests and a repeat-prefix cache hit; it is sufficient for the tested *.openai.azure.com path, though not for the omitted regional Foundry host.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (live_output): The PR body provides redacted terminal output from a real Azure OpenAI deployment showing successful after-fix requests and a repeat-prefix cache hit; it is sufficient for the tested *.openai.azure.com path, though not for the omitted regional Foundry host.

Label justifications:

  • P2: The patch improves a provider optimization but currently leaves one intended Azure endpoint family without the automatic behavior.
  • merge-risk: 🚨 compatibility: This changes automatic endpoint capability defaults; the incomplete hostname taxonomy makes equivalent Azure deployments behave differently after merge.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (live_output): The PR body provides redacted terminal output from a real Azure OpenAI deployment showing successful after-fix requests and a repeat-prefix cache hit; it is sufficient for the tested *.openai.azure.com path, though not for the omitted regional Foundry host.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides redacted terminal output from a real Azure OpenAI deployment showing successful after-fix requests and a repeat-prefix cache hit; it is sufficient for the tested *.openai.azure.com path, though not for the omitted regional Foundry host.

Evidence

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs packages/ai/src/providers/openai-completions.compat.test.ts.
  • [P1] node scripts/run-vitest.mjs packages/ai/src/providers/openai-completions.test.ts.

What I checked:

  • Final PR diff omits the regional Foundry suffix: The Azure compatibility rule enables azure-openai, *.openai.azure.com, *.services.ai.azure.com, and *.cognitiveservices.azure.com, but not *.api.cognitive.microsoft.com; the PR body says regional Foundry hosts are included. (packages/ai/src/providers/openai-completions-compat.ts:70, 4a8738ad5f3e)
  • Prior review identified the same uncovered endpoint family: The earlier P2 review explicitly named https://westus.api.cognitive.microsoft.com/openai/v1; the final diff’s host list still has no corresponding suffix, so the prior blocker remains unresolved. (packages/ai/src/providers/openai-completions-compat.ts:70, 4a8738ad5f3e)
  • Direct Azure behavior proof is positive but narrower than the advertised scope: The PR body reports two successful live requests to an *.openai.azure.com deployment, including a repeat-prefix cache hit with 3,840 cached tokens; it does not prove the omitted regional Foundry hostname path. (4a8738ad5f3e)
  • Existing compatibility contract provenance: The merged prompt-cache compatibility work established compat.supportsPromptCacheKey as the explicit override surface; this PR correctly builds on that contract, but the automatic Azure endpoint taxonomy must cover its claimed supported hosts. (src/agents/provider-attribution.ts, 687ede50a5ac)

Likely related people:

  • damselem: Introduced the merged compat.supportsPromptCacheKey contract that this PR relies on for automatic completion-request behavior. (role: compatibility-surface introducer; confidence: medium; commits: 687ede50a5ac; files: src/agents/provider-attribution.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add *.api.cognitive.microsoft.com to the shared rule and cover it in the resolved-compat regression test.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-06-30T21:46:52.590Z sha eb7f01f :: needs changes before merge. :: [P1] Fix the compat-defaults input type | [P1] Carry Azure cache eligibility into embedded extra params | [P3] Update prompt-cache docs for Azure defaults

@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jun 30, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 30, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4570f5c205

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/llm/providers/openai-completions.ts Outdated
Comment on lines +1291 to +1294
provider === "azure-openai" ||
baseUrl.includes(".openai.azure.com") ||
baseUrl.includes(".cognitiveservices.azure.com") ||
baseUrl.includes(".services.ai.azure.com");

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 Badge Include the regional Azure Foundry host in detection

When a custom OpenAI-compatible Chat Completions provider is pointed at an Azure AI Foundry regional endpoint such as https://westus.api.cognitive.microsoft.com/openai/v1, this URL-only Azure detection still returns false unless the provider id is exactly azure-openai. That host is documented by Microsoft for the same Foundry OpenAI API and is already treated as Azure-compatible elsewhere in the repo (src/shared/azure-openai-responses-client-compat.ts), so those Azure chat-completions users will continue to have supportsPromptCacheKey false and buildParams will drop their session prompt_cache_key.

Useful? React with 👍 / 👎.

Comment thread src/llm/providers/openai-completions.ts Outdated
Comment on lines +1349 to +1350
supportsLongCacheRetention:
!(isTogether || isCloudflareWorkersAI || isCloudflareAiGateway) && !isAzureOpenAI,

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 Badge Honor Azure long prompt-cache retention

For Azure OpenAI models where the caller requests cacheRetention: "long", this new !isAzureOpenAI forces supportsLongCacheRetention false, so buildParams never emits prompt_cache_retention: "24h". Microsoft’s Azure OpenAI prompt-caching docs say prompt_cache_retention is configurable on Chat Completions and list GPT-5/GPT-4.1 families for extended retention, so this silently downgrades supported Azure deployments to short/in-memory retention and also regresses existing Azure configs that had only opted into supportsPromptCacheKey.

Useful? React with 👍 / 👎.

Comment thread src/llm/providers/openai-completions.ts Outdated
sendSessionAffinityHeaders: false,
supportsPromptCacheKey: false,
supportsLongCacheRetention: !(isTogether || isCloudflareWorkersAI || isCloudflareAiGateway),
supportsPromptCacheKey: isAzureOpenAI,

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 Badge Update the OpenClaw completions transport path

This auto-detection only changes the legacy src/llm/providers/openai-completions.ts builder, but embedded agent runs also route openai-completions through the boundary-aware transport (src/agents/provider-transport-stream.tssrc/agents/openai-transport-stream.ts), whose getCompat still enables prompt_cache_key only when model.compat.supportsPromptCacheKey === true. Azure Chat Completions sessions using that default transport will still omit the cache key, so the fix does not cover the main runtime path unless the same Azure detection is applied to the transport/extra-params gates.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jun 30, 2026
@BSG2000
BSG2000 force-pushed the fix-azure-openai-prompt-cache-key branch from 4570f5c to eb7f01f Compare June 30, 2026 21:15
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Jun 30, 2026
@BSG2000

BSG2000 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Addressed the review findings: moved Azure prompt-cache-key capability into the shared completions compat defaults, wired the boundary-aware transport path to those defaults, added the regional .api.cognitive.microsoft.com Foundry host, preserved Azure long retention, added regression tests for both request paths, and updated the PR body with redacted live Azure proof showing 200 responses and cachedTokens=3840 on the repeat-prefix request.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eb7f01f035

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/openai-transport-stream.ts Outdated
requiresReasoningContentOnAssistantMessages:
compatDefaults.requiresReasoningContentOnAssistantMessages,
requiresNonEmptyUserOrAssistantMessage: compatDefaults.requiresNonEmptyUserOrAssistantMessage,
supportsPromptCacheKey: compatDefaults.supportsPromptCacheKey,

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 Badge Honor retention overrides for detected Azure completions

When an Azure openai-completions model relies on this new auto-detected support instead of explicit model.compat.supportsPromptCacheKey, embedded-agent model params such as cacheRetention: "none" or "long" are still dropped because src/agents/embedded-agent-runner/extra-params.ts:528-542 only treats explicit compat as cache-key eligible. In a normal session with sessionId, this line then makes the transport default to short retention: cacheRetention: "none" still emits prompt_cache_key, and cacheRetention: "long" omits the requested prompt_cache_retention: "24h". Please use the same Azure detection in the extra-params eligibility path before auto-enabling cache keys here.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 30, 2026
@clawsweeper

clawsweeper Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@BSG2000
BSG2000 force-pushed the fix-azure-openai-prompt-cache-key branch from eb7f01f to c851085 Compare June 30, 2026 21:43
@BSG2000

BSG2000 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Addressed latest extra-params finding: embedded-agent cacheRetention eligibility now uses the same shared Azure OpenAI completions compat detection, while explicit compat.supportsPromptCacheKey overrides still win. Added regression tests for Azure cacheRetention long and none propagation through embedded-agent extra params.

@clawsweeper

clawsweeper Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c851085959

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/openai-completions-compat.ts Outdated
| "supportsNativeStreamingUsageCompat"
| "supportsOpenAICompletionsStreamingUsageCompat"
| "usesExplicitProxyLikeEndpoint"
| "supportsPromptCacheKeyCompat"

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.

P1 Badge Remove the invalid Pick key

This Pick<ProviderRequestCapabilities, ...> now includes supportsPromptCacheKeyCompat, but ProviderRequestCapabilities does not define that property in src/agents/provider-attribution.ts, so TypeScript rejects the file before the tests can run. Since this value is a local override passed into resolveOpenAICompletionsCompatDefaults, keep it outside the Pick (or add it to the source type) to restore typecheck/build.

Useful? React with 👍 / 👎.

@BSG2000
BSG2000 force-pushed the fix-azure-openai-prompt-cache-key branch from c851085 to 8f71708 Compare July 1, 2026 12:14
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Jul 1, 2026
@BSG2000

BSG2000 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review
@codex review

Addressed the remaining Codex/ClawSweeper findings on the latest head:

  • removed the invalid supportsPromptCacheKeyCompat key from the ProviderRequestCapabilities Pick while keeping it as a local optional compat-default input
  • updated prompt-caching docs to document Azure OpenAI Chat Completions / Azure AI Foundry default prompt_cache_key and long-retention behavior
  • reran the requested type gates: pnpm tsgo:prod and pnpm check:test-types
  • reran focused regressions: completions compat, OpenAI completions provider, embedded extra params, and the Azure prompt-cache transport cases

@clawsweeper

clawsweeper Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 8f71708afe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@clawsweeper clawsweeper Bot removed the rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. label Jul 1, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 🔁 re-review loop A fresh ClawSweeper review was explicitly requested after the latest review. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: 🔁 re-review loop A fresh ClawSweeper review was explicitly requested after the latest review. labels Jul 1, 2026
Azure OpenAI chat completions support prompt_cache_key, but OpenClaw only auto-enabled the field for api.openai.com. Move supportsPromptCacheKey into the OpenAI-completions compat matrix so first-party OpenAI and Azure OpenAI endpoints both opt in, and drop the hardcoded api.openai.com check from the transport. Other OpenAI-compatible proxies still stay off by default.

Co-authored-by: Copilot <[email protected]>
@BSG2000
BSG2000 force-pushed the fix-azure-openai-prompt-cache-key branch from 8f71708 to 9718bf6 Compare July 21, 2026 20:45
@openclaw-barnacle openclaw-barnacle Bot added size: XS and removed agents Agent runtime and tooling size: M labels Jul 21, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 07775908d0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +69 to +72
baseUrlIncludes: [
".openai.azure.com",
".services.ai.azure.com",
".cognitiveservices.azure.com",

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 Badge Parse Azure URLs before matching host suffixes

When a custom provider uses a valid uppercase Azure hostname such as https://TENANT.OPENAI.AZURE.COM/openai/v1, the raw, case-sensitive baseUrl.includes check misses it and omits the cache key. It can also misclassify proxies whose path, query, or longer hostname merely contains one of these fragments, causing unsupported cache fields to be sent despite the documented proxy opt-in requirement. Parse model.baseUrl and compare its normalized hostname using exact/suffix matching, as the sibling transport path does.

Useful? React with 👍 / 👎.

Codex P2: the OpenAI-completions compat matrix matched provider endpoints
with a raw, case-sensitive baseUrl.includes() check. That missed valid
uppercase Azure hostnames (e.g. https://TENANT.OPENAI.AZURE.COM/...) and
could misclassify proxies whose path or query merely contained a known
fragment. Parse model.baseUrl and compare its normalized (lowercased)
hostname using exact/suffix/prefix matching, mirroring the sibling
transport path (isAzureOpenAICompatibleHost).

Co-authored-by: Copilot <[email protected]>
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant