Skip to content

add experiments, turned on per organization - #110

Merged
hkonsti merged 1 commit into
mainfrom
hkonsti/org-experiments
Oct 16, 2026
Merged

hkonsti merged 1 commit into
mainfrom
hkonsti/org-experiments

Conversation

@hkonsti

@hkonsti hkonsti commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

What

Experiments: features turned on for some organizations before everyone gets them.

  • Schema (v019_add_organization_experiments): Organization.experiments String[] holds the ids of the experiments that are on, and Organization.insider Boolean turns all of them on. Both are set from the internal admin (follow-up PR in personalagentproxy/internal). Nothing in the app sets them.
  • Registry (@proxy/utils, src/experiments.ts): EXPERIMENTS maps each id to what the admin calls it, and is empty for now. Experiment is its keys. When an experiment ships or is dropped, deleting it there makes the compiler point at every place that asked for it. Its id left in the database is ignored (organizationExperiments drops it).
  • Reading them costs no extra query: the session lookup (auth.ts) and both ways an agent signs in, cookie and MCP token (signed-in-agent.ts, shared by agent.ts and oauth.ts), select the organization's flags in the query they already run.

Using it

There are no consumers yet. This is the API:

// api, human side
if (!hasExperiment(request.user, 'plaid')) {
	return $(Err(ApiErr.notFound()));
}

// api, agent side and MCP
hasExperiment(signedIn, 'plaid');

// web app, under the human side's layout (off in the welcome flow)
const plaid = useExperiment('plaid');

/api/me answers experiments. Hiding something in the web app is only for looks; the API has to check too. The agent web pages' /api/agent/me doesn't include experiments yet; add it there when an agent page needs one.

Tested

  • organizationExperiments drops unknown ids and gives an insider every experiment; toSignedInAgent carries them and refuses a revoked agent.
  • Ran the three lookups against the local database: an org holding an id that isn't in EXPERIMENTS reads as [] from the session and the agent cookie.
  • bun run typecheck, bun run test, bun run lint.

Open workspace in Conductor

@hkonsti
hkonsti force-pushed the hkonsti/org-experiments branch from db89bff to 9b707ec Compare October 16, 2026 00:52
An organization's `experiments` hold the ids of the experiments on for it and `insider` turns all
of them on, both set from the internal admin. The session and both ways an agent signs in read
them in the same query, so `request.user`, `SignedInAgent` and `/api/me` carry the experiments on,
asked with `hasExperiment` in the api and `useExperiment` in the web app. `EXPERIMENTS` in
@proxy/utils names each; none yet.
@hkonsti
hkonsti force-pushed the hkonsti/org-experiments branch from 9b707ec to e153e8f Compare October 16, 2026 01:04
@hkonsti
hkonsti merged commit 7897bc3 into main Oct 16, 2026
2 checks passed
@hkonsti
hkonsti deleted the hkonsti/org-experiments branch October 16, 2026 01:12
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