Skip to content

feat(analytics): attribute Claude Desktop sessions by repository and branch - #447

Open
mykolanehrych wants to merge 4 commits into
codemie-ai:mainfrom
mykolanehrych:EPMCDME-12687
Open

feat(analytics): attribute Claude Desktop sessions by repository and branch#447
mykolanehrych wants to merge 4 commits into
codemie-ai:mainfrom
mykolanehrych:EPMCDME-12687

Conversation

@mykolanehrych

@mykolanehrych mykolanehrych commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds accurate repository/branch attribution for Claude Desktop sessions in CodeMie Analytics, and adds api-key based auth support for local Code/Desktop proxy integrations.

Before

before

After

after

Changes

  • Resolve and attribute the correct repository per Claude Desktop session (TCP process lookup, per-request X-CodeMie-Repository header, session-to-repository map with await-poll)
  • Inject X-CodeMie-Branch header for Claude Desktop session attribution
  • Fix Cowork vs Code tab session attribution and branch fallback logic
  • Add api-key auth support for local dev / Code integration sessions; remove local-dev apiKey auth bypass
  • Rename Desktop sandbox repository label from Claude Desktop/Default to Cowork
  • Harden --add-dir path handling (reject non-absolute paths, lazy regex) and consolidate lsof/repo-resolution logic
  • Dedupe concurrent Desktop session resolution
  • Update analytics/proxy specs and docs to reflect the implementation

Impact

Claude Desktop sessions are now attributed to the correct repository and branch in analytics instead of falling back to defaults, and local dev/Code integrations can authenticate via api key.

Checklist

  • Self-reviewed
  • Manual testing performed
  • Documentation updated (if needed)
  • No breaking changes (or clearly documented)

Ref: EPMCDME-12687

…branch

Resolve and attribute the correct repository/branch per Claude Desktop
session (TCP process lookup, per-request X-CodeMie-Repository header,
session-to-repository map with await-poll, X-CodeMie-Branch header
injection), fix Cowork vs Code tab session attribution and branch
fallback, add api-key auth support for local dev/Code integration
sessions, rename Desktop sandbox repository label to 'Cowork', and
harden --add-dir path handling and lsof/repo-resolution logic.

Ref: EPMCDME-12687
@codemie-ai codemie-ai closed this Aug 28, 2026
@m-golovchin m-golovchin reopened this Aug 31, 2026
@codemie-ai codemie-ai closed this Sep 2, 2026
…hanges

Claude Desktop renamed its per-session sandbox directory from `local_<uuid>/`
to the short session id (`89643b28/`), which silently broke two places pinned to
the old name. Cowork sessions stopped being discovered entirely, so they produced
no session or tool-usage metrics — only proxy cost — and sandbox paths no longer
resolved to `Cowork`.

- discovery: probe both directory layouts when locating `audit.jsonl`
- paths: anchor the sandbox regex on the stable `local-agent-mode-sessions/` root
- parser: alias Cowork's `tool_use_result` onto `toolUseResult` and re-extract
  metrics, so Edit/Write line counts are no longer reported as zero
- runtime: gate the poll on activity instead of creation time, and reopen a
  completed session when it resumes, so a proxy restart no longer orphans
  existing conversations

Repository attribution moves out of the header-injection interceptor into a
DesktopRepositoryResolver in the telemetry layer, addressing the review blockers:
the proxy plugin now only writes resolved values, process introspection and git
reads live behind one service, `.git/HEAD` parsing is replaced by the shared
`detectGitBranch()` (worktree-safe), and TTL-window guesses are stored as
tentative so a later authoritative lookup can correct them.

Verified end to end against preview: Cowork with a repo now reports
`epm-cdme/codemie-ui` with branch and +13 net lines where it previously
reported zeros.

Generated with AI

Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
Claude-Session: https://claude.ai/code/session_01HrAXnwCX3wJpdkEwyEkCEg
@mykolanehrych mykolanehrych reopened this Sep 7, 2026
Repository owner deleted a comment from codemie-ai Sep 7, 2026
Repository owner deleted a comment from 8nevil8 Sep 7, 2026
Repository owner deleted a comment from codemie-ai Sep 7, 2026
Repository owner deleted a comment from codemie-ai Sep 7, 2026
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.

3 participants