Add crash reporting to the CLI (frozen-gated, filtered) + fix latent config dep#1005
Open
abrichr wants to merge 1 commit into
Open
Add crash reporting to the CLI (frozen-gated, filtered) + fix latent config dep#1005abrichr wants to merge 1 commit into
abrichr wants to merge 1 commit into
Conversation
…config dep Error reporting was dropped in the meta-package refactor (#960). Re-add it on the new architecture, done right: - openadapt/error_reporting.py: init Sentry/GlitchTip from the CLI entry point. Gated on sys.frozen (packaged build) by default -- NOT the old, fragile active_branch=='main' check -- so dev/source/CI/headless runs never report (that source-run flooding buried real issues). Master switch + force override via OPENADAPT_ERROR_REPORTING_* settings. before_send drops unactionable unsupported-environment errors. Never raises; no-op if sentry-sdk absent. - config.py: OPENADAPT_ERROR_REPORTING_{ENABLED,FORCE,DSN,ENVIRONMENT} settings; DSN defaults to GlitchTip openadaptai/openadapt (3798). - cli.py: configure_error_reporting() in the main() group (covers subcommands). - pyproject: add sentry-sdk; also add pydantic-settings, a latent missing base dep (config.py used it but it wasn't declared, so a clean install could not import openadapt.config). - tests: filtering + gating (8 tests, no network). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Context
Error reporting was removed in
c1efbece— "refactor: Convert to meta-package architecture (#960)", which deletedopenadapt/error_reporting.pyand dropped thesentrydependency. It looks like collateral damage of the meta-package split, not a deliberate decision — so this re-adds it, built for the new thin-meta-package architecture.(The GlitchTip dashboard noise that prompted this is from old external deployments running pre-refactor versions; separately triaged/muted. This PR is about restoring crash visibility for the current app, done right.)
What
openadapt/error_reporting.py— initializes Sentry/GlitchTip from the CLI entry point.sys.frozen(packaged build) by default — not the old fragileactive_branch == "main"check. So dev / source / CI / headless runs never report (that source-run flooding is exactly what buried real issues, e.g. theadmin123-nexusheadless containers).OPENADAPT_ERROR_REPORTING_ENABLED=0; force from sourceOPENADAPT_ERROR_REPORTING_FORCE=1.before_sendfilter drops unactionable unsupported-environment errors (no display, wrong platform, broken native deps).sentry-sdkisn't installed.config.py—OPENADAPT_ERROR_REPORTING_{ENABLED,FORCE,DSN,ENVIRONMENT}settings; DSN defaults to GlitchTipopenadaptai/openadapt(3798). (DSN public key is an ingestion key, not a secret.)cli.py—configure_error_reporting()in themain()group, covering all subcommands.pyproject.toml— addsentry-sdk; also addpydantic-settings, a latent missing base dep —config.pyimported it but it wasn't declared, so a cleanpip install openadaptcouldn'timport openadapt.config(masked in CI by a transitive install).tests/test_error_reporting.py— filtering + gating (8 tests, no network).Validated
Clean-base venv install →
import openadapt.config/openadapt.error_reportingOK, CLI import OK, 8 new tests pass, existingtest_cli_smoke/test_import_integrityunaffected.How to test reporting end-to-end
OPENADAPT_ERROR_REPORTING_FORCE=1 openadapt <cmd-that-errors>→ event appears in GlitchTip 3798 (filtered for env noise).Note
Supersedes #1004 (which targeted the abandoned
feat/deploybranch — main had a different/removed structure). Closing that one.🤖 Generated with Claude Code