add linked project ids to session-start telemetry#37
Open
Grappeggia wants to merge 9 commits intomainfrom
Open
add linked project ids to session-start telemetry#37Grappeggia wants to merge 9 commits intomainfrom
Grappeggia wants to merge 9 commits intomainfrom
Conversation
Resolve project and org ids from local .vercel metadata and refresh them hourly on prompts so dashboard attribution stays accurate without extra API calls.
Prefer per-prompt roots over stale session env state and keep refresh retries alive until project IDs have actually been sent, so long-lived sessions do not misattribute or silently drop project telemetry after transient failures.
Remove cached project link state when a session starts without a linked project, clear that state on clear/compact, and add regression coverage for prompt refreshes and cleanup paths.
Re-resolve linked Vercel project metadata when the working root changes and emit tombstones when sessions become unlinked so dashboard attribution does not stay stale.
Use the hook payload root during session start and preserve linked-project session state across clear and compact events so attribution and unlink tombstones stay accurate.
Avoid session-start link resolution and state writes when base telemetry is disabled, and centralize Vercel project link state construction so session-start and prompt refreshes share one clearer code path.
Only read .vercel/project.json during session start and include the linked project and org IDs in the existing base telemetry batch. Drop the prompt refresh and session state lifecycle changes so the PR stays focused on the minimum telemetry addition.
Melkeydev
reviewed
Apr 8, 2026
Collaborator
Melkeydev
left a comment
There was a problem hiding this comment.
We also need to uptick the version numbers
| } | ||
|
|
||
| export function readLinkedVercelProject(projectRoot: string): VercelProjectLink | null { | ||
| const projectJsonPath = join(projectRoot, ".vercel", "project.json"); |
Collaborator
There was a problem hiding this comment.
Does this work for all operating systems?
Author
There was a problem hiding this comment.
node:path.join(projectRoot, ".vercel", "project.json") is cross-platform, so this works on macOS, Linux, and Windows.
I pushed a follow-up that validates the behavior by:
- preferring the hook payload root before reading .vercel/project.json
- adding coverage for valid, malformed, and incomplete linked-project metadata
- adding a session-start telemetry test that verifies payload-root attribution
- bumping the plugin version to 0.32.1
Resolve session-start roots from hook payloads and add focused cross-platform coverage so linked Vercel project IDs are attributed correctly on macOS, Linux, and Windows. Bump the published plugin manifests for the follow-up change.
Keep the payload-root and telemetry coverage changes, but drop the dedicated cross-platform CI matrix to avoid adding permanent workflow cost for a narrow fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.vercel/project.jsonduring session startTesting
bun run build:hooksbun test tests/session-start-profiler.test.ts -t \"session-start telemetry helpers\"