Let named operators assign the agent work, when the operator opts them in

Merged
JE
2mo ago
+335-18

Ports --allow-assignments-from-authorized from basecamp-local-agent-connector. Stacked on #843 (base connect-role): the two touched the same trust code and setup text, so this is rebased onto #843 with the conflicts resolved. It retargets to main once #843 merges. On #843 the opt-in also covers operators named beside --trust project, and a test holds that the project's members still can't assign.

Why the local connector's caution doesn't carry over

The local connector keeps assignments operator-only by default because it reads the assigner from a webhook payload it can't corroborate, so there the opt-in rests on a secret URL path. Here the assigner is the account feed's creator_id / performed_by_id. Basecamp writes that from the session that made the change; no payload carries it, and the gate already trusts it for every other trigger.

So naming someone and opting them in trusts that person, not text claiming to be them. Admission still reads the recording's events to confirm this assignment added the agent, and that the agent is still assigned (invariant 2).

What changes

  • connect.json gains trust.allow_assignments.
  • Gate: Policy.Validate refuses allow_assignments when the allowlist names nobody. The gate opens the assigned rule to a performer the allowlist names only when the opt-in is on. Project members, strangers and agents gain nothing.
  • Setup: connect setup --allow-assignments-from-authorized turns it on, and =false turns it off. Leaving the flag out keeps what the file has. Setting it with nobody named is refused, and a run that leaves nobody named drops it, so the file never carries an opt-in nobody can use. It's added to guided setup's policy flags.
  • Docs: connect show says "they may assign". The setup help, the admission invariants and the skill's phrase table follow.

Tests

Each fails without the change:

  • TestNamedOperatorsMayAssignWhenOptedIn (admission)
  • TestApplyAssignmentOptIn (setup)
  • TestConnectSetupOptsNamedOperatorsInToAssignments (command)

make check passes on linux.


Summary by cubic

Lets named operators assign the agent work, when the operator opts them in.

  • --allow now works with --trust project, and the assignment opt-in (--allow-assignments-from-authorized) rides with --allow: a run that passes --allow restates it, off unless the flag is passed again, and a run that passes neither keeps both.
  • The opt-in is recorded as trust.allow_assignments. Setting it with nobody named is refused, as is an allowlist naming only the operator; a run that leaves nobody named drops it. The assigner is the account feed's performer, which Basecamp writes, so naming someone trusts that person.
  • Admission still confirms the recording's events show this assignment added the agent and that the agent is still assigned.