Skip to content

CloudAgentNext - Per-provider credential containment allow-lists#4504

Merged
eshurakov merged 1 commit into
mainfrom
tangy-paste
Jul 12, 2026
Merged

CloudAgentNext - Per-provider credential containment allow-lists#4504
eshurakov merged 1 commit into
mainfrom
tangy-paste

Conversation

@eshurakov

Copy link
Copy Markdown
Contributor

Summary

Replaces the single MANAGED_SCM_CONTAINMENT_ORG_IDS env var and managedScmContainment boolean with per-provider containment allow-lists, so GitHub, GitLab, and Kilo tokens can be contained independently.

Changes

  • Env vars: MANAGED_SCM_CONTAINMENT_ORG_IDSGITHUB_TOKEN_CONTAINMENT_ORG_IDS, GITLAB_TOKEN_CONTAINMENT_ORG_IDS, KILOCODE_TOKEN_CONTAINMENT_ORG_IDS (each a comma-separated org allow-list or *).
  • Metadata: workspace.managedScmContainment boolean → workspace.credentialContainment { github, gitlab, kilocode }, with a Zod schema.
  • Helpers: new getEffectiveCredentialContainment (prefers explicit policy, falls back to legacy managedScmContainment → github+kilocode) and requiresContainmentSandbox (true if any provider is contained).
  • Token resolution: GitHub, GitLab, and Kilo capability issuance now gate on their respective containment flags instead of a single global boolean; the Kilo capability path is extracted into resolveKiloCapability.
  • Session registration: builds the per-provider credentialContainment policy from the three org allow-lists (devcontainer sessions stay uncontained).
  • Backward compatibility: legacy persisted managedScmContainment metadata is mapped to the new shape via getEffectiveCredentialContainment.

Test plan

  • Updated session-metadata.test.ts with legacy migration, explicit-policy precedence, and default-uncontained cases.
  • Updated session-prepare.test.ts and session-service.test.ts to assert per-provider containment outcomes for GitHub-only, GitLab-only, Kilo-only, and mixed policies.
  • Existing token-resolution assertions updated to the new credentialContainment shape.

Replace the single MANAGED_SCM_CONTAINMENT_ORG_IDS env var and managedScmContainment
boolean with per-provider containment allow-lists (GITHUB_TOKEN_CONTAINMENT_ORG_IDS,
GITLAB_TOKEN_CONTAINMENT_ORG_IDS, KILOCODE_TOKEN_CONTAINMENT_ORG_IDS) and a
credentialContainment { github, gitlab, kilocode } workspace metadata field.

Add getEffectiveCredentialContainment and requiresContainmentSandbox helpers that
migrate legacy managedScmContainment metadata. Token resolution and sandbox routing
now respect per-provider containment independently.
Comment thread services/cloud-agent-next/src/persistence/session-metadata.ts
Comment thread services/cloud-agent-next/src/session-service.ts
@kilo-code-bot

kilo-code-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
services/cloud-agent-next/src/persistence/session-metadata.ts 214 New containment metadata is lost by older workers during rollback or mixed-version reads
services/cloud-agent-next/src/session-service.ts 1921 Fresh Kilo capabilities are not applied to a reused warm Kilo runtime

Fix these issues in Kilo Cloud

Files Reviewed (15 files)
  • services/cloud-agent-next/.dev.vars.example - 0 issues
  • services/cloud-agent-next/src/agent-sandbox/cloudflare/cloudflare-agent-sandbox.test.ts - 0 issues
  • services/cloud-agent-next/src/agent-sandbox/cloudflare/cloudflare-agent-sandbox.ts - 0 issues
  • services/cloud-agent-next/src/kilo-facade/session-proxy.ts - 0 issues
  • services/cloud-agent-next/src/persistence/CloudAgentSession.ts - 0 issues
  • services/cloud-agent-next/src/persistence/session-metadata.test.ts - 0 issues
  • services/cloud-agent-next/src/persistence/session-metadata.ts - 1 issue
  • services/cloud-agent-next/src/persistence/types.ts - 0 issues
  • services/cloud-agent-next/src/session-prepare.test.ts - 0 issues
  • services/cloud-agent-next/src/session-service.test.ts - 0 issues
  • services/cloud-agent-next/src/session-service.ts - 1 issue
  • services/cloud-agent-next/src/session/session-registration.ts - 0 issues
  • services/cloud-agent-next/src/types.ts - 0 issues
  • services/cloud-agent-next/worker-configuration.d.ts - 0 issues
  • services/cloud-agent-next/wrangler.jsonc - 0 issues

Reviewed by gpt-5.6-sol-20260709 · Input: 313.2K · Output: 21.6K · Cached: 6.5M

Review guidance: REVIEW.md from base branch main

@eshurakov eshurakov merged commit 9d39566 into main Jul 12, 2026
15 checks passed
@eshurakov eshurakov deleted the tangy-paste branch July 12, 2026 19:01
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.

2 participants