Skip to content

fix: propagate telemetry opt-out to Python engine sidecar#224

Closed
suryaiyer95 wants to merge 2 commits intomainfrom
fix/propagate-telemetry-disabled-to-python-engine
Closed

fix: propagate telemetry opt-out to Python engine sidecar#224
suryaiyer95 wants to merge 2 commits intomainfrom
fix/propagate-telemetry-disabled-to-python-engine

Conversation

@suryaiyer95
Copy link
Contributor

Summary

  • Added Telemetry.isEnabled() export — returns true only after init() has completed and telemetry is active
  • In Bridge.start(): awaits Telemetry.init() before spawning the Python process, then injects ALTIMATE_TELEMETRY_DISABLED=true into the child's environment when telemetry is disabled

Why

When the user disables telemetry via config file (telemetry.disabled: true in altimate-code.json), no env var is set in the shell. The Python engine inherits process.env implicitly, so it wouldn't see any opt-out signal. This change explicitly injects ALTIMATE_TELEMETRY_DISABLED=true into the child env based on the actual telemetry state after init, closing that gap.

The env-var case (ALTIMATE_TELEMETRY_DISABLED=true in the shell) already worked via inheritance — this only adds coverage for the config-file case.

Companion PR in altimate-core: init() now reads ALTIMATE_TELEMETRY_DISABLED and forces telemetry=False.

Test plan

  • Set telemetry.disabled: true in ~/.config/altimate-code/altimate-code.json — verify ALTIMATE_TELEMETRY_DISABLED=true is in the Python engine's environment
  • Set ALTIMATE_TELEMETRY_DISABLED=true in shell — verify it continues to work via inheritance
  • With telemetry enabled (default) — verify normal behaviour, no env var injected

🤖 Generated with Claude Code

suryaiyer95 and others added 2 commits March 17, 2026 12:50
When altimate-code has telemetry disabled (env var or config file),
the Python engine (altimate_core) must also not send telemetry.

Two changes:
- \`Telemetry.isEnabled()\`: new export that returns \`true\` only after
  \`init()\` has completed and telemetry is active
- \`Bridge.start()\`: awaits \`Telemetry.init()\` before spawning the
  Python process, then injects \`ALTIMATE_TELEMETRY_DISABLED=true\` into
  the child's environment when telemetry is disabled

The child process inherits the parent env already, so env-var-based
opt-outs propagate automatically. This change closes the gap for
config-file-based opt-outs (\`telemetry.disabled: true\` in
\`altimate-code.json\`), where no env var is set in the shell.

Companion change in altimate-core: \`init()\` now reads
\`ALTIMATE_TELEMETRY_DISABLED\` and forces \`telemetry=False\`.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 17, 2026 20:12
@claude
Copy link

claude bot commented Mar 17, 2026

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review.

@github-actions
Copy link

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link

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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class support for connecting to an Altimate platform “backend” as an OpenAI-compatible provider, including a dedicated TUI login flow and improved credential-file permissions, plus propagates telemetry opt-out into the Python bridge.

Changes:

  • Added an altimate-backend provider loader + model registration and wired it into the provider picker.
  • Introduced a new TUI dialog to collect/validate Altimate credentials and persist them to ~/.altimate/altimate.json.
  • Improved telemetry/bridge integration (new Telemetry.isEnabled(); pass ALTIMATE_TELEMETRY_DISABLED to the Python engine) and tightened filesystem permission handling via chmod.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/opencode/src/util/filesystem.ts Ensures file modes are applied even when overwriting by calling chmod after writes.
packages/opencode/src/provider/provider.ts Adds altimate-backend provider loader and registers a default OpenAI-compatible model.
packages/opencode/src/cli/cmd/tui/component/dialog-provider.tsx Adds altimate-backend into provider selection and routes selection to a dedicated login dialog.
packages/opencode/src/cli/cmd/tui/component/dialog-altimate-login.tsx New dialog to enter and validate Altimate instance/key/url and write credentials.
packages/opencode/src/altimate/telemetry/index.ts Adds Telemetry.isEnabled() to query post-init enabled state.
packages/opencode/src/altimate/bridge/client.ts Initializes telemetry before spawning Python engine and propagates opt-out env var.
docs/docs/getting-started.md Documents /connect and manual ~/.altimate/altimate.json setup for Altimate.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

evt.preventDefault()
}
if (evt.name === "return") {
if (validating()) return
Comment on lines +82 to +88
const res = await fetch(`${url}/auth_health`, {
method: "GET",
headers: {
Authorization: `Bearer ${key}`,
"x-tenant": instance,
},
})
Comment on lines 37 to 45
title: provider.name,
value: provider.id,
description: {
"altimate-backend": "(API key)",
opencode: "(Recommended)",
anthropic: "(API key)",
openai: "(ChatGPT Plus/Pro or API key)",
"opencode-go": "Low cost subscription for everyone",
}[provider.id],
Comment on lines +901 to +937
// Register altimate-backend as an OpenAI-compatible provider
if (!database["altimate-backend"]) {
const backendModels: Record<string, Model> = {
"altimate-default": {
id: ModelID.make("altimate-default"),
providerID: ProviderID.make("altimate-backend"),
name: "Altimate AI",
family: "openai",
api: { id: "altimate-default", url: "", npm: "@ai-sdk/openai-compatible" },
status: "active",
headers: {},
options: {},
cost: { input: 0, output: 0, cache: { read: 0, write: 0 } },
limit: { context: 200000, output: 128000 },
capabilities: {
temperature: true,
reasoning: false,
attachment: false,
toolcall: true,
input: { text: true, audio: false, image: true, video: false, pdf: false },
output: { text: true, audio: false, image: false, video: false, pdf: false },
interleaved: false,
},
release_date: "2025-01-01",
variants: {},
},
}
database["altimate-backend"] = {
id: ProviderID.make("altimate-backend"),
name: "Altimate",
source: "custom",
env: [],
options: {},
models: backendModels,
}
}

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.

2 participants