Skip to content

feat(zed): add per-project attribution - #939

Closed
Vlaaaaaaad wants to merge 2 commits into
getagentseal:mainfrom
Vlaaaaaaad:zed-projects
Closed

feat(zed): add per-project attribution#939
Vlaaaaaaad wants to merge 2 commits into
getagentseal:mainfrom
Vlaaaaaaad:zed-projects

Conversation

@Vlaaaaaaad

Copy link
Copy Markdown

Summary

TL;DR: add best-effort per-project attribution to Zed. Proof-of-concept follow-up to #480 / #594

Warning

This code was written by LLMs, under the supervision of a so-called developer that spends more time in Pages&Keynote than in an IDE!

Zed Agent Threads can happen in 2 types of workspaces:

  • single-folder workspaces, the "classic" IDE-in-a-folder. In this case, the folder name is used as the project name, with some Zed-matching cleanup
  • multi-folder workspaces, where in the same Zed window there are multiple folders/projects opened. Think codeburn and homebrew-codeburn and agentseal in the same Zed window. In this case, the project name in Codeburn output will be agentseal, codeburn, homebrew-codeburn (folder names, sorted lexicographically)

This LLM-written, human-validated (beware: dumb human) pull request implements the above. Zed Agent Threads without folder metadata remain in the legacy catch-all zed bucket.

Testing

I tested this on one of my devices and I can confirm the single zed is split into multiple projects:

Before:

Top projects
┌───────────┬───────────┬────────────┐
│  Project  │     Cost  │  Sessions  │
├───────────┼───────────┼────────────┤
│  zed      │  $278.04  │     1,160  │
└───────────┴───────────┴────────────┘

After (keep in mind I also did a bunch of work in zed since I do have some tiny contributions to Zed):

Top projects
┌───────────────────────────────────────────────────────────────┬───────────┬────────────┐
│  Project                                                      │     Cost  │  Sessions  │
├───────────────────────────────────────────────────────────────┼───────────┼────────────┤
│  zed                                                          │  $179.82  │       373  │
│  otel-experiment                                              │   $42.91  │        88  │
│  infra                                                        │   $18.56  │        35  │
│  temp-xxx-xxxx                                                │   $13.68  │       225  │
│  Corporate                                                    │    $4.96  │       145  │
│  xxx-xxxx-xxx-github                                          │    $4.45  │         1  │
│  dotfiles                                                     │    $3.80  │        10  │
│  zed, REDACTED.txt, ALSO-REDACTED.txt                         │    $2.88  │        29  │
│  xxx-xxxx-xxx-blogs                                           │    $1.69  │         2  │
│  temp-xxx-xxxx, temp-xxxx, temp-xxxxx-xxxxxxxx, temp-xxxxxxx  │    $1.42  │        25  │
└───────────────────────────────────────────────────────────────┴───────────┴────────────┘

This was not a complex setup and I did not have a bunch of work on this machine (no ACP threads, relatively low number of sessions, minimal worktree usage, etc). More testing would be a very good idea!

Notes

Since I am not at all familiar with the codeburn codebase and patterns, this is more of a proof-of-concept than an actual PR. Please feel free to close this or just treat it as somewhat-relevant-documentation/example for a real implementation — I will not be offended in any way, shape, or form!

Relevant Zed references:

@ozymandiashh ozymandiashh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking correctness issue on this exact head:

src/providers/zed.ts:127-136 turns the stable path into a basename display label, while downstream aggregation groups strictly by project and keeps the first projectPath. Two sessions rooted at /Users/alice/repo and /Users/bob/repo both emit project: "repo"; they are then merged under the first path. This corrupts per-project totals, filters, cross-provider grouping, and persisted daily attribution. Multi-root display labels can collide in the same way.

Please keep a stable normalized full-path or root-set identity separate from the display label, and add an aggregation-level regression test with identical basenames/display labels and distinct paths.

The Zed suite (14/14), typecheck, and diff check pass, but the identity collision is a data-integrity blocker and this head has no CI checks.

@Vlaaaaaaad

Copy link
Copy Markdown
Author

@ozymandiashh thank you for your patience and review! Unfortunately, fixing that issue seems to require wider changes that go waaaay beyond some small additions in the Zed provider: introducing stable normalized identities based on full paths/root sets and propagating that across parsing, session caching, cross-provider merging, daily aggregation, filtering, dashboard/export/history rendering, and to some path-sensitive consumers. The newly-added e67fe7ec9c8032b987fb6a3f0191619d395dad2e commit is allegedly a step in that direction.

As somebody that does not know this codebase (and that does not have the bandwidth to do a deep-dive to become familiar with this codebase 😞), I do not feel comfortable doing those wider changes, even with the fanciest LLM assistance, so I am closing this PR. My apologies for the annoyance and churn! Anybody with codeburn knowledge or with more bandwidth is more than welcome to pick this up!

@Vlaaaaaaad Vlaaaaaaad closed this Aug 9, 2026
@ozymandiashh

Copy link
Copy Markdown
Collaborator

Mulțumesc Vlad, mă mai uit pe problemă și când am timp poate mă apuc de ea.

@Vlaaaaaaad

Copy link
Copy Markdown
Author

@ozymandiashh no rush and no worries! Also, if you do pick this up, let me know if you need me to test anything as I am more than happy to clone a PR and run some tests on my machines with Zed usage data!

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.

2 participants