Skip to content

Personal spend omits web conversations and loses the web actor #2431

Closed

Description

@sentry-junior

Personal spend leaves out conversations started from the dashboard web UI. This affects the 7d/30d spend in the profile menu and Usage Over Time on the People profile page. A single web conversation can cost more than the person's whole 7d or 30d total. Two separate defects cause this, and each one alone is enough to drop the cost. Conversation privacy is not a factor.

1. People spend queries match only Slack identities

  • verifiedActorWhere in packages/junior/src/api/people/shared.ts requires juniorIdentities.provider = "slack". spend.query.ts and profile.query.ts both use it.
  • Web actors are stored as provider: "junior" identities (identityFromActor in chat/conversations/sql/actor-identity.ts). These identities have a verified email and a linked juniorUsers row, but the provider filter still excludes them.

2. An event turn replaces the web root actor with the Local CLI system identity

  • In recordConversationActivityMetadata (chat/task-execution/turn-cursor.ts), activitySource is "web" only when the Turn Source kind is web. Web conversations use a local destination, so any other Source kind, such as event, gives "local".
  • sessionLogActor drops every actor whose platform is not Slack, so the write passes actor: undefined.
  • SqlStore.recordExecution (chat/conversations/sql/store.ts) builds the conversation from its arguments alone and does not fall back to the saved actor. actorIdentityForConversation then returns the local-cli system identity, because the actor is missing and the source is local.
  • The upsert uses coalesce(excluded.actor_identity_id, existing), so the new value replaces the saved web actor. participants.ts lists the root actor first, so the dashboard shows "Local CLI" as the first participant.

Reproduction (scratch integration test against Postgres, origin/main @ cd0acb345)

  1. Create a web conversation with appendAndEnqueueWebMessage and run its turn through createConversationTurnWorker. The root actor is the junior user identity for the test email, with emailVerified: true and a linked user.
  2. Give the conversation a nonzero usage.cost.total. readPersonalSpendFromSql for that email still returns sevenDaysUsd: 0 and thirtyDaysUsd: 0.
  3. Add a watch on the conversation, enqueue one pull_request.merged event with enqueueEventNotification, and run the event turn. The root actor_identity_id now points to junior/local-cli (kind: system).

Unknowns

  • Which event turn caused the overwrite in the originally reported conversation. It was not checked against production data.
  • How many existing web conversation rows already have the local-cli actor.

via David Cramer.

--

View Session [Sentry]

Activity

  1. sentry-junior commented on Nov 9, 2026

    @sentry-junior
    ContributorAuthor

    Fixed on main: dashboard conversations count in personal spend (#2432), and web actors are kept and resolved (#2436, #2437).

    Closed during a tracker cleanup. Reopen if something here is still missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions