fix: add Copilot IDE headers to resolved models#82275
Conversation
|
Codex review: needs maintainer review before merge. Workflow note: Future ClawSweeper reviews update this same comment in place. How this review workflow works
Summary Reproducibility: yes. from source and supplied logs, though I did not rerun the live provider failure locally. Current main resolves Copilot models without synthesized IDE headers on the Pi compaction path, and Pi 0.75.1 forwards only resolved model/auth headers into generateSummary. PR rating Rank-up moves:
What the crustacean ranks mean
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. PR egg Rarity: 🥚 common. What is this egg doing here?
Real behavior proof Risk before merge Maintainer options:
Next step before merge Security Review detailsBest possible solution: Land this focused header-resolution fix after normal maintainer review and final head validation, preserving explicit header override precedence. Do we have a high-confidence way to reproduce the issue? Yes, from source and supplied logs, though I did not rerun the live provider failure locally. Current main resolves Copilot models without synthesized IDE headers on the Pi compaction path, and Pi 0.75.1 forwards only resolved model/auth headers into generateSummary. Is this the best way to solve the issue? Yes. The PR uses the shared request-config merge so discovered, provider, model, and request headers keep override precedence, and it covers both dynamic and configured Copilot resolved models; a later provider-boundary cleanup can be separate. Label justifications:
What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against df8505b09d2e. |
7059d2c to
ad53c87
Compare
CodeClaw proof runtime updateThe shared CodeClaw proof branch has been advanced while validating the Telegram topic follow-ups for PR #82023. Current combined proof branch:
I re-verified that the rebuilt live runtime still contains the Copilot compaction/header fix from this PR:
This does not change the earlier Real behavior proof for this PR: the CodeClaw live compaction proof remains the provider-backed |
* fix: add copilot headers to resolved models * fix copilot header imports * fix prod typecheck
* fix: add copilot headers to resolved models * fix copilot header imports * fix prod typecheck
* fix: add copilot headers to resolved models * fix copilot header imports * fix prod typecheck
* fix: add copilot headers to resolved models * fix copilot header imports * fix prod typecheck
* fix: add copilot headers to resolved models * fix copilot header imports * fix prod typecheck
* fix: add copilot headers to resolved models * fix copilot header imports * fix prod typecheck
* fix: add copilot headers to resolved models * fix copilot header imports * fix prod typecheck
* fix: add copilot headers to resolved models * fix copilot header imports * fix prod typecheck
* fix: add copilot headers to resolved models * fix copilot header imports * fix prod typecheck
* fix: add copilot headers to resolved models * fix copilot header imports * fix prod typecheck
* fix: add copilot headers to resolved models * fix copilot header imports * fix prod typecheck
Summary
Fixes GitHub Copilot Pi-native/default compaction requests by ensuring resolved GitHub Copilot models carry the required Copilot IDE headers into the lower-level Pi summarization path.
The default Pi compaction path calls
session.compact()/ PigenerateSummary()directly and does not go through OpenClaw's normal GitHub Copilot stream wrapper. Without these headers, Copilot can reject compaction summarization with:Changes
src/agents/provider-request-config.ts:Editor-VersionEditor-Plugin-VersionUser-AgentCopilot-Integration-IdOpenai-OrganizationresolveProviderRequestConfig()through resolved model paths insrc/agents/pi-embedded-runner/model.ts, including discovered/dynamic models without explicit provider config.github-copilot/gpt-5.5resolved model headers.Reproduction / diagnostic evidence captured
Captured from local
codeclaw-triagelogs before this fix:Also captured same-symptom later failure:
Local RED regression before implementation:
Evidence that the fix works locally
A local post-fix Pi-native compaction/header smoke test using
@earendil-works/pi-coding-agentgenerateSummary()observed the expected outgoing headers. The test server would have returned the samemissing Editor-Version header for IDE autherror ifEditor-Versionwere absent.{ "result": "", "requestCount": 1, "url": "/v1/responses", "observedHeaders": { "editor-version": "vscode/1.107.0", "editor-plugin-version": "copilot-chat/0.35.0", "user-agent": "GitHubCopilotChat/0.35.0", "copilot-integration-id": "vscode-chat", "openai-organization": "github-copilot", "authorization": "<redacted>" } }Real behavior proof
Behavior or issue addressed: GitHub Copilot Pi-native/default compaction requests now carry Copilot IDE headers, so compaction no longer fails with
400 bad request: missing Editor-Version header for IDE auth.Real environment tested: Live
codeclaw-triageDocker container after installing a custom OpenClaw package built from combined proof branchcodeclaw-proof-82023-82275(https://github.com/efpiva/openclaw/tree/codeclaw-proof-82023-82275) atOpenClaw 2026.5.17 (db1c53a). The proof used the running Gateway in that container and the real GitHub Copilot provider.Exact steps or command run after this patch:
Evidence after fix:
The live
sessions.compactcall returnedok: trueandcompacted: true:{ "ok": true, "key": "agent:main:explicit:codeclaw-proof-82275-gpt54-20260517t220327z", "compacted": true, "result": { "tokensBefore": 28655, "tokensAfter": 15696, "firstKeptEntryId": "2ddaf766" } }The live Gateway logs show the compaction ran against GitHub Copilot and finished as compacted:
A grep over the proof window found no
missing Editor-Versionfailures:Observed result after fix: A live CodeClaw/OpenClaw session using GitHub Copilot compacted successfully through the Gateway. The compaction result reduced the effective token count from
28655to15696, and the previousmissing Editor-Version header for IDE authfailure did not occur.What was not tested: I did not wait for a naturally occurring overflow-triggered CodeClaw compaction. The live proof explicitly invoked
sessions.compacton a real Gateway session in the deployed CodeClaw container; this exercises the same Pi-native GitHub Copilot summarization/header path that previously emitted themissing Editor-Versionerror.Validation
pnpm exec vitest run src/agents/pi-embedded-runner/model.test.ts --config test/vitest/vitest.agents.config.tsTest Files 1 passed (1)Tests 84 passed (84)pnpm test:changedpnpm tsgo:corepnpm buildpnpm format:check -- src/agents/provider-request-config.ts src/agents/pi-embedded-runner/model.ts src/agents/pi-embedded-runner/model.test.tscodex review --commit HEAD -c 'sandbox_mode="danger-full-access"'