Skip to content

Add workspace provenance and per-workspace usage attribution #337

Open

Description

@khaliqgant

Problem

Production usage cannot distinguish internal fleet traffic from external customers because workspaces have no durable creation provenance or trusted classification. A raw top-consumer list is therefore misleading.

Scope

  • Capture creation source and optional origin identifier at POST /v1/workspaces.
  • Expose per-workspace message, agent, channel, storage, first-activity, and last-activity usage.
  • Make internal / external / unknown explicit, with evidence and source rather than treating heuristics as facts.
  • Document a conservative legacy backfill: inferred metadata stays separate from recorded provenance.
  • Avoid per-message attribution writes; reuse aggregate queries or bounded rollups so observability does not worsen the current D1 insert pressure.
  • Keep billing outside this work; the usage view is the seam for future metering/pricing.

Implementation location is under investigation: portable request/schema contracts belong in relaycast, while hosted D1 aggregation and operator surfacing may belong in relaycast-cloud.

Acceptance

An operator can list external workspaces and rank each by messages, agents, channels, storage footprint, first activity, and last activity without manually inspecting agent names.

Related production concern: relay#1562. A separate issue will cover duplicate generated workspace names and ambiguous by-name lookup.

Activity

  1. khaliqgant commented on Aug 18, 2026

    @khaliqgant
    MemberAuthor

    Checkpoint: investigation started from host Khaliqs-MacBook-Pro.local. GitHub CLI is authenticated as khaliqgant with scopes admin:public_key, delete_repo, gist, read:org, repo, and workflow. No production data will be mutated. I am tracing every current workspace creator and the D1 read path before fixing the schema/API boundary.

  2. khaliqgant commented on Aug 18, 2026

    @khaliqgant
    MemberAuthor

    Implementation is ready for review in #339, with hosted reporting in AgentWorkforce/relaycast-cloud#67. #339 is intentionally stacked on lifecycle #338 because it owns migration 0036; attribution is migration 0037. Caller population is split into AgentWorkforce/relay#1569 (broker/CI) and AgentWorkforce/cloud#3076 (relayflow). The distinct relay-<8hex> name-collision/by-name ambiguity is tracked in AgentWorkforce/relay#1566. Existing 41,320 rows remain NULL/unknown; no heuristic is persisted as fact. Local gates: Relaycast focused/package/Rust suites passed, with one CPU-saturated contention timeout passing alone in 632 ms; cloud passed 192 unit tests, 35 integration tests, typecheck, migration parity, and diff checks. No production mutation or billing behavior.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions