Repository navigation
Conversation
Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>
Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>
Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>
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
A task spawned from chat (orchestration
spawn_task) inherits the operator's company selection as atask_scoperow stampedsource='agent',approved_by_operator=false.taskSandboxRunInfo(server/sandbox.go) builds the per-task egress allowlist only from operator-approved rows, so the proxy starts with an EMPTY allowlist and denies every connection (403 on in-scope targets). Nothing in the UI says why: the task still shows the company link, the agent's self-repair (add_task_scope/add_company_scope) writes more unapproved rows, and even an approval cannot help the running task because the allowlist freezes at spawn. The HTTPPOST /api/taskspath approves the same selection, so the two operator surfaces silently disagree. Second user confirms in the issue comments.Behavior change
Loud, not silent (the issue's suggested minimum fix; no approval or egress logic changes, no security-posture change):
server/sandbox.go: newemptyEgressScopeWarning(pg, tid, info)returns a warning when the computed allowlist is empty AND the task has at least onetask_scoperow. Empty string otherwise (approved scope, or genuinely scopeless task).server/engine.go(Engine.Run, sandbox-required path, next to the existing sandbox-unavailable / sandbox=off system notices): when the warning is non-empty, log it and append aKind:"system", IsError:trueactivity row to the task feed: "sandbox egress empty: this task has N scope row(s), but none currently grant egress, so every connection from the sandbox will be denied. Agent-added scope is coverage-only until an operator approves it, and the allowlist freezes at spawn: approve the scope, then restart the task."Deliberately NOT included: the issue's option 1 (server-side
conversations.company_idbinding and approving chat-selected companies) is a larger architectural change for maintainers to weigh.What was tested
New PG-backed test
TestEmptyEgressScopeWarning(server/sandbox_empty_egress_warning_test.go, same ARTEX_PG_DSN harness as the existing sandbox scope tests):CompanyScopeByAgent: true(exactly thespawn_taskpath) - allowlist empty, warning present and points at operator approval.Fail-first evidence: on the clean tree the test fails to build (undefined
emptyEgressScopeWarning); with the implementation it passes; with the helper mutated to always return "" the test fails at the case-1 assertion; restored, green again.Validation run locally (Postgres 14.11):
go test ./server/ -run 'TestEmptyEgressScopeWarning|TestSandboxScopeDrift|TestSandboxCompanyEgress' -count=1- all 3 pass.go test ./server/ -count=1- only pre-existing environment failure isTestConnectWithoutPasswordRealPG(expects password auth; local test PG uses trust auth). Same failure reproduced on the clean tree, unrelated to this change.go vet ./server/andgo build ./...clean.Addresses #830.