Skip to content

fix(copilot): resolve transport routing bug for issue #99240 - #109623

Closed
fourdollars wants to merge 4 commits into
openclaw:mainfrom
fourdollars:sylee/issue-99240-copilot-transport
Closed

fourdollars wants to merge 4 commits into
openclaw:mainfrom
fourdollars:sylee/issue-99240-copilot-transport

Conversation

@fourdollars

Copy link
Copy Markdown

What Problem This Solves

Fixes #99240 by ensuring the Copilot transport is selected from advertised endpoint capabilities, including stale-catalog fallback handling for Anthropic-compatible paths.

Why This Change Was Made

  • Resolve endpoint/transport mismatches that caused incorrect routing behavior.
  • Preserve Claude thinking controls while handling stale catalog metadata safely.
  • Keep transport resolution dynamic and capability-driven.

User Impact

Users get reliable provider routing and expected behavior when endpoint capabilities differ or metadata is stale.

Evidence

  • Includes the three commits currently ahead of origin/main on this branch.

@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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 17, 2026
@clawsweeper

clawsweeper Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the contribution. This PR has been inactive for a while and still is not in a landable state.

Close this external PR as abandoned: its last code update was 33 days ago, it no longer merges cleanly, and the two previously reported correctness defects remain on the same head.

So I’m closing this as inactive for now. If you pick the work back up, push a rebased branch with green checks and reopen (or open a fresh PR) and it will be reviewed again.

Review details

Best possible solution:

Keep the current provider-owned catalog policy; if the original behavior still reproduces on current main, submit a rebased focused fix that proves the live endpoint contract and preserves explicit capability opt-outs.

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

Yes for the introduced defects by source inspection: a non-string endpoint entry reaches .includes, and a false reasoning catalog row reaches the introduced preservation override. No target code was executed because this is an external contributor branch.

Is this the best way to solve the issue?

No. The current branch creates a competing stale-metadata exception without proving a positive capability; a fresh, current-main repair should use the existing provider-owned capability mapping.

Security review:

Security review cleared: The patch adds no dependency, workflow, secret, permission, or authority-bearing behavior; its catalog-input weakness is a functional availability concern.

AGENTS.md: found and applied where relevant.

What I checked:

  • Introduced endpoint parser can throw: The introduced catalog parser accepts an arbitrary array after a type cast, then calls includes on each element; a malformed entry such as supported_endpoints: [null] throws instead of allowing the documented catalog-failure fallback. (extensions/github-copilot/models.ts:139, 9daf684c5db7)
  • Introduced policy bypass ignores an explicit opt-out: The introduced Claude branch sets preserveWhenCatalogReasoningFalse solely from model-id text and transport, so it overrides a false reasoning capability without confirming a positive provider capability. (extensions/github-copilot/provider-policy-api.ts:22, 9daf684c5db7)
  • Current shared contract treats false as authoritative: Current main accepts a provider-profile override only when catalog reasoning is not false, unless that profile has explicitly earned the preserve marker; otherwise it returns an off-only profile. (src/auto-reply/thinking.ts:265, 5d07c11ccef2)
  • Current main has since replaced the Copilot policy shape: Current main resolves Copilot advanced levels through the provider-owned thinking-level map rather than this branch's Claude stale-catalog override, so any renewed work must start from the current design. (extensions/github-copilot/provider-policy-api.ts:9, 5d07c11ccef2)
  • Stalled branch history: The reviewed head was committed on 2026-07-28; supplied GitHub state shows no later head update and reports the PR as dirty, satisfying the abandoned-PR inactivity and stalled-state guard. (9daf684c5db7)

Likely related people:

  • Rain: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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

@fourdollars

Copy link
Copy Markdown
Author

Addressing the two blocking asks from the bot review:

  1. Real behavior proof (transport + non-off thinking)

Redacted live run against a Juju-deployed OpenClaw gateway with GitHub Copilot auth:

$ openclaw models inspect --model github-copilot/claude-sonnet-4.6
# ...
api: anthropic-messages
compat.supportedReasoningEfforts: [low, medium, high, max]

Before fix:

$ openclaw agent chat --provider github-copilot --model claude-sonnet-4.6 --thinking high "ping"
Error: Invalid thinking level "high". Use one of: off

After fix:

$ openclaw agent chat --provider github-copilot --model claude-sonnet-4.6 --thinking high "ping"
# request succeeds; response returned by claude-sonnet-4.6

Transport selection proof for advertised endpoints:

# provider catalog includes .../messages in supported_endpoints
# resolved OpenClaw model api => anthropic-messages
  1. Provider ownership boundary (thinking.ts vs plugin)

Current patch keeps the stale-metadata guard in shared resolver because the failure occurs after catalog normalization and manifests as reasoning: false gating in resolveThinkingProfile, even when compat/reasoning-effort metadata still indicates thinking support.

That said, I agree the long-term ownership should stay plugin-side where possible. If maintainers want strict provider-only policy, I can follow with a narrow refactor to move this Copilot-Claude stale-metadata decision into the GitHub Copilot provider profile hook and keep shared resolver logic generic.

Also, there is no persistent data-model change in this PR; src/auto-reply/thinking.test.ts is test-only.

If this satisfies the proof gate, please re-run review:

@clawsweeper re-review

@fourdollars
fourdollars force-pushed the sylee/issue-99240-copilot-transport branch 4 times, most recently from 2092299 to 32dfb8a Compare July 22, 2026 11:22
fourdollars and others added 4 commits July 28, 2026 16:04
…adata

Allow github-copilot Claude models on anthropic-messages transport to keep non-off thinking levels even when catalog reasoning is stale or false, and cover both stale and compat-effort cases with regressions.

Co-authored-by: Copilot <[email protected]>
…vertised

Treat supported_endpoints entries containing messages as anthropic-messages transport so Copilot Claude routing does not fall back to responses/completions heuristics.

Co-authored-by: Copilot <[email protected]>
@fourdollars
fourdollars force-pushed the sylee/issue-99240-copilot-transport branch from 32dfb8a to 9daf684 Compare July 28, 2026 09:04
@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: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed 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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 28, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. labels Aug 5, 2026
@clawsweeper clawsweeper Bot added the status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. label Aug 5, 2026
@clawsweeper clawsweeper Bot added clawsweeper-recovery-stuck rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. clawsweeper-recovery-stuck labels Aug 13, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper recorded closeout evidence for this proposed close.

  • Action: close remains subject to final live verification.
  • Close reason: abandoned inactive PR.
    Review evidence: durable ClawSweeper review.

@clawsweeper clawsweeper Bot closed this Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: github-copilot merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: /thinking levels not available for github-copilot provider models (e.g. claude-sonnet-4.6)

1 participant