Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(observability): respect explicit Sentry opt-out

cyhc1092569de0b
diff --git a/tests/test_sentry_integration.py b/tests/test_sentry_integration.py
index 19287459c..828ee9b58 100644
--- a/tests/test_sentry_integration.py
+++ b/tests/test_sentry_integration.py
@@ -42,6 +42,13 @@ def test_resolve_sentry_options_returns_none_without_dsn(monkeypatch):
assert sentry_integration.resolve_sentry_options() is None
+def test_resolve_sentry_options_honors_empty_env_dsn_as_opt_out(monkeypatch):
+ monkeypatch.setenv("VIBE_SENTRY_DSN", "")
+ monkeypatch.setattr(sentry_integration, "DEFAULT_SENTRY_DSN", "https://[email protected]/1")
+
+ assert sentry_integration.resolve_sentry_options() is None
+
+
def test_detect_sentry_environment_defaults_to_development(monkeypatch):
monkeypatch.delenv("VIBE_SENTRY_ENVIRONMENT", raising=False)
monkeypatch.delenv("SENTRY_ENVIRONMENT", raising=False)
@@ -52,6 +59,14 @@ def test_detect_sentry_environment_defaults_to_development(monkeypatch):
assert sentry_integration.detect_sentry_environment() == "development"
+def test_detect_sentry_environment_uses_explicit_deployment_env(monkeypatch):
+ monkeypatch.delenv("VIBE_SENTRY_ENVIRONMENT", raising=False)
+ monkeypatch.delenv("SENTRY_ENVIRONMENT", raising=False)
+ monkeypatch.setenv("VIBE_DEPLOYMENT_ENV", "production")
+
+ assert sentry_integration.detect_sentry_environment() == "production"
+
+
def test_build_sentry_contexts_contains_debug_metadata(monkeypatch):
monkeypatch.setenv("VIBE_REMOTE_HOME", "/tmp/vibe-remote-home")
diff --git a/vibe/sentry_integration.py b/vibe/sentry_integration.py
index 1d8ceb83a..b6ffa9dc8 100644
--- a/vibe/sentry_integration.py
+++ b/vibe/sentry_integration.py
@@ -102,14 +102,23 @@ def detect_sentry_environment() -> str:
if "three-regression" in vibe_home:
return "regression"
- if Path("/.dockerenv").exists():
- return "production"
-
return "development"
def resolve_sentry_options() -> Optional[dict[str, Any]]:
- dsn = os.environ.get("VIBE_SENTRY_DSN") or os.environ.get("SENTRY_DSN") or DEFAULT_SENTRY_DSN
+ env_dsn = os.environ.get("VIBE_SENTRY_DSN")
+ if env_dsn is not None:
+ dsn = env_dsn.strip()
+ if not dsn:
+ return None
+ else:
+ fallback_dsn = os.environ.get("SENTRY_DSN")
+ if fallback_dsn is not None:
+ dsn = fallback_dsn.strip()
+ if not dsn:
+ return None
+ else:
+ dsn = DEFAULT_SENTRY_DSN
if not dsn:
return None