Skip to content

feat: keep Copilot BYOK agent turns alive in server Agent Host - #8047

Open
khanhkit wants to merge 1 commit into
coder:mainfrom
khanhkit:fix/copilot-byok-background
Open

khanhkit wants to merge 1 commit into
coder:mainfrom
khanhkit:fix/copilot-byok-background

Conversation

@khanhkit

@khanhkit khanhkit commented Oct 8, 2026 •

Copy link
Copy Markdown

Fixes #8046

Motivation

code-server is a remote IDE, so long-running agent work should be owned by a server-side lifecycle rather than by a browser tab. For direct-capable Copilot Chat BYOK providers, this change lets the remote Agent Host own model execution so an active turn is not tied to renderer/tab lifetime.

Design

  • Direct-capable BYOK providers are synchronized to Agent Host as bounded, ephemeral descriptors and registered directly with the server-side Copilot SDK.
  • Provider configurations that cannot be represented faithfully stay on the existing renderer bridge rather than being silently normalized.
  • Credential-bearing syncEphemeralByokModels data stays process-memory-only and is centrally redacted before AHP JSONL serialization.
  • Model capability metadata (vision, tool calling, reasoning effort) is preserved.
  • Agent Host Changes-pill defaults follow isolation when there is no provider override: folder -> Session Changes, worktree -> Branch Changes.
  • Native Copilot authentication semantics are not bypassed; this change is for the direct BYOK path.

Files changed

  • patches/copilot-background-byok.diff
  • patches/copilot-agenthost-session-changes.diff
  • patches/series

Current VS Code 1.141 verification

Current PR head: 73f71d62f4b26c04dd50b595a3837231a1b5b6aa

Pinned VS Code gitlink: 2a59476c9bfcb90b3ddc372c36762471b7dfad1c (VS Code 1.141)

Executed on the 1.141 port:

  • full code-server patch series clean apply: 31/31;
  • regenerated feature patches reproduce 22/22 target files byte-for-byte from the validated scratch tree;
  • copilotSessionLauncher.test: 109/109 pass;
  • byokLmBridgeRegistry.test: 11/11 pass;
  • protocolServerHandler.test: 175/175 pass;
  • ahpJsonlLogger.test: 14/14 pass, including the credential-redaction sentinel;
  • browser AgentHostByokLmHandler: 22/22 pass;
  • browser AgentHostSessionInputPills: 22/22 pass, including folder -> Session Changes.

Exact-head isolated ARM64 release verification is now GREEN for 73f71d62f4b26c04dd50b595a3837231a1b5b6aa: full build:vscode completed (including core-ci desktop/server/server-web bundles), code-server build completed, release materialized successfully, and a fresh out-of-container checksum verification passed 5897/5897 files. The built runtime reports 73f71d62f4b26c04dd50b595a3837231a1b5b6aa with Code 1.141.0.

GitHub Actions status

Upstream Build run 37796020383 was created for exact head 73f71d62f4b26c04dd50b595a3837231a1b5b6aa, but GitHub currently reports action_required with zero jobs created. The workflow is waiting for the repository's fork-workflow approval; no CI test has executed or failed yet.

Historical note

The earlier VS Code 1.140 candidate 95c0eb85d4265925751949f729851901e8e9db0d passed its isolated build, fork CI, and live background/detach acceptance. Those results are historical evidence only and are not presented as exact-head verification for this 1.141 port.

@khanhkit
khanhkit requested a review from a team as a code owner October 8, 2026 09:47
@khanhkit
khanhkit force-pushed the fix/copilot-byok-background branch from 95c0eb8 to 73f71d6 Compare October 8, 2026 14:52
@code-asher

Copy link
Copy Markdown
Member

Thank you for the PR! The reasoning makes sense, but this looks like a significant change. Could we propose this change upstream directly rather than try maintaining it as a patch here? I think the VS Code maintainers would find it valuable as well, since presumably Codespaces has the same problems, or anyone running regular VS Code in the web.

@khanhkit

khanhkit commented Oct 8, 2026

Copy link
Copy Markdown
Author

Exact-head VS Code 1.141 verification update:

  • candidate: 73f71d62f4b26c04dd50b595a3837231a1b5b6aa
  • full build:vscode: PASS (core-ci, desktop/server/server-web bundles)
  • code-server build + release: PASS
  • fresh release checksum verification: 5897/5897
  • runtime identity: exact candidate with Code 1.141.0

Upstream Actions run 37796020383 is still action_required with zero jobs, so it is awaiting repository approval for the fork workflow; no upstream CI test has failed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copilot Chat BYOK turns should survive browser disconnects via server Agent Host

2 participants