fix(session-ingest): authorize contained subagent sessions - #4832
Merged
Conversation
2 tasks
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryReviewed the contained Cloud Agent subagent session-scope authorization changes across session-ingest, git-token-service, cloud-agent-next, worker-utils, and the PostgreSQL/SQLite schema/migrations, with focused attention on dual-auth enforcement, org/parent-metadata protection, root-before-child lock ordering, and migration safety; no high-confidence security, correctness, or breaking-change issues were found on changed lines. Files Reviewed (34 files)
Reviewed by claude-sonnet-5 · Input: 22 · Output: 11K · Cached: 437.2K Review guidance: REVIEW.md from base branch |
jeanduplessis
approved these changes
Jul 28, 2026
This was referenced Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix contained Cloud Agent subagent history by authorizing child-session bootstrap and ingest within the scope of the Cloud Agent session that spawned them, without introducing new CLI credentials or requiring a CLI rollout. The broadened child bootstrap/ingest path is exercised only for sessions whose organization has Kilo credential containment enabled; uncontained customers continue using the existing exact-root transport.
cloud_agent_session_scope_idto PostgreSQL session ownership and the Session Access Cache Durable Object, with self-healing for existing Cloud Agent roots.Verification
taskdirective: a realgeneralsubagent session was created, completed, and streamed live child events to the root session.Visual Changes
N/A
Reviewer Notes
KILOCODE_TOKEN_CONTAINMENT_ORG_IDS(or*for all organizations) and is disabled for devcontainer sessions. Only those contained sessions can use the new broadened child proxy/internal-route flow. The schema/root session-scope marker and Cloud Agent metadata hardening apply to all Cloud Agent roots, so the containment boundary does not exclude those shared changes.kilo_meta.orgIdfrom the sandbox could updatecli_sessions_v2.organization_idafter membership validation. This PR now rejects that update for Cloud Agent roots inservices/session-ingest/src/ingest/metadata.ts.Performance impact: expected low, with containment-specific behavior limited to enabled organizations and contention isolated to one Cloud Agent session
SessionAccessCacheDO, and no PostgreSQL transaction runs when the ingest DO reports no metadata changes.UPDATE ... RETURNINGfast path for simple title/platform/git metadata while retaining transactions for status, organization, and parent changes.