Skip to content

Add crash reporting to the CLI (frozen-gated, filtered) + fix latent config dep#1005

Open
abrichr wants to merge 1 commit into
mainfrom
feat/error-reporting
Open

Add crash reporting to the CLI (frozen-gated, filtered) + fix latent config dep#1005
abrichr wants to merge 1 commit into
mainfrom
feat/error-reporting

Conversation

@abrichr

@abrichr abrichr commented Jun 25, 2026

Copy link
Copy Markdown
Member

Context

Error reporting was removed in c1efbece — "refactor: Convert to meta-package architecture (#960)", which deleted openadapt/error_reporting.py and dropped the sentry dependency. 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.
    • Gated on sys.frozen (packaged build) by defaultnot the old fragile active_branch == "main" check. So dev / source / CI / headless runs never report (that source-run flooding is exactly what buried real issues, e.g. the admin123-nexus headless containers).
    • Master switch OPENADAPT_ERROR_REPORTING_ENABLED=0; force from source OPENADAPT_ERROR_REPORTING_FORCE=1.
    • before_send filter drops unactionable unsupported-environment errors (no display, wrong platform, broken native deps).
    • Never raises; no-op if sentry-sdk isn't installed.
  • config.pyOPENADAPT_ERROR_REPORTING_{ENABLED,FORCE,DSN,ENVIRONMENT} settings; DSN defaults to GlitchTip openadaptai/openadapt (3798). (DSN public key is an ingestion key, not a secret.)
  • cli.pyconfigure_error_reporting() in the main() group, covering all subcommands.
  • pyproject.toml — add sentry-sdk; also add pydantic-settings, a latent missing base depconfig.py imported it but it wasn't declared, so a clean pip install openadapt couldn't import 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_reporting OK, CLI import OK, 8 new tests pass, existing test_cli_smoke / test_import_integrity unaffected.

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/deploy branch — main had a different/removed structure). Closing that one.

🤖 Generated with Claude Code

…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant