Skip to content

feat(comms): org-management agent tools — comms adapters, hub dispatch, spawn role/persona (RIG-2673) - #630

Draft
rigel-mintaka wants to merge 1 commit into
compass-server/rig-2724-org-mgmt-protofrom
compass-server/rig-2724-org-mgmt-handlers
Draft

feat(comms): org-management agent tools — comms adapters, hub dispatch, spawn role/persona (RIG-2673)#630
rigel-mintaka wants to merge 1 commit into
compass-server/rig-2724-org-mgmt-protofrom
compass-server/rig-2724-org-mgmt-handlers

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

This PR is part of a stack containing 2 PRs:

  1. main
  2. feat(proto): org-management comms + spawn arms for agent gateway (RIG-2673) #628
  3. "feat(comms): org-management agent tools — comms adapters, hub dispatch, spawn role/persona (RIG-2673)" (this PR)

Wires the compass-server half of the org-management agent tools (RIG-2673 T2–T4) on top of the T1 proto arms (#628): the three comms adapters, their hub dispatch, and the spawn role/persona thread-through. Every operation flows through the existing agent→Runner→Server relay under the server-resolved account, so the authz, idempotency, and event fan-out are identical to a human caller's.

T2 — comms adapters (go/internal/comms/agent_caller.go)

CreateChannelAsAccount, UpdateChannelMembersAsAccount, CreateChannelGroupAsAccount — each mirrors UpdatePinnedBoardAsAccount: guard empty account → errNoActor, then WithActor + the shared handler path, returning resp.Msg. No home-channel defaulting (create-channel names no channel; update-members carries channel_id explicitly; create-group names only an optional parent). Founding membership rides CreateChannel's expandOwnerMembership, so a Manager can immediately post to the channel it just made.

T3 — hub dispatch (go/internal/runnerhub/hub.go, relay_comms.go)

Extended the CommsCaller interface with the three methods and added three executeCall cases on the Pin pattern, each wrapping the matching CommsCallResult oneof. The default-case error string's variant list now includes the three new arms. A tool error renders in-band as CommsCallError, never a stream teardown.

T4 — spawn role/persona thread-through (go/server/lifecycle.go)

Dropped the Persona: "" / Role: "" hardcodes in the store.CreateAgent literal for req.GetPersona() / req.GetRole(). Under the D9 owner-acts model the caller's owner is the authority, so a Manager-creating spawn legitimately carries role+persona set-at-creation; the values are stored via CreateAgent (the source of record) and threaded to the Runner from the created store account — an empty-field spawn is byte-identical to today's field-less spawn.

Tests (red-green)

  • T2 pgtests (org_mgmt_pgtest_test.go): founder-membership + ChannelChanged fan-out, member-add, group-create; each with empty-account → errNoActor and an invisible/non-member target → CodeNotFound (the D9 collapse a human gets).
  • T3 relay tests (relay_org_mgmt_test.go): each arm forwards under the bound account with call_id round-trip; a create-channel tool error is in-band, not a transport teardown.
  • T4 spawn pgtests (spawn_role_persona_pgtest_test.go): role and persona each stored + on the Provision wire; empty-field spawn stores + wires empty (wire-level regression); idempotent re-spawn keeps stored values.

Verified: go build ./..., gofmt, compass-go:lint (0 issues), and the affected internal/comms / internal/runnerhub / server suites all green (pgtests via the throwaway-container path).

Refs RIG-2724, RIG-2673.

Co-authored-by: Matt Wilkinson matt@rigel.build

@linear-code

linear-code Bot commented Aug 25, 2026

Copy link
Copy Markdown

RIG-2724

RIG-2673

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown

Compass engineering docs preview: https://compass-server-rig-2724-org-au33.compass-eng-docs.pages.dev

Deployed from compass-server/rig-2724-org-mgmt-handlers at 10fb626.

@rigel-mintaka
rigel-mintaka force-pushed the compass-server/rig-2724-org-mgmt-proto branch from 60728dd to 836c472 Compare August 25, 2026 23:05
@rigel-mintaka
rigel-mintaka force-pushed the compass-server/rig-2724-org-mgmt-handlers branch from 11db9be to 9584e0b Compare August 25, 2026 23:30
…h, spawn role/persona (RIG-2673)

Wires the compass-server half of the org-management agent tools (RIG-2673 T2–T4) on top of the T1 proto arms (#628): the three comms adapters, their hub dispatch, and the spawn role/persona thread-through. Every operation flows through the existing agent→Runner→Server relay under the server-resolved account, so the authz, idempotency, and event fan-out are identical to a human caller's.

### T2 — comms adapters (`go/internal/comms/agent_caller.go`)

`CreateChannelAsAccount`, `UpdateChannelMembersAsAccount`, `CreateChannelGroupAsAccount` — each mirrors `UpdatePinnedBoardAsAccount`: guard empty account → `errNoActor`, then `WithActor` + the shared handler path, returning `resp.Msg`. No home-channel defaulting (create-channel names no channel; update-members carries `channel_id` explicitly; create-group names only an optional parent). Founding membership rides `CreateChannel`'s `expandOwnerMembership`, so a Manager can immediately post to the channel it just made.

### T3 — hub dispatch (`go/internal/runnerhub/hub.go`, `relay_comms.go`)

Extended the `CommsCaller` interface with the three methods and added three `executeCall` cases on the `Pin` pattern, each wrapping the matching `CommsCallResult` oneof. The default-case error string's variant list now includes the three new arms. A tool error renders in-band as `CommsCallError`, never a stream teardown.

### T4 — spawn role/persona thread-through (`go/server/lifecycle.go`)

Dropped the `Persona: ""` / `Role: ""` hardcodes in the `store.CreateAgent` literal for `req.GetPersona()` / `req.GetRole()`. Under the D9 owner-acts model the caller's owner is the authority, so a Manager-creating spawn legitimately carries role+persona set-at-creation; the values are stored via `CreateAgent` (the source of record) and threaded to the Runner from the created store account — an empty-field spawn is byte-identical to today's field-less spawn.

### Tests (red-green)

- T2 pgtests (`org_mgmt_pgtest_test.go`): founder-membership + `ChannelChanged` fan-out, member-add, group-create; each with empty-account → `errNoActor` and an invisible/non-member target → `CodeNotFound` (the D9 collapse a human gets).
- T3 relay tests (`relay_org_mgmt_test.go`): each arm forwards under the bound account with `call_id` round-trip; a create-channel tool error is in-band, not a transport teardown.
- T4 spawn pgtests (`spawn_role_persona_pgtest_test.go`): role and persona each stored + on the Provision wire; empty-field spawn stores + wires empty (wire-level regression); idempotent re-spawn keeps stored values.

Verified: `go build ./...`, `gofmt`, `compass-go:lint` (0 issues), and the affected `internal/comms` / `internal/runnerhub` / `server` suites all green (pgtests via the throwaway-container path).

Refs RIG-2724, RIG-2673.

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@rigel-mintaka
rigel-mintaka force-pushed the compass-server/rig-2724-org-mgmt-handlers branch from 9584e0b to 10fb626 Compare August 25, 2026 23:40
@rigel-mintaka
rigel-mintaka marked this pull request as draft August 26, 2026 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant