Skip to content

feat: append cli_context param to altimate auth URL for PostHog session correlation - #1068

Open
altimate-harness-bot[bot] wants to merge 1 commit into
mainfrom
feat/cli-context-auth
Open

feat: append cli_context param to altimate auth URL for PostHog session correlation#1068
altimate-harness-bot[bot] wants to merge 1 commit into
mainfrom
feat/cli-context-auth

Conversation

@altimate-harness-bot

@altimate-harness-bot altimate-harness-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Appends a cli_context query param to the browser auth URL opened by the CLI during sign-in.

  • buildCliContext() encodes { v: 1, machine_id, cli_version } as a base64url JSON blob
  • machine_id is read from ~/.altimate/machine-id (random UUID, non-PII) — the same value already sent to Azure App Insights telemetry
  • On the frontend, cli_context is decoded and passed to posthog.register() + posthog.alias() to link the CLI device to the authenticated user

Companion PR: AltimateAI/altimate-frontend#3106

Requested by @saravmajestic via harness


Summary by cubic

Adds a base64url-encoded cli_context to the CLI auth URL so the web app can link the browser session to the CLI device in PostHog. Improves analytics without sending PII.

  • New Features
    • Adds buildCliContext() encoding { v: 1, machine_id, cli_version } (version from @opencode-ai/core/installation/version).
    • Reads machine_id from ~/.altimate/machine-id; trims whitespace; if missing, sets machine_id to "" and logs a debug message.
    • Appends &cli_context=... to the /register URL; adds tests for valid encoding, missing file behavior, and whitespace trimming.

Written for commit b8c72c5. Summary will update on new commits.

Review in cubic

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

…rrelation

- Append base64url-encoded cli_context param to the register URL opened
  by AltimateAuthPlugin. Context blob: { v, machine_id, cli_version }.
- machine_id is the existing stable UUID from ~/.altimate/machine-id
  (already in every App Insights event). If the file is missing, log a
  debug message instead of silently omitting.
- Export buildCliContext() and add 3 unit tests covering: valid context,
  missing machine-id file, and whitespace trimming.
@altimate-harness-bot
altimate-harness-bot Bot force-pushed the feat/cli-context-auth branch from 33de593 to b8c72c5 Compare August 4, 2026 01:49
@saravmajestic saravmajestic self-assigned this Aug 4, 2026
@saravmajestic
saravmajestic requested a review from sahrizvi August 4, 2026 01:51
@saravmajestic
saravmajestic marked this pull request as ready for review August 4, 2026 01:52

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant