Skip to content

SDK: Add managed hosting credentials and remote workspace callbacks - #2839

Draft
C0deKing wants to merge 6 commits into
mainfrom
prototype/mc-managed-hosting
Draft

C0deKing wants to merge 6 commits into
mainfrom
prototype/mc-managed-hosting

Conversation

@C0deKing

@C0deKing C0deKing commented Oct 11, 2026 •

Copy link
Copy Markdown

Summary

Project the experimental managed-hosting contract into all six SDKs and add a Go per-host refreshable credential provider. This draft is based on the exact go/v1.0.19 SDK snapshot (f0b503aae1ba151d29d117088de4238d1983e33e, CLI 1.0.95), not current main.

  • Add typed hosting kind, runtime principal, and opaque credential-provider registration.
  • Preserve ordinary user-local defaults and existing session creation/resume/permission callbacks.
  • Keep Go credential registrations isolated per host and release them on startup failure, exit, and disconnect; provider errors do not select ambient authentication.
  • Preserve Java's shipped two- and three-argument environment constructors through the generator.
  • Generate all six projections from the companion native schema, without hand-editing generated files.
  • Add explicit host-only unknown-expiry credentials through GitHubTokenUnknownExpiryResult(&GitHubTokenUnknownExpiry{AccessToken: bearer}). Omit unavailable lifetime metadata without inventing a TTL; reject unknown lifetime for ordinary session providers, including before session ID assignment.
  • Retain known hosting lifetime of at least 120 seconds, normal session lifetime greater than one hour, bounded native refresh, and owner/policy validation. Explicit zero/null/invalid lifetime never becomes an unknown-lifetime fallback.

Validation

Workspace increment (91cdf52ec658a22200de6037eea1368137041660):

Use this revision rather than the first workspace snapshot: both copy and move now preserve optional FailIfExists, with regression cases for omitted, true and false values. The expected module version is v1.0.20-0.20261012015351-91cdf52ec658; module acquisition has not been rerun during the download pause.

  • Add explicit AhpHostOptions.WorkspaceProvider with typed pre-session Describe/Resolve and guarded Read, Write, Stat, List, Copy, Move, Delete, Mkdir, and Access callbacks. This is separate from durable SessionFS.
  • Preserve original AHP parameters, channel, metadata, request identity, int64 offsets, etags and create-only flags. The trusted provider must enforce physical boundaries and write preconditions on hands at execution, not merely during resolution.
  • Bound callbacks to eight concurrent invocations per host and a 25-second deadline. Provider errors/disconnects never fall back to brain-local IO; missing operations report NotImplemented. Normal local hosts are unchanged.
  • All six maintained SDK generators completed successfully from the native schema artifact emitted by run 38189988952 at 8a3c7fce40d7c4041589a71562ee021b64969667; subsequent native changes did not alter the schema source.
  • gofmt -l src/sdk/go/host_workspace.go src/sdk/go/host_workspace_test.go src/sdk/go/host.go src/sdk/go/client.go src/sdk/go/github_token_provider.go: passed (no output) in canonical source.
  • TMPDIR=<owned-build-work> MAVEN_OPTS=-Djava.io.tmpdir=<owned-build-work> ./mvnw -o -q -pl sdk spotless:apply: passed.
  • git diff --check: passed. All 23 projected source files were verified byte-for-byte against the canonical native SDK.
  • New Go workspace tests: passed in complete Linux Go job 114640833947, including pre-session discovery, exact int64/write conditions, copy/move flags, diagnostics isolation, host isolation and cancellation. go test -v ./... -race -timeout=20m and both in-process smoke commands passed; the whole Linux job, including docs checks, succeeded. Complete six-language/platform matrix remains in progress. Replacement existing SDK CI run 38195456927 has passed schema freshness, real Linux native runtime smoke, Go formatting, golangci-lint, and sample go test ./...; full Go subprocess and in-process tests have also passed in job 114640833947; remaining language/platform jobs continue in the same run. Run 38193802110 failed before language tests because its native runtime omitted the engine-owned host.workspace registry entry; the native companion now repairs it. The earlier 38192998800 run predates the move-field repair and is not final-head evidence. Local compilation/downloads remain paused after the shared-disk emergency; no dependency installation was performed.
  • Compatible native source 3689ef92 now passes all 149 native Rust targets and real SDK runtime startup smoke. Replacement native artifact is available remotely, expires 2026-10-13 02:33:25 UTC, and was not downloaded during the disk pause. Do not use withdrawn artifact 11722308385. Combined MC/Aspire/browser/inference and live AHP workspace IO are not claimed; the previous unknown-expiry binary still rejects workspaceProvider.

Current unknown-expiry update (b69c6fc1e09d3a03a2790f907fd19927ef3b20a8):

  • go test -race ./... -run 'TestAhp|TestGitHubToken|Test.*InstallationConfirmation' -count=1: passed in canonical and projected SDKs.
  • npm run typecheck: passed in the canonical Node SDK.
  • dotnet build src/GitHub.Copilot.SDK.csproj --no-restore --nologo --verbosity quiet -p:CopilotSkipCliDownload=true: passed, zero warnings/errors.
  • ./mvnw -o -q -pl sdk spotless:apply: passed in both SDKs.
  • All six maintained generators completed; all 14 changed/new SDK files match the canonical projection byte-for-byte.
  • go mod download -json github.com/github/copilot-sdk/go@v1.0.20-0.20261011230559-b69c6fc1e09d: passed without local replaces.
  • COPILOT_RUNTIME_HOST_E2E=1 COPILOT_CLI_PATH=<compatible native wrapper> go test -race . -run '^TestAhpHostRuntimeUnknownExpiryOwnerAdmission$' -count=1 -v: passed all four cases against the updated source-built native artifact. Both unknown and known expiry reach unchanged loopback owner denial; explicit zero and cancellation fail before owner lookup. This is negative owner-admission coverage, not successful hosting.
  • A standalone go run . <compatible native wrapper> <owned-state-directory> smoke passed using the published module without local replaces: local namespaced host start/list/dispose, managed callback cancellation, and client shutdown. No real control-plane registration or inference was attempted.
  • The same native owner-admission test demonstrated the expected unknown-expiry regression against the earlier source-built runtime; the other three cases passed there.
  • Rust SDK tests and full SDK/platform/browser matrix: not rerun for this update. The unchanged CLI pin does not implement unknown expiry.

Previous managed-hosting foundation:

  • go test ./... -run 'TestAhp|TestGitHubToken' -count=1: passed in the canonical SDK source.
  • go test -race . -run 'TestAhp|TestGitHubToken' -count=1: passed in both canonical and projected Go SDKs.
  • TypeScript maintained build (node --import tsx esbuild-copilotsdk-nodejs.ts, with declared binaries on PATH) and npm run typecheck: passed.
  • Java generator's node --import tsx --test java.test.ts: passed, 49 tests.
  • ./mvnw -pl sdk spotless:apply: passed.
  • dotnet build src/GitHub.Copilot.SDK.csproj --no-restore --nologo --verbosity quiet -p:CopilotSkipCliDownload=true: passed, compile-only, zero warnings/errors.
  • Python generated ordinary/managed hosting option round trips: passed.
  • cargo check --no-default-features --features local-runtime,test-support --tests: passed.
  • cargo test --no-default-features --features local-runtime,test-support --lib ahp_host::tests::: passed, 49 tests.
  • Six language projections: generated successfully with the maintained generators.
  • Published Go module github.com/github/copilot-sdk/go v1.0.20-0.20261011215256-1c553e0c8d78: downloaded and verified without local replaces. This is historical unknown-expiry evidence, not a consumer download of the final workspace revision. Current workspace SDK: 91cdf52ec658a22200de6037eea1368137041660 (expected Go version v1.0.20-0.20261012015351-91cdf52ec658); no local absolute replaces. Further local downloads are paused for shared-disk capacity.
  • Full platform/runtime/E2E matrix: not run. A compatible source-built native artifact was obtained and exercised for the earlier managed-hosting contract; it predates unknown expiry. The unchanged released CLI pin does not contain this new runtime contract.

Known integration blockers

This is an experimental companion contract, not a completed remote-worker integration. The Go ergonomic provider and six generated wire projections are published; the replacement native artifact and full native tests are available. The complete SDK language/platform matrix and live integration validation are still pending. Repository materialization and physical guard enforcement belong to the authorized hands adapter. Watchers, local terminals, worktree/Git-truth operations and unsupported project mutations return NotImplemented; there is no local fallback.

Native session repository-policy/context discovery remains separate: explicitly supplied allowedModels still performs local policy discovery, and trustWorkingDirectory is rejected with RPC SessionFS. Do not drop those settings or enable local model tools to bypass the limitation. Host-scoped workspace IO does not redirect session inference tools or instructions.

Hosting token refresh does not refresh session inference credentials; ordinary session providers still require a known lifetime greater than one hour. GitHubTokenProviderArgs.Host is verbatim runtime configuration (default https://github.com), not SDK-normalized. Validate it against the intended GitHub origin.

Unattended organization-principal admission remains unsupported. Installation credentials alone do not grant native remote-control entitlement. No owner wire field, tenant-authorization relaxation, production rollout, or new MC public API is introduced.

copilot-cli-release-app Bot and others added 5 commits October 9, 2026 16:11
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a host-scoped Go result that omits lifetime metadata without inventing a TTL. Regenerate all six wire projections, preserve ordinary session requirements, and exercise scope, serialization, and native owner admission.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@C0deKing C0deKing changed the title SDK: Add managed hosting options and per-host credential callbacks SDK: Add managed hosting credentials and remote workspace callbacks Oct 12, 2026
Keep copy and move conditions typed and document exact byte-offset behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

1 participant