Files
deepseek-v4-quant/memory/2026-04-24-sentry-proxy.md
biondizzle f63eed5cfd Purge INT4 references — expert weights are FP4 (E2M1), not INT4
All docs and scripts updated. Historical memory entries annotated.
2026-05-08 02:33:46 +00:00

3.0 KiB

Session: 2026-04-24 11:02:48 UTC

  • Session Key: agent:main:main
  • Session ID: 6a52dfa6-35a4-4834-910b-db9c3ecdfb9f
  • Source: webchat

Conversation Summary

assistant: Still kicking 🔧 user: Sender (untrusted metadata):

{
  "label": "openclaw-control-ui",
  "id": "openclaw-control-ui"
}

[Fri 2026-04-24 00:48 UTC] I have to turn in for the night, Is it possible for you to put sentry on those two python proxies? Here's a DSN for dev = https://75cc0e073538447ea985d6b7ae68ac64@bugsink.v-inf.dev/2 have symfony pass the APP_ENV to these in the header to decide whether to use the prod sentry or the dev sentry. Leave me a comment for where the prod DSN goes. Basically only log the retry failures and obviously any uncaught exceptions (which sentry should already do?) assistant: Now add Sentry to the fragile proxy (the one that does retries): assistant: Now I need to init Sentry with the right DSN based on the X-App-Env header. Since we don't know the header per-request at init time, I'll init with a middleware approach — actually, the simplest way is to init Sentry once at startup (defaulting to dev), then tag events with the environment: assistant: Now add the Sentry capture calls for retry failures. Let me find the relevant spots: assistant: I need to capture the X-App-Env header and use it to set the Sentry environment. Let me add a middleware that sets the Sentry scope per-request, and then add sentry_sdk.capture_message at the retry failure points: assistant: Now I'll add Sentry captures. I need to handle the DSN switching based on X-App-Env header. The cleanest way: add a middleware that sets Sentry scope per-request, and at the retries_exhausted point, capture the event. assistant: Now add sentry_sdk.capture_message at the retry failure points: assistant: Also capture individual retry failures that are notable (HTTP errors from upstream): assistant: Now do the same for the normalizer proxy — add Sentry for uncaught exceptions: assistant: Now add X-App-Env header forwarding from PHP: assistant: I'll add the X-App-Env header right after each X-Upstream-URL line: assistant: Now do the same for the non-streaming path: assistant: Verify everything compiles: assistant: All good. Here's what I added:

Both proxies (fragile_proxy.py + normalizer_proxy.py):

  • sentry-sdk added to Dockerfile pip install
  • Sentry init with dev DSN, auto-captures uncaught exceptions
  • Middleware reads X-App-Env header from PHP to set environment
  • When X-App-Env=prod and SENTRY_DSN_PROD is set, re-inits with prod DSN

Fragile proxy specifically:

  • sentry_sdk.capture_message() when all retries are exhausted (includes reason, model, original finish_reason, etc.)
  • Breadcrumbs for individual retry HTTP errors

PHP:

  • Passes X-App-Env: $_ENV['APP_ENV'] header on all proxy-routed requests

For you to do when you're back:

  • Set SENTRY_DSN_PROD in both proxy files (search for TODO: Fill in production Sentry DSN)

Sleep well Mike 🌙