Skip to content

feat(app): emit task lifecycle telemetry events to Den (Analytics Layer 2)#2150

Open
benjaminshafii wants to merge 1 commit into
devfrom
analytics/app-task-events
Open

feat(app): emit task lifecycle telemetry events to Den (Analytics Layer 2)#2150
benjaminshafii wants to merge 1 commit into
devfrom
analytics/app-task-events

Conversation

@benjaminshafii

Copy link
Copy Markdown
Member

What

Third PR of the OpenWork Analytics stack (with #2148 server and #2149 dashboard). The desktop/web app now emits real Layer 2 usage signals to POST /v1/telemetry/ingest:

  • apps/app/src/app/lib/den-telemetry.ts: events carry source: "app", optional sessionId, durationMs, success; new helpers trackTaskStarted/Completed/Failed
  • Send path (session-route.tsx): task.started on each send; session.active now carries the session id so the server can count distinct sessions per week
  • Run lifecycle (session-sync.ts): task.completed / task.failed with run duration on session.idle / session.error, reusing the existing markTaskRunStart/takeTaskRunStart bookkeeping (so it only fires for runs this client instrumented, deduped across workspace syncs)

Privacy unchanged: auth-gated (no-op when signed out of Den), fire-and-forget, batched; only event names, opaque session ids, durations, and success flags — never prompts, code, or file paths.

Compatibility: safe to merge independently of #2148 — the current server's zod ingest schema strips unknown fields, so older servers simply ignore the new fields; with #2148 deployed they're stored and aggregated.

Tests

Commands run:

  • pnpm typecheck (@openwork/app) — passes
  • bun test in apps/app — 109 pass / 4 fail; the 4 failures (artifact-spreadsheet, artifacts) are pre-existing on the base commit (verified by running the same tests on an untouched origin/dev worktree — same failures)
  • The exact event payload shape produced here (task.started/task.completed/task.failed with sessionId/durationMs/success) was verified end-to-end against the new server in feat(den): analytics event model + /v1/telemetry/analytics endpoint (Layer 1+2) #2148: ingested via POST /v1/telemetry/ingest (204), stored, and correctly aggregated by GET /v1/telemetry/analytics (distinct sessions, success rates, avg duration)

No video for this PR: the change is invisible in the UI (background telemetry). To reproduce manually: run the local Den stack (pnpm dev:den) with #2148, sign in to Den in the app, send a prompt, and watch rows appear in telemetry_event and the numbers move on the #2149 Analytics page.

Layer 2 of OpenWork Analytics from the desktop/web app:
- den-telemetry events now carry source, sessionId, durationMs, success
- task.started on send (alongside the existing session.active, which now
  carries the session id so the server can count distinct sessions)
- task.completed / task.failed with duration on session idle/error,
  piggybacking the already-instrumented markTaskRunStart bookkeeping

Auth-gated and fire-and-forget as before; only opaque ids, durations,
and success flags are sent -- never prompts, code, or file paths.
@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openwork-app Ready Ready Preview, Comment Jun 10, 2026 3:23pm
openwork-den Ready Ready Preview, Comment Jun 10, 2026 3:23pm
openwork-den-worker-proxy Ready Ready Preview, Comment Jun 10, 2026 3:23pm
openwork-landing Ready Ready Preview, Comment, Open in v0 Jun 10, 2026 3:23pm

@vercel vercel Bot requested a deployment to Preview – openwork-den-worker-proxy June 10, 2026 15:23 Abandoned
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