Skip to content

Session roles: who can drive a Slack session - #1062

Merged
ZIJ merged 4 commits into
mainfrom
feat/session-roles
Nov 18, 2026
Merged

ZIJ merged 4 commits into
mainfrom
feat/session-roles

Conversation

@opencomputer-app

Copy link
Copy Markdown
Contributor

Requested by @ZIJ (Igor) in Slack. Spec: work 112 (mocks of the four user journeys are in its "User journeys" section).

What it does

A session stores its owner and one new field, drivers (* or a list of Slack user ids). Each gateway computes a role per event (owner, driver, participant, outsider) and gates on it. Default is *, so open threads behave as today except for the three changes below.

  • Access: an Access button on the session's first reply opens a private modal (everyone / only me / specific people); !access is the typed fallback. Restricted threads carry a 🔒 reaction. A change posts one line only when it lets more people drive.
  • Participants (members not on the list): messages are held and attached to the next driver message as context. A first mention posts a request the owner answers with Allow / Not now.
  • Stop: any member; the thread names a non-owner who stopped.

Behaviour changes to review

  1. !mode, !restart, !done are the owner's, in open threads too.
  2. A prompt's buttons work only for the driver whose message caused it, or the owner. Typed replies are unchanged.
  3. Production: guests and people from other organizations no longer instruct in someone else's session (no check today); their messages there are dropped.

Not verified (gates)

Nothing here has run against Slack. Before deploy, on a dev workspace:

  • reactions.add accepts the name lock;
  • real agent_session_stopped events carry user.

Review map

  • computer/src/access.ts, access-views.ts: pure rules, strings and Block Kit builders; byte-identical copies in services/managed-agents/src/computer/ (a test checks identity).
  • computer/src/gateway/access-{store,flow,ui}.ts and seams in routing.ts, main.ts, db.ts.
  • services/managed-agents/src/computer/access-{store,flow,ui}.ts and calls in durable-object.ts, slack.ts.
  • Runner: prompts.ts (asked driver), thread.ts (Access button), session.ts, main.ts.
  • Protocol: optional fields only, no version bump. Schema changes are additive.

Deploy order

Gateways before hosts. A new gateway with an old runner gates everything except "who may click a prompt" and shows no Access button (!access works).

Known rough edges

  • Production calls users.info once per message from a non-owner in an existing session, uncached.
  • Production: a refused prompt click loses its private note if the Durable Object hibernated in between (the click is still refused).
  • Removing a driver does not reach sessions already spawned from this one (spec, Known limits).

Verification

  • computer: npm run check passes (137 files, 992 tests). src/host/workspace-files.test.ts flaked once under load and passed on rerun, as on main.
  • services/managed-agents: npx tsc --noEmit clean; all computer-* tests pass (8 files, 138 tests run directly). Full npm test in this environment has failures outside this change: six files cannot load @opencode-ai/sdk/workerd, and seven tests time out in the full run and pass alone. CI is the authority there.

…ds (work 112)

computer/src/access.ts and access-views.ts hold roles, the permission table,
drivers encoding, !access parsing, the S1-S15 strings and the Block Kit
messages and modal, byte-identical in services/managed-agents/src/computer/
(checked by test/computer-access.test.ts). Protocol gains optional role
fields and NOT_ASKED; Linked gains context with its block sentence.
No behaviour change.
The gateway computes each sender's role from the session's owner and drivers
and gates messages, commands, prompt clicks and stop on it. Participants'
messages are held as context for the next driver message; a participant's
mention posts a request the owner answers. Access is changed from a modal
behind an Access button or with !access; restricted threads carry a lock
reaction. The runner lets only the asked driver or the owner click a prompt.

Spec: serverless-agents-ws .agents/work/112-session-roles-build-spec.md
The same rules as the self-host gateway at the Durable Object's seams: role
per event, held context, request to drive, the access modal and !access, the
lock marker, stop naming who stopped. Member is the secrets store's check,
now shared; admin is a Slack user linked to a dashboard owner or admin.

Spec: serverless-agents-ws .agents/work/112-session-roles-build-spec.md
@manicule-agent

manicule-agent Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

View docs preview
Commit 1ded1c5 · 80 pages

Docs hosted with Margin

- One gate: gateway commands and the secret form in a session thread need
  the right to instruct; only !access skips it.
- One user lookup in production (ThreadAccess): a failed users.info retries
  the message instead of reading as not-a-member.
- One delivery path: Allow requeues the held message through process.
- setDrivers takes an edit, validates (members, limit) and writes with no
  await between read and write.
- Request and context rows are the duplicate guards.
- Self-host: unknown people do nothing again; role logic moves from
  routing into the flow.
- !access add/remove on an open session answers usage.
@ZIJ
ZIJ merged commit bfcbe80 into main Nov 18, 2026
20 checks passed
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.

2 participants