Repository navigation
API: recordDesktopInstallation, record the OpenBot Desktop installation the caller signed in from - #2932
Merged
davidmckayv merged 3 commits intoDec 4, 2026
Conversation
…on the caller signed in from A new operation, POST /api/v2/people/me/desktop-installations, so usage data can join what an OpenBot Desktop installation did before a sign-in with what the person does after it. One operation for both ways Desktop signs in: where the window holds the sign-in, Desktop hands the page the installation's usage-data id with the sign-in's code, and the page sends it with its own session once the code is traded; where Desktop signs in itself, Desktop sends it with that sign-in. Desktop hands the id over only while the person shares usage data. The body is one random (version 4) UUID, installationId, and nothing else; any other version is refused. A client sends it once per sign-in with a new Idempotency-Key and never retries, so an older server's 404 changes nothing. The server sends it with its product telemetry beside the caller's pseudonym, with an event id that repeats for the same caller and installation, and accepts and drops it where product telemetry is off (204 either way). webSession and appOAuth (conversations:write, which Desktop's openbot scope covers) may send it; an API key may not. It sits outside an organization: an installation is the person's, and the window's page has just signed in and names none. The lint rule's list of addresses outside an organization gains it, with that reason. api/openapi-desktop-installations.test.ts holds the spec to that: one POST with an Idempotency-Key, 204 as the one success, the two sign-ins and nothing else, and a strict body that refuses other UUID versions and any other field. Spec only: no client sends it yet, and no server serves it.
…oud's sign-in as a caller Desktop's usage-data switch is consent to CopilotKit, not to a company's own server, so the description now says the id goes to OpenBot Cloud only: Desktop hands it to the page, or sends it itself, only when the address it signed in to is OpenBot Cloud, and a self-hosted OpenBot never receives it from Desktop. The server still accepts and drops it where product telemetry is off, whoever sends it. It names Move to Cloud's sign-in as the caller where Desktop signs in itself, and states the dedupe key: the event id is made from the deployment, the caller's pseudonym and the lower-cased installation id, so the window and Move to Cloud sending it for one person count once. The spec test pins those three lines of the description.
…d-desktop-installation-spec
ACl365
marked this pull request as ready for review
December 4, 2026 14:49
ACl365
requested review from
MikeRyanDev,
davidmckayv,
dustywusty,
guidovizoso,
mxmzb,
samjulien and
tylerslaton
as code owners
December 4, 2026 14:49
davidmckayv
approved these changes
Dec 4, 2026
davidmckayv
left a comment
Contributor
There was a problem hiding this comment.
Thanks, Alex. This matches what we agreed, and it's ready to merge.
- It sits under
/api/v2/people/me, next to organizations and account deletion, and the lint list says why. - The description says OpenBot Cloud only, names Move to Cloud's sign-in as a caller, states the event-id dedupe and keeps the drop when telemetry is off.
- The page sends it with its session and Desktop with its own sign-in. There's no API key, unlike nudge-events, and the test pins that difference.
- The body is one v4 UUID with nothing else allowed, the answer is 204 with no 404, and the Idempotency-Key is required. That's all additive, and API spec is green on the head.
One optional wording fix, if you touch it again: "distinct ids still count the link once" reads like it means PostHog's distinct_id. "It still counts once" says the same thing more clearly.
Merge it when you're ready, then open the server handler pinned to the merge.
ACl365
enabled auto-merge
December 4, 2026 15:29
davidmckayv
deleted the
alex/2026-12-04/record-desktop-installation-spec
branch
December 4, 2026 15:53
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Adds one operation to the spec,
recordDesktopInstallation(POST /api/v2/people/me/desktop-installations), so usage data can join what an OpenBot Desktop installation did before a sign-in with what the person does after it. Spec first: the spec, the bundle, the generated clients and a spec test. No app sends it yet and no server answers it yet; that comes in the follow-up.OpenBot Cloud only. Desktop hands the id to the page, or sends it itself, only when the address it signed in to is OpenBot Cloud: a self-hosted OpenBot never receives it from Desktop, and the server still drops a valid report where product telemetry is off. The callers are the window's page with its session, and Desktop with its own sign-in, which today is Move to Cloud's.
nextwithout waiting. Desktop never uses the window's cookie.appOAuth; Desktop'sopenbotscope coversconversations:write).The body is one field,
installationId: the random (version 4) UUID Desktop sends its usage data under at the sign-in, which Desktop's own events already carry as theirdeployment_id. Desktop makes a new one when usage data is turned off and on again, or when the account it is tied to changes or signs out. Any other UUID version (v1 carries a time and a hardware address, v7 a time) and any other field are refused. The answer is204, including where product telemetry is off and the report is dropped.A client sends it once per sign-in with a new
Idempotency-Key, waits on nothing, and treats any answer but204alike, never retrying. So an older OpenBot that answers404changes nothing; Desktop is often newer than the OpenBot it connects to, and the window's page always comes from the same server it calls. The server's event id is a hash of the deployment scope, the caller's pseudonym and the lower-cased installation id, so it repeats for the same caller and installation, and distinct ids count each link once per deployment.Dedupe: the event id is made from the deployment, the caller's pseudonym and the lower-cased installation id, so the window and Move to Cloud sending it for one person count once.
When the server half lands, it sends
oss.runtime.openbot.desktop_installation_linkedwith the common properties,installation_id(lower-cased), andcredential(sessionorapp_token), which the server reads from the credential itself, never from the body. docs/TELEMETRY.md gains that line with it.API keys are left out on purpose. The other product events accept one. This one records a sign-in from an installation, which an API key never is, and leaving it out is the direction that can change later: a scheme can be added, never taken away.
Why it sits outside an organization
The window's page has just traded the code when it sends this, and it knows no organization yet:
/desktop/signed-inis outside the signed-in area, and the current organization is unknown until the organization list answers. A fresh relay sign-in names none either. An installation is the person's, not an organization's, and the event's pseudonym doesn't depend on one. So the address sits beside/api/v2/people/me/organizations, as/api/v2/app-errorsand account deletion do, and the lint rule's list of addresses outside an organization gains it with that reason;api/redocly/rules.test.tspins it.The alternative turned down:
/api/v2/organizations/{organizationId}/desktop-installations, sent once the client knows an organization. The page would have to wait for the organization list before it moves on from the sign-in, and Desktop would have to read the caller's organizations page by page on the relay path, for an organization the event doesn't use.Where it runs
Idempotency-Keyrecord every write keeps. The stable event id is a hash, so nothing is stored to make it.deployment_idandKEY_ENCRYPTION_KEYgive the same pseudonym and event id.Boundary and audit
API and database
api/and keeps every rule in docs/api-and-migrations.md: one new operation, and nothing removed, renamed, retyped or tightened. No app's requests change yet. There is no database change and norelease-policy.jsonchange. This box gets ticked once CI's box below is.api/accepted-breaking-changes.md. The file is unchanged.bun run api:generaterun, with sources, bundle and clients committed together. At the head it changes nothing, andbun run api:lintis valid.release-policy.jsonunchanged.API specjob is green on the exact head. It hasn't run yet; see CI below.Changelog
API.
POST /api/v2/people/me/desktop-installations(recordDesktopInstallation). Says which OpenBot Desktop installation the caller signed in from, by the installation's random usage-data id, and only while the person shares usage data. It is best effort, and is accepted and dropped where product telemetry is off. No app sends it and no server answers it in this release.Proof
Tests across each boundary
api/openapi-desktop-installations.test.ts(new, 5 tests) reads the bundle the server and clients are built from: one POST with a requiredIdempotency-Key;204as the only success, with no body; no organization parameter and no404; exactlywebSessionorappOAuthconversations:write, the scope the other product events ask for; Desktop'sopenbotscope (connected/address.rs) covers it; the body is oneinstallationId, and the generated schema, made strict as the server reads it, accepts the spec's own example and upper-case hex, and refusesnot-a-uuid,{}, v1, v7, the nil UUID, and any extra field (email,organizationId,signInPath). The fifth pins the description's lines on who may receive the id (OpenBot Cloud only), every caller, and the dedupe key.api/redocly/rules.test.tspins the new address on the list outside an organization.Routes
The operation has one address and two callers. Every way a sign-in reaches it is the follow-up's route table (window sign-in with usage data on or off, a failed trade, a page from an older server, relay sign-in, sign in again, a resumed saved sign-in, sign-out or opt-out mid-flight, a server without the operation). This PR adds none of those code paths.
Red/green
api/redocly/rules.mjs,bun run api:lintrefuses the address: "/api/v2/people/me/desktop-installations is not under /api/v2/organizations/{organizationId}/". With this branch's, it is valid.Local runs
bun run api:generate, twice: the second run changes nothing.bun run api:lint: valid.oasdiff breakingagainst origin/main's bundle with the flags in docs/api-and-migrations.md: no breaking changes.bun test api/openapi-desktop-installations.test.ts api/redocly/rules.test.ts api/client-boundary.test.ts api/openapi-request-bodies.test.ts api/openapi-request-id.test.ts api/openapi-text-patterns.test.ts api/openapi-rate-limit.test.ts: 25 pass, 0 fail. The wholebun test api/: 141 pass, 14 skip, 0 fail.bunx biome format .: no fixes.Real build
None: nothing in this PR runs in an app or on a server.
CI
Green on the first head (35 pass, 3 skipped), after two re-runs of unrelated browser tests that failed on timing. Running on this head.
Merge order
Any order with #2927. Both add a line after
nudge-eventsinapi/openapi/conversations.yaml's product events and regenerateproduct-events.*. Whichever merges second runsbun run api:bundle && bun run api:generateafter the rebase and commits what changes.Rollback
Revert the commit. No app sends it and no server answers it yet.