Skip to content

feat(cloud-agent): scoped runtime credentials (2/3) - #5975

Open
pandemicsyn wants to merge 11 commits into
mainfrom
split/token-cloud-agent
Open

feat(cloud-agent): scoped runtime credentials (2/3)#5975
pandemicsyn wants to merge 11 commits into
mainfrom
split/token-cloud-agent

Conversation

@pandemicsyn

@pandemicsyn pandemicsyn commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Change

Add Cloud Agent scoped runtime credentials, isolation, renewal/recovery, and web producer wiring. Lost-response create retries retain runtime authorization. Recovery failures emit credential-free diagnostics, including throttled warnings for prolonged locks, while preserving retirement fences.

Stack: foundation #5974Cloud Agent #5975remaining families #5976. Original #5857 remains unchanged.

Rollout

Resolve the outstanding Cloud Agent smoke failures before merging. Then wait for the foundation deployment to be healthy before merging this PR.

Setting Ships as Next action
Worker RUNTIME_ISOLATION_ENABLED true, production and dev Verify deployed Worker and wrapper readiness
Web SHARED_RESOURCE_TOKENS_ENABLED Off Enable after this deployment is healthy and verified
Web CLOUD_AGENT_RESOURCE_TOKENS_ENABLED Off Enable with the web master after readiness verification
All other producer flags Off Activate separately

Isolation permits modern workspace admission; it does not issue modern tokens or migrate legacy sessions. Cloud Agent activation does not need to wait for #5976. Rollback stops new issuance while retaining readers and runtime support for existing credentials.

Validation

  • Current checks: 5,906 unit tests passed (3 skipped), 651 Workers integration tests passed, and Worker/wrapper typechecks, service lint, formatting, and diff checks passed.
  • Earlier validation: 1,251 wrapper tests and 49 focused web tests passed across full runs and isolated timing retries. These suites were not rerun for the registration/diagnostic changes.
  • Real smoke remains incomplete: latest original-branch matrix passed 9/13; CLI/container startup, recovery, and SDK cold-wake failures remain.

@pandemicsyn
pandemicsyn marked this pull request as ready for review September 8, 2026 17:24
@kilo-code-bot

kilo-code-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Incremental commits restore runtime-authorization seals on create retries, attest model-validation and control-plane ingest, and add recovery diagnostics; previous findings are resolved and no new high-confidence issues were found.

Files Reviewed (19 files)
  • .github/workflows/ci.yml
  • apps/web/src/app/api/gateway/model-validation.integration.test.ts
  • services/cloud-agent-next/src/kilo/__fixtures__/runtime-url-normalization.ts
  • services/cloud-agent-next/src/kilo/kilo-targets.test.ts
  • services/cloud-agent-next/src/model-validation.test.ts
  • services/cloud-agent-next/src/model-validation.ts
  • services/cloud-agent-next/src/persistence/CloudAgentSession.ts
  • services/cloud-agent-next/src/sandbox-session/SandboxSession.ts
  • services/cloud-agent-next/src/sandbox-session/control-plane-ingest.ts
  • services/cloud-agent-next/src/sandbox-session/session-message-queue.test.ts
  • services/cloud-agent-next/src/session/model-preflight.test.ts
  • services/cloud-agent-next/src/session/model-preflight.ts
  • services/cloud-agent-next/src/session/runtime-authorization-persistence.test.ts
  • services/cloud-agent-next/src/session/runtime-authorization-persistence.ts
  • services/cloud-agent-next/src/session/session-prepare.test.ts
  • services/cloud-agent-next/src/session/session-registration.ts
  • services/cloud-agent-next/test/integration/runtime-authorization-recovery.test.ts
  • services/session-ingest/test/postgres/control-plane-ingest.test.ts
  • services/session-ingest/vitest.postgres.config.ts
Previous Review Summary (commit c2f50a5)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit c2f50a5)

Status: 2 Issues Found | Recommendation: Address before merge

Fix these issues in Kilo Cloud

Overview

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

CRITICAL

File Line Issue
services/cloud-agent-next/src/session/session-registration.ts 959 Lost-response retries persist the caller control token as kilocodeToken without a runtime-authorization seal

WARNING

File Line Issue
services/cloud-agent-next/src/session/session-registration.ts 567 Modern-admission inferred from unverified jwt.decode of aud/tokenPurpose/credentialExchange
Files Reviewed (111 files)
  • ENVIRONMENT.md
  • apps/web/src/lib/auto-fix/triggers/prepare-fix-payload.test.ts
  • apps/web/src/lib/auto-fix/triggers/prepare-fix-payload.ts
  • apps/web/src/lib/auto-triage/triggers/prepare-triage-payload.test.ts
  • apps/web/src/lib/auto-triage/triggers/prepare-triage-payload.ts
  • apps/web/src/lib/cloud-agent-next/worktree-chat.test.ts
  • apps/web/src/lib/cloud-agent-next/worktree-chat.ts
  • apps/web/src/lib/code-reviews/triggers/prepare-review-payload.ts
  • apps/web/src/lib/security-agent/services/analysis-service.test.ts
  • apps/web/src/lib/security-agent/services/analysis-service.token-source.test.ts
  • apps/web/src/lib/security-agent/services/analysis-service.ts
  • apps/web/src/routers/app-builder-router.ts
  • apps/web/src/routers/app-builder-token-source.test.ts
  • apps/web/src/routers/cli-sessions-v2-router.test.ts
  • apps/web/src/routers/cli-sessions-v2-router.ts
  • apps/web/src/routers/cli-sessions-v2-worktree.test.ts
  • apps/web/src/routers/cloud-agent-next-router.test.ts
  • apps/web/src/routers/cloud-agent-next-router.ts
  • apps/web/src/routers/organizations/organization-app-builder-router.ts
  • apps/web/src/routers/organizations/organization-cloud-agent-next-router.test.ts
  • apps/web/src/routers/organizations/organization-cloud-agent-next-router.ts
  • services/cloud-agent-next/.dev.vars.example
  • services/cloud-agent-next/src/kilo-facade/user-kilo-facade.ts
  • services/cloud-agent-next/src/kilo/__fixtures__/runtime-url-normalization.ts
  • services/cloud-agent-next/src/kilo/kilo-targets.test.ts
  • services/cloud-agent-next/src/kilo/runtime-credential-proxy-routes.ts
  • services/cloud-agent-next/src/kilo/wrapper-client.ts
  • services/cloud-agent-next/src/persistence/CloudAgentSession.ts
  • services/cloud-agent-next/src/persistence/SandboxControl.ts
  • services/cloud-agent-next/src/router.test.ts
  • services/cloud-agent-next/src/router/handlers/session-execution.ts
  • services/cloud-agent-next/src/router/handlers/session-prepare.ts
  • services/cloud-agent-next/src/router/handlers/session-send.ts
  • services/cloud-agent-next/src/router/handlers/session-start.ts
  • services/cloud-agent-next/src/router/handlers/session-worktree.test.ts
  • services/cloud-agent-next/src/router/handlers/session-worktree.ts
  • services/cloud-agent-next/src/runtime-credential-proxy-rpc.test.ts
  • services/cloud-agent-next/src/runtime-credential-proxy-rpc.ts
  • services/cloud-agent-next/src/runtime-credential-proxy.test.ts
  • services/cloud-agent-next/src/runtime-credential-proxy.ts
  • services/cloud-agent-next/src/sandbox-control/frames.ts
  • services/cloud-agent-next/src/sandbox-control/lifecycle.test.ts
  • services/cloud-agent-next/src/sandbox-control/session-credentials.test.ts
  • services/cloud-agent-next/src/sandbox-control/session-credentials.ts
  • services/cloud-agent-next/src/sandbox-control/socket.test.ts
  • services/cloud-agent-next/src/sandbox-control/socket.ts
  • services/cloud-agent-next/src/sandbox-control/vercel-network-policy.test.ts
  • services/cloud-agent-next/src/sandbox-control/vercel-network-policy.ts
  • services/cloud-agent-next/src/sandbox-session/SandboxSession.ts
  • services/cloud-agent-next/src/sandbox-session/control-rpc.test.ts
  • services/cloud-agent-next/src/sandbox-session/control-rpc.ts
  • services/cloud-agent-next/src/sandbox-session/session-client.ts
  • services/cloud-agent-next/src/sandbox-session/session-message-queue.test.ts
  • services/cloud-agent-next/src/sandbox-session/session-operation.ts
  • services/cloud-agent-next/src/sandbox-session/terminal-lifecycle.ts
  • services/cloud-agent-next/src/server-stream-ticket.test.ts
  • services/cloud-agent-next/src/server.test.ts
  • services/cloud-agent-next/src/server.ts
  • services/cloud-agent-next/src/session-service.test.ts
  • services/cloud-agent-next/src/session-service.ts
  • services/cloud-agent-next/src/session/agent-runtime.ts
  • services/cloud-agent-next/src/session/queue-message.test.ts
  • services/cloud-agent-next/src/session/queue-message.ts
  • services/cloud-agent-next/src/session/runtime-authorization-persistence.test.ts
  • services/cloud-agent-next/src/session/runtime-authorization-persistence.ts
  • services/cloud-agent-next/src/session/session-message-state.ts
  • services/cloud-agent-next/src/session/session-prepare.test.ts
  • services/cloud-agent-next/src/session/session-registration.ts - 2 issues
  • services/cloud-agent-next/src/shared/sandbox-control-protocol.ts
  • services/cloud-agent-next/src/shared/wrapper-bootstrap.ts
  • services/cloud-agent-next/src/terminal/access.ts
  • services/cloud-agent-next/src/types.ts
  • services/cloud-agent-next/test/e2e/README.md
  • services/cloud-agent-next/test/e2e/client.ts
  • services/cloud-agent-next/test/e2e/fake-llm-server.ts
  • services/cloud-agent-next/test/e2e/lifecycle.ts
  • services/cloud-agent-next/test/e2e/sandbox-control.ts
  • services/cloud-agent-next/test/e2e/smoke-cleanup.ts
  • services/cloud-agent-next/test/e2e/smoke.ts
  • services/cloud-agent-next/test/integration/runtime-authorization-recovery.test.ts
  • services/cloud-agent-next/test/integration/sandbox-control.test.ts
  • services/cloud-agent-next/test/integration/session/idle-reconciliation.test.ts
  • services/cloud-agent-next/test/unit/fake-llm-server.test.ts
  • services/cloud-agent-next/test/unit/smoke-cleanup.test.ts
  • services/cloud-agent-next/test/unit/wrapper/worktree-credential-refresh.test.ts
  • services/cloud-agent-next/worker-configuration.d.ts
  • services/cloud-agent-next/wrangler.jsonc
  • services/cloud-agent-next/wrangler.test.jsonc
  • services/cloud-agent-next/wrapper/src/control/apply-attach.test.ts
  • services/cloud-agent-next/wrapper/src/control/apply-attach.ts
  • services/cloud-agent-next/wrapper/src/control/control-event-transport.test.ts
  • services/cloud-agent-next/wrapper/src/control/control-event-transport.ts
  • services/cloud-agent-next/wrapper/src/control/control-test-fixtures.ts
  • services/cloud-agent-next/wrapper/src/control/delete-worktree.test.ts
  • services/cloud-agent-next/wrapper/src/control/delete-worktree.ts
  • services/cloud-agent-next/wrapper/src/control/main.ts
  • services/cloud-agent-next/wrapper/src/control/native-observations.ts
  • services/cloud-agent-next/wrapper/src/control/operation-registry.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-client.test.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-client.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-handlers.test.ts
  • services/cloud-agent-next/wrapper/src/control/sandbox-control-handlers.ts
  • services/cloud-agent-next/wrapper/src/control/session-operation-cleanup.test.ts
  • services/cloud-agent-next/wrapper/src/control/terminal-runtime.test.ts
  • services/cloud-agent-next/wrapper/src/control/terminal-runtime.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-mutation-notifications.test.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-mutation-notifications.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-runtime-cleanup.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-runtime.test.ts
  • services/cloud-agent-next/wrapper/src/control/worktree-runtime.ts
  • services/cloud-agent-next/wrapper/src/session-bootstrap.test.ts

Reviewed by grok-4.6 · Input: 301.1K · Output: 27.4K · Cached: 1.6M

Review guidance: REVIEW.md from base branch split/token-foundation

@intentionally-left-nil intentionally-left-nil left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too much code to review, here's a first pass :)

Comment thread services/cloud-agent-next/src/kilo/__fixtures__/runtime-url-normalization.ts Outdated
Comment thread services/cloud-agent-next/src/persistence/CloudAgentSession.ts Outdated
Comment thread services/cloud-agent-next/src/persistence/CloudAgentSession.ts Outdated
Comment thread services/cloud-agent-next/src/persistence/CloudAgentSession.ts
Comment thread services/cloud-agent-next/src/session/session-registration.ts
Comment thread services/cloud-agent-next/src/session/session-registration.ts
Base automatically changed from split/token-foundation to main September 9, 2026 18:39
Preserve runtime isolation documentation and use scoped control tokens for the newly added worktree file routes.
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.

3 participants