Commit b190a8e
fix(observability): pytest guard on _init_posthog
The jobagent _init_posthog was missing the pytest no-op guard that
HelpmateAI's _init_posthog has. Result: every test exercising an
instrumented route (test_feedback in particular) shipped events into
the production PostHog project with distinct_id="user-test" - visible
on the assistant_turn dashboard as ~50% thumbs-down (paired up/down
events ~80 ms apart, clearly fixtures and not real users).
Fix: mirror the HelpmateAI guard verbatim. Zero production behavior
change - only affects what happens when PYTEST_CURRENT_TEST is set or
pytest is in sys.modules.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 8dce13e commit b190a8e
1 file changed
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
222 | 234 | | |
223 | 235 | | |
224 | 236 | | |
| |||
0 commit comments