You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 630cedc
Browse filesBrowse the repository at this point in the historyBrowse files
ben
authored
feat(workbot): track content-free adoption in Den (#6156)
* feat(workbot): track content-free adoption in Den
Record member-scoped admission and completion from trusted services rather than browser relay events. Reuse the telemetry tables and existing service credential, preserve first sightings atomically, and distinguish provider-reported model identity from configured fallback. Add a bounded read-only platform-admin funnel and content/privacy/authentication integration coverage.
Signed-off-by: Benjamin Shafii <benjamin.shafii@gmail.com>
* fix(workbot): preserve sign-in time across readiness probes
Record the authenticated sign-in instant before its asynchronous connection snapshot so a fast greeting cannot fall outside its adoption cohort. Exercise runner telemetry and Workbot sign-in tests in the existing CI lanes.
Signed-off-by: Benjamin Shafii <benjamin.shafii@gmail.com>
* test(workbot): keep fast greetings in delayed sign-in cohorts
Signed-off-by: Benjamin Shafii <benjamin.shafii@gmail.com>
* fix(workbot): correlate OAuth telemetry by public nonce
Never pass signed OAuth state through telemetry identity derivation. Reuse the transaction's public UUID directly for deduplication, keep signed state and credentials outside the sink, and preserve first lifecycle identifiers.
Signed-off-by: Benjamin Shafii <benjamin.shafii@gmail.com>
* fix(workbot): keep telemetry outcomes content-free
Use a shared closed error-code vocabulary at producer and sink rather than accepting arbitrary provider-defined slugs. Derive contextual-turn counts from trusted policy instead of message text. Cover both privacy boundaries and build the shared runner protocol in its existing CI lane.
Signed-off-by: Benjamin Shafii <benjamin.shafii@gmail.com>
* fix(workbot): reject credential-like model telemetry
Do not treat reflected model keys, turn tokens or provider prose as model identifiers. Protect both admission and terminal delivery, omit unsafe identities at the sink and retain unknown attribution without dropping the outcome.
Signed-off-by: Benjamin Shafii <benjamin.shafii@gmail.com>
* fix(workbot): bind telemetry to an explicit trusted Den origin
* fix(workbot): preserve Responses attribution and prove key redaction
---------
Signed-off-by: Benjamin Shafii <benjamin.shafii@gmail.com>
Copy file name to clipboardExpand all lines: ee/apps/den-api/src/audit/COVERAGE.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
Generated by `pnpm --filter @openwork-ee/den-api audit:coverage --write` from `src/audit/routes`. Do not edit by hand; CI fails when this file is stale.
- Tenant capture requires `DEN_AUDIT_CAPTURE_ENABLED`, an enabled policy and the class category; with capture off no audit database work happens.
7
7
- Request evidence: declared resource type, validated path-parameter id (`unparseable` otherwise) or `collection:<type>`, parent organization, method, route template and status. Never bodies, query strings, headers, IPs or secrets.
8
8
- One operation per request: intent, outcome and domain change events (`appendAuditChanges`) share it. Requests without trustworthy tenant attribution go to `platform_audit_event` (no organization column, not tenant-visible) with a target: the declared resource type plus validated path id, else the first handler-named resource; an organization target only when it is the authenticated context's organization.
@@ -19,7 +19,7 @@ Generated by `pnpm --filter @openwork-ee/den-api audit:coverage --write` from `s
19
19
| tenant_change | 218 | requested before handler; succeeded/attempted after (request) | .requested .succeeded .attempted | intent: up to 3 attempts on transient database errors, then 503, handler not run; outcome: up to 3 attempts on transient database errors, then logged [audit-outcome-lost]|
20
20
| tenant_external | 87 | requested before handler; confirmed/attempted, 5xx unknown (request) | .requested .confirmed .attempted .unknown | intent: up to 3 attempts on transient database errors, then 503, handler not run; outcome: up to 3 attempts on transient database errors, then logged [audit-outcome-lost]|
21
21
| tenant_job | 12 | requested before handler; accepted/attempted after (execution) | .requested .accepted .attempted | intent: up to 3 attempts on transient database errors, then 503, handler not run; outcome: up to 3 attempts on transient database errors, then logged [audit-outcome-lost]|
22
-
| tenant_signal |14| one outcome after handler: observed/attempted (category read, off by default; denials use security when selected); no intent | .observed .attempted | never fail-closed: capture-start failure served without capture; outcome: up to 3 attempts on transient database errors, then logged [audit-outcome-lost]|
22
+
| tenant_signal |15| one outcome after handler: observed/attempted (category read, off by default; denials use security when selected); no intent | .observed .attempted | never fail-closed: capture-start failure served without capture; outcome: up to 3 attempts on transient database errors, then logged [audit-outcome-lost]|
23
23
| domain_provider | 14 | provider emitter (src/audit/provider.ts) | none | evidence failure rolls back (in-transaction, not retried); attempts outside rollback: up to 3 attempts on transient database errors, then propagated |
24
24
| domain_audit | 6 | audit emitter (src/routes/org/audit.ts) | none | up to 3 attempts on transient database errors, then fails closed with 503 |
25
25
| platform | 149 | platform_audit_event after handler with target | .succeeded .attempted | written before the response is released; up to 3 attempts on transient database errors, then a failed insert never fails the request ([platform-audit-lost]) |
@@ -910,6 +910,7 @@ When tenant capture is active the domain emitter appends the new change event in
910
910
| POST |`/v1/workbot/documents/*`| proxy |`workbot.documents.save`| workbot.execution | google_drive_file | handler | destination route records || none | Verified MCP OAuth membership, write scope and both flags; allowlisted editor/session actions only, strict destination schemas and connector policy. |
911
911
| POST |`/v1/workbot/run-token`| tenant_access |`workbot.run_token.issue`| workbot.execution | oauth_access_token | handler | requested before handler; served before release (access) | request evidence only | intent or served: up to 3 attempts on transient database errors, then 503, no content | Handler verifies the MCP OAuth token, membership and workbot capability, then mints a ≤1h headless-run MCP token (credential issuance; plaintext returned once, never snapshot). mintHeadlessRunMcpToken is also called by the headless automation executor without an HTTP route. |
912
912
| GET |`/v1/workbot/session`| tenant_read |`workbot.session.read`| workbot.execution | workbot_session | handler | served before release (category read, off by default) | request evidence only | capture-start failure: served without capture; served append after capture started: up to 3 attempts on transient database errors, then 503, no content | Handler verifies the MCP OAuth token (verifyMcpRequest) and active membership, then attributes the token's org and user. |
913
+
| POST |`/v1/workbot/telemetry`| tenant_signal |`workbot.telemetry.ingest`| telemetry.adoption | telemetry_event | handler | one outcome after handler: observed/attempted (category read, off by default; denials use security when selected); no intent | request evidence only | never fail-closed: capture-start failure served without capture; outcome: up to 3 attempts on transient database errors, then logged [audit-outcome-lost]| Service credential plus verified MCP member token; bounded identifiers, counts and outcomes only. Best-effort telemetry, never message content. |
913
914
| GET |`/v1/workers`| tenant_read |`worker.list`| worker.management | worker | org_context | served before release (category read, off by default) | request evidence only | capture-start failure: served without capture; served append after capture started: up to 3 attempts on transient database errors, then 503, no content | orgMemberRoute({ useUserOrganizations: true }): resolveUserOrganizationsMiddleware calls beginUserOrganizationsAuditRequest with the active organization, which is always one of the caller's verified memberships (API-key org or X-OpenWork-Org-Id filtered to them, else the session active org); actor = user + that membership's member id. These handlers act only on that organization's rows (getWorkerByIdForOrg / listWorkersPage). No active organization: platform store. |
914
915
| DELETE |`/v1/workers/:id`| tenant_external |`worker.delete`| worker.management | worker (:id) | org_context | requested before handler; confirmed/attempted, 5xx unknown (request) | request evidence only | intent: up to 3 attempts on transient database errors, then 503, handler not run; outcome: up to 3 attempts on transient database errors, then logged [audit-outcome-lost]| external: cloud_runtime (Daytona deprovision); orgMemberRoute({ useUserOrganizations: true }): resolveUserOrganizationsMiddleware calls beginUserOrganizationsAuditRequest with the active organization, which is always one of the caller's verified memberships (API-key org or X-OpenWork-Org-Id filtered to them, else the session active org); actor = user + that membership's member id. These handlers act only on that organization's rows (getWorkerByIdForOrg / listWorkersPage). No active organization: platform store. |
915
916
| POST |`/v1/workers/:id/activity-heartbeat`| tenant_signal |`worker.activity.heartbeat`| worker.runtime | worker (:id) | handler | one outcome after handler: observed/attempted (category read, off by default; denials use security when selected); no intent | request evidence only | never fail-closed: capture-start failure served without capture; outcome: up to 3 attempts on transient database errors, then logged [audit-outcome-lost]| Org proof: activity-scope WorkerTokenTable match for :id -> worker org (actor service worker:<id>). High volume. |
route("POST","/v1/workbot/telemetry","tenant_signal","workbot.telemetry.ingest","telemetry.adoption","telemetry_event",null,"handler",{notes: "Service credential plus verified MCP member token; bounded identifiers, counts and outcomes only. Best-effort telemetry, never message content."}),
186
187
route("GET","/v1/workbot/session","tenant_read","workbot.session.read","workbot.execution","workbot_session",null,"handler",{notes: "Handler verifies the MCP OAuth token (verifyMcpRequest) and active membership, then attributes the token's org and user."}),
187
188
route("GET","/v1/workbot/connections","tenant_read","workbot.connection.list","workbot.execution","mcp_connection",null,"handler",{notes: "Handler verifies the MCP OAuth token and active membership, returns 403 while the workbot feature is off, then lists the Gmail/Google Workspace, Slack and Microsoft 365 connections this member may use (id, name, readiness, Den connect URL; no secrets)."}),
188
189
route("GET","/v1/workbot/calendar/*","proxy","workbot.calendar.read","workbot.execution","automation",null,"handler",{notes: "Handler verifies the MCP OAuth token, membership and the workbot feature, then re-dispatches an allowlisted read (the member's Automations, runs, run receipts, native calendar events, and usable LLM providers trimmed to names and model IDs) through app.fetch with a signed internal principal; the destination route records."}),
* den-admin MCP toolset: read-only Den analytics for allowlisted platform
@@ -28,7 +29,7 @@ import { runPlatformAdminPlatformAction, runPlatformAdminServiceAction, type Pla
28
29
* timeout so one expensive SELECT cannot pin an API worker indefinitely.
29
30
*/
30
31
31
-
exportconstDEN_ADMIN_MCP_VERSION="0.7.0"
32
+
exportconstDEN_ADMIN_MCP_VERSION="0.8.0"
32
33
33
34
constQUERY_TIMEOUT_MS=15_000
34
35
constDEFAULT_ROW_LIMIT=200
@@ -703,6 +704,21 @@ export function registerAdminMcpTools(server: McpServer, admin: PlatformAdminAud
703
704
}),
704
705
)
705
706
707
+
server.registerTool(
708
+
"den_workbot_adoption",
709
+
{
710
+
description:
711
+
"Platform-admin read-only Workbot adoption funnel, grouped by first recorded sign-in day (UTC) and organization: signed in, greeting completed, first message, at least one connected service. Includes id-only member pages with initial/greeting ready counts, later connection success counts, completion model/source details, and greeting failures by error code/model. Dates are inclusive, at most 90 days; totals cover the full cohort even when breakdowns are truncated. Never reads messages or profile fields.",
@@ -1654,6 +1655,9 @@ async function handleExternalMcpOAuthCallback(input: {
1654
1655
returnmcpOAuthCallbackHtml(connectCallbackPage({ok: false,name: connection.name,message: "Slack connected, but the assistant identity could not be verified. Connect the Slack account for this workspace and try again."}),400)
0 commit comments