Repository navigation
Conversation
spawn_task stamps every company link approved_by_operator=false, so chat-spawned tasks start with an empty egress allowlist even for companies the operator fully approved (BaaRai#830; BaaRai#833 warns about the symptom). insertTaskCompanies now checks each selected company: one whose company_scope inventory exists and is entirely operator-approved carries standing consent - the link is inserted approved and the grant frozen in the same transaction, like an operator selection. Companies holding any unapproved row, or without scope rows, stay coverage-only: add_company_scope, the ScopeSentry sync and invented ids still cannot self-grant. source stays agent. Case 4 of sandbox_scope_drift_test is rewritten accordingly and gains two negative cases. Related: BaaRai#830, BaaRai#833.
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.
Problem
Follows from #830 and refines the shape sketched in my supplement there.
spawn_taskhardcodesCompanyScopeByAgent: true, so every company link a chat-spawned task carries is stampedapproved_by_operator=false— even when the operator had fully configured and approved that company's scope. The task starts with an empty egress allowlist and every connection 403s until the operator re-approves scope per task. #833 (open) warns about the symptom; this PR removes its most common cause.The premise is the one migration 0025 itself established: company-level
company_scoperows carry explicit operator consent (approved_by_operator, set only by the operator company API). But that consent was never consulted when an LLM selected the company at task creation.Change
All of it in
insertTaskCompanies(db/tasks.go) — no schema change, no server change,spawn_taskkeeps passingCompanyScopeByAgent: true:approved_by_operator=trueand its grant is frozen intotask_scope_egressin the same transaction, exactly like an operator selection (AddOperatorScopesemantics; the snapshot still copies 0025-approved rows only).add_company_scopeand the ScopeSentry sync — stays coverage-only, so the agent can never self-widen a spawn grant by appending one row to an operator company.sourcestaysagent; the approval column records who consented, row by row, auditable.The pre-0025 self-grant worry (
sandbox_scope_drift_test.gocase 4, which pinned "agent spawn of an operator-approved company must mint NO egress") predates the approval column: after 0025 the address set behind a fully approved company is exactly what the operator entered — inheriting it introduces no new address. The drift guardrails stand and are extended: agent-appended rows keep the whole company coverage-only, and empty inventories grant nothing (new negative cases in that test).Tests
db:TestSpawnInheritsFullyApprovedCompany— full/half/empty companies spawned in one call: link flags per company (true/false/false, allsource=agent), snapshot holds exactly the full company's approved rows, nothing leaks from the half company's approved row or the empty company.server:sandbox_scope_drift_test.gocase 4 rewritten — agent spawn now inherits the fully approved company (allowlist carries its domain + canary /32; proxy and WebFetch allow), plus the two new negative cases (half-approved company coverage-only and denied; no-scope company grants nothing).go test ./db ./intercept ./server -count=1—dbandinterceptfully green; inserverevery scope/egress/gate test green. The six failingservertests (TestIsolation*AsRoot) fail identically on pristinee38f58din the same container — pre-existing environment artifacts, untouched by this diff.go build ./...,go vet,gofmtclean.