Repository navigation
[AI-3810] Config writes hold the sensitive rule across agents - #2473
Conversation
…s and children (WIP) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ver parents and children Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ames the older one Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kanat
left a comment
There was a problem hiding this comment.
[security R1] VERDICT: GO
Reviewed the four config writes (create, update, patch, sync) that now run the sensitive-connector rule over a config's parents and children, and the new AgentConfigs.Calling query, merged onto current main.
| check | result |
|---|---|
| who can call | the four writes are server-side only; a user's device, a guest and an anonymous caller get 403 |
| tenancy | Calling and the sibling reads are scoped to the caller's app; another app's parent of the same name is neither weighed nor named |
| 400 text | names only the app's own configs, bindings and connector ids; no store or internal error text reaches the caller |
| mutations | 7 guards removed one at a time, all caught by tests |
Author question on a team-limited caller: not reachable, since these writes refuse every client-side caller and a backend has no team gate.
One Nit inline. Other points went to the ticket.
kanat
left a comment
There was a problem hiding this comment.
VERDICT: NO-GO
[main R1] Reviewed ddae318cf merged onto main 48e5f96a4. CI: draft, so go and integration are skipped; they run at gh pr ready.
Decided by R1.1 (Should fix, inline): the deleted-child branch of the graph check is not pinned by any test.
[Nit] R1.2 acceleration/internal/api/configs.go:197 (not in the diff). A create can use a name that is already taken, by a config that is a child of a sensitive parent. If that create also sends a binding with a tool that sends data out, base answers 409 name_taken. Head answers 400 with the graph message, which names the other config's parent. Shown by a scratch probe on base and head. main already orders the one-level-deep refusal before the name check in the same way. Fix: a ticket.
Author questions: (1) The team-limited caller is not reachable. The four writes are server-side only (withServerSide, server.go:1338). No finding. (2) A write is stricter than the run-time check for a child whose tool clashes with a built-in tool. This was accepted, and the PR body says so. No ticket.
Checked and sound:
- Touched suites on the merged tree:
ChildAgentsSuite,ConfigsSuiteandSyncSuite, 446 pass.StoreSuite:TestCalling…andTestAgentConfigQueryBudgetspass. Only the known localTestEveryHotTableIsReadByIndexsubtests fail, on tables this PR does not touch. - Hard rule. A scratch probe ran 4 more control rows on each of create, update, patch and sync. The rows: a parent sandbox that reaches the network beside a child that sends out, with nothing sensitive; a child's instructions save beside a sensitive parent and a sibling whose outbound tool needs approval; a sensitive child of two parents that have no tools; a sensitive parent with a read-only child. Each got the same 200 or 201 on base and head. The single-config check still runs before
childAgentsComplainton all four paths, and the diff leaves it as it was. NameCallinghas no other caller.parentOfnow names the oldest parent. A delete of a child is still a 409. A delete of the parent of a set that breaks the rule is still a 204 (probe).- Query.
Callingreads throughagent_configs_customer_idxand then filtersagents @>over the app's live configs. Neither base nor head has an index on the child name. EXPLAIN on a local test database took 0.33 ms for a 100-config app and 1.26 ms for a 3000-config app. It is one query per save, with no loop around it. - Mutations: 16 checked (8 mine, plus 8 of the author's rerun on the merged tree). 2 survived; both are under R1.1.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
kanat
left a comment
There was a problem hiding this comment.
VERDICT: GO
Delta round 2, reviewed 60d1300 (previous review ddae318). The base merge 04955ab is clean; the delta is two commits, a test row and one sentence.
Prior findings:
- R1.1 (Should fix, test-only): fixed. The new row "a sensitive parent that names a gone child first" passes on create, update, patch and sync. Both mutants now fail on all four paths: continue -> break and continue -> return "", true, nil.
- R1.3 (Question): fixed. The refusal now says to change the other agents first and save this one after. Probe: child first 400, parent drops nessy 200, child retry 200, so the advice holds. The runtime refusal in session/child_agents.go is unchanged.
- R1.2 (Nit, configs.go:197, unchanged code): still open, ticketed per policy.
- R1.3(b) concurrent writes (unchanged code): still open, ticketed as AI-3883.
New findings (Nit, not blocking):
- child_agents.go:156 — the sentence is also appended when GraphComplaint returns an error (ok is false, message empty). Callers check err first, so nothing observable. Optional: return on err before the append.
- child_agents.go:158 — "The other agents in these" reads loosely; "in this set" would be clearer. Optional.
Checks:
- ChildAgentsSuite, ConfigsSuite, SyncSuite on the head merged onto origin/main 48e5f96: 450 PASS, 0 FAIL. go vet and gofmt clean.
- Mutants: 3 checked (R1, R2, R9 sentence dropped), 0 survived.
- CI: draft; go and integration skipping, labeler and GitGuardian pass. Not waited for.
Details: /Users/kanat/.claude/ship-task/Vision-Agents/AI-3748/AI-3810/reviewer-2.md
Piece 2/2 of AI-3748. Piece 1 was #2432 (AI-3809). Ticket: AI-3810.
Why
The sensitive-connector rule says that a sensitive connector (one whose tools read private data) and something that sends data out with no person's approval cannot be in one agent config. #2432 extended the rule to a parent plus its child agents, but checked it only when the parent delegates at run time. Config writes still checked each config on its own. So a create, update, patch or sync could store a parent and its children that break the rule together, and the developer found out only when a delegation was refused.
How it works
Every save runs the check, including one that changes only an unrelated field. So a stored set that already breaks the rule refuses every save of its members until it is fixed, the same way the single-config check works. A save that removes the outbound binding is weighed without the stored copy, so the fix goes through.
require_approval(both directions)The refusal is
GraphComplaint's text, for example:the agent "<parent>"'s connector binding "<alias>" binds "<connector>", whose tools read private data, and connector binding "<alias>" of the agent "<child>" can send data out with no person's approval, and a parent and its child agents pass on to each other what they read: take them out of these agents. When arequire_approvalcould hold a tool, therequire_approvalhint is added.Decisions
withServerSide,server.go:1330), so the caller is a backend and is not limited by teams; no hidden config's name reaches an end user.Changes
store.AgentConfigs.NameCalling(one parent,LIMIT 1, no order) is nowCalling, which returns every live parent, oldest first.parentOf(the delete 409 and the existing refusals) names the oldest one.childAgentsComplaintno longer returns early for a plain child save, and it runssensitiveGraphComplaintlast. It also reads the parents by the name the config is about to have, so a rename into a name some parent calls is checked as that parent's child.connectors/providers/AGENTS.mdandconnectors/sensitive/AGENTS.md.Query
Every config save now runs one parents query. Before, only a save with agents, a rename or a mode change ran it.
NameCalling)Calling)Both plans use the same path, a bitmap scan of
agent_configs_name_idxoncustomer_id. In the usual case no config calls the one being saved, and then both queries read every live config of the app, becauseLIMIT 1stops early only when a row matches. I ran the plans on my local test database, where the customer had 7 configs: before, 3 buffers and 0.11 ms; after, 3 buffers and 0.06 ms (the second ran on a warm cache). I did not run them on production-sized data.Validation
internal/api/child_agents_writes_test.go:TestAWriteIsHeldToTheSensitiveConnectorRuleOverTheAgentsItWorksWith: 14 rows × 4 write paths, the table above.TestARenameIntoTheNameASensitiveParentCallsIsRefused.TestAChildWithTwoParentsNamesTheOlderOne.internal/store/agent_config_test.go:TestCallingIsEveryLiveParentOfAChildOldestFirst. It checks that the excepted, deleted and other-customer configs are left out.Callingfilters, order and limit, and one mutant per write-path call site (create, update, patch, sync). Two error returns are not tested: the store read failures inCallingandGetByName. No test may inject a Postgres failure on shared tables.ChildAgentsSuite(33 tests),ConfigsSuite(227) andSyncSuite(89) all pass. InStoreSuite, 1587 tests pass.TestEveryHotTableIsReadByIndexfails in 5 subtests (Requests, Sandboxes, UserOrganizations, ExportCustomer). It fails in exactly the same way on main 0430ce9 against the same database, and this PR does not touch those tables.go vetpasses with and without-tags integration, andgofmtis clean.🤖 Generated with Claude Code