openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

Tracker: Sentry across all products — stop swallowing CI auth-token failures, and give every product a verified project

Open Al629176 opened this issue 1 month ago • 10 comments

Tracker

Sentry across every production product: fix the CI auth-token failures, give each product its own project, and hook them up properly.

  • [ ] backend — stop swallowing the sourcemap upload failure; wire SENTRY_AUTH_TOKEN into the deploy workflow
  • [ ] openhuman — stop swallowing release-creation failures in upload_sentry_symbols.sh
  • [ ] opencompany — verify the CI token path end to end (9 references, project 14)
  • [ ] chottu-core — no Sentry at all; tracked in chottu-core#81
  • [ ] dashboard, landing, openintents-core — no Sentry references at all; decide which need it
  • [ ] One project per product, with releases and sourcemaps verified on a real deploy

The bug, precisely

It is not that Sentry steps fail loudly. It is that they are written never to fail at all, so breakage is invisible and the build goes green.

backend/package.json:

"build:prod": "npm run build && (npm run sentry:sourcemaps || echo 'Sentry sourcemaps skipped (set SENTRY_AUTH_TOKEN to upload)')",
"sentry:sourcemaps": "sentry-cli sourcemaps inject --org tinyhumans --project backend-alphahuman ./dist && sentry-cli sourcemaps upload ..."

The || echo swallows every failure — a missing token, an expired token, a wrong org, a network error. The build succeeds, prints a line nobody reads, and every backend stack trace in Sentry is minified from then on. Silently, indefinitely. That is the reported "it fails in backend": it does not fail, which is worse.

SENTRY_AUTH_TOKEN is documented in the backend's README, docs/ARCHITECTURE.md and package.json, but the deploy workflow sets only SENTRY_RELEASE — so a release is tagged with no sourcemaps attached to it.

openhuman/scripts/upload_sentry_symbols.sh is better — set -euo pipefail, and it checks the token is present — but then:

sentry-cli releases new "${release_name}" || true
sentry-cli releases set-commits --auto --ignore-missing "${release_name}" || true

Same shape: a failed release creation passes, and symbols attach to a release that may not exist.

So the fix is one principle applied everywhere: a Sentry step either succeeds, or fails the build, or is explicitly and deliberately skipped by configuration — never by swallowing an error.

Projects for every production product

Sentry is self-hosted under the tinyhumans org at sentry.tinyhumans.ai. Known today: backend-alphahuman, project 14 for OpenCompany, and OpenHuman's own. The gaps are Chottu (none at all) and whichever of dashboard, landing and openintents-core should have one.

Each product needs: its own project, a DSN supplied by environment, releases tagged <product>@<version>+<commit> as OpenCompany already does, environment separating staging from production, and sourcemaps or symbols uploaded and verified attached to the release.

Chottu is the one with a content risk, and it is tracked separately in chottu-core#81 — its errors sit next to phone numbers and private message bodies, so it needs redaction before it reports anything.

Verification is the part usually skipped

A green CI step proves a command ran, not that Sentry received anything useful. OpenHuman already has scripts/release/verify-sentry-sourcemaps.mjs — that idea should be the standard:

  • after a deploy, assert the release exists in Sentry
  • assert sourcemaps or symbols are attached to that release
  • induce an error and confirm the stack trace resolves to original source, not minified output

Without that last check, every other box can be ticked while traces remain unreadable.

Related

  • chottu-core#81 — Sentry for Chottu, including the redaction requirements
  • #7328 — the security consolidation tracker; observability touches it but is a separate axis
  • backend#1421 — cost audit; the self-hosted Sentry stack's cost is in scope there

Acceptance Criteria

  • [ ] No Sentry step anywhere swallows a failure — || echo, || true and equivalents removed or replaced with a deliberate, documented skip
  • [ ] SENTRY_AUTH_TOKEN is provided to every workflow that needs it, from org or repo secrets, and never printed
  • [ ] A missing or invalid token fails the build rather than producing a green one
  • [ ] Each production product has its own Sentry project, listed on this issue with its DSN location
  • [ ] Releases are tagged <product>@<version>+<commit> consistently
  • [ ] Staging and production are separated by environment tag
  • [ ] A verification step asserts the release exists and has sourcemaps/symbols attached, run on a real deploy per product
  • [ ] An induced error in each product resolves to original source in Sentry, checked once and recorded here
  • [ ] Token rotation is documented, with expiry owned by someone

Al629176 avatar Oct 19 '26 06:10 Al629176

Progress: backend + openhuman

Two PRs are up, one for each of the first two items:

  • backend: tinyhumansai/backend#1427
  • openhuman: tinyhumansai/openhuman#8105

What the CI logs actually show

backend: sourcemaps have never uploaded. build:prod runs inside docker build, and the deploy workflows never pass a token into it. Every staging and prod build prints error: Auth token is required and the || echo keeps it green (prod run 38361308983).

A correction to the issue text: deploy-prod.yml does pass SENTRY_AUTH_TOKEN, to its "Create Sentry release" step. That step fails loudly with Invalid token (http status: 401), which is why every "Deploy to Production" run ends red after a successful EKS deploy. The production token is invalid and needs rotating.

openhuman: || true was hiding a real 403. In the 0.64.15 release (run 37882517538), releases new succeeds but releases set-commits fails on every desktop target with You do not have permission to perform this action. (http status: 403). Commit association (suspect commits) is silently broken. Symbol upload and finalize work, and the frontend sourcemap verification passes.

What the PRs do

Both apply the rule from this issue: a step succeeds, fails the build, or is skipped deliberately through configuration.

  • backend#1427:
    • New scripts/sentry-sourcemaps.sh with an explicit mode: required fails on a missing token or any error, skip logs the skip.
    • The token reaches the Docker build as a BuildKit secret. I verified it doesn't appear in the image history or layers.
    • SENTRY_URL is passed for the self-hosted instance.
    • The mode comes from vars.SENTRY_SOURCEMAPS and defaults to skip, because with the 401 token required would block every deploy at the build stage.
  • openhuman#8105:
    • releases new and set-commits are now fatal.
    • The release workflow skips set-commits explicitly, with a logged warning, through vars.SENTRY_SKIP_SET_COMMITS, which defaults to 1 because of the 403.

Once the tokens are fixed, both repos can be made strict by changing a repo variable, with no code change.

Needs someone with Sentry admin access

  • [ ] Rotate the backend SENTRY_AUTH_TOKEN in the Production and Development environments (with project:releases), and confirm SENTRY_URL is set as a variable in both
  • [ ] Then set backend SENTRY_SOURCEMAPS=required
  • [ ] Give openhuman's token permission to link commits (org:read + project:releases, or a GitHub repository integration in Sentry), then set SENTRY_SKIP_SET_COMMITS=0
  • [ ] After the next deploy of each: confirm the release shows artifacts in Sentry, and that an induced error resolves to original source

Not started

opencompany (CI token path), chottu-core (tinyhumansai/chottu-core#81), and the decision on dashboard / landing / openintents-core.

CodeGhost21 avatar Oct 19 '26 07:10 CodeGhost21

Progress: backend sourcemaps upload end to end

Backend: working on staging, strict mode on in both environments

Merged: tinyhumansai/backend#1427, tinyhumansai/backend#1431, tinyhumansai/backend#1432.

The first strict run surfaced three problems, each fixed in turn:

  1. The token was invalid (401). Rotated to a new org token, backend-ci (scope org:ci), in both the Production and Development environments.
  2. No CA certificates in the Docker builder. node:24-slim ships none, so sentry-cli failed TLS with unable to get local issuer certificate. Fixed by installing ca-certificates (#1431).
  3. Wrong project slug. backend-alphahuman belonged to the old sentry.io org, and the self-hosted instance answered One or more projects are invalid. The project here is backend-nodejs (#1432).

Result: staging deploy run 39319052541 uploaded 3078 files → upload complete, and both deployments rolled out.

  • SENTRY_SOURCEMAPS=required is now set on Development and Production. A broken token or upload fails the image build, which runs before deploy, instead of shipping minified traces.
  • The prod "Create Sentry release" step now uses set_commits: skip (#1431). An org:ci token can create releases but not associate commits. That step has failed with 401 on every prod deploy; it should go green on the next one.

openhuman: merged, commit association still deliberately skipped

tinyhumansai/openhuman#8105 and #8106 are merged. releases new and set-commits no longer swallow failures. set-commits stays skipped through vars.SENTRY_SKIP_SET_COMMITS=1 until a token with org:read exists and the GitHub repository integration is connected in Sentry. Symbol upload and frontend sourcemap verification already work.

Checklist

  • [x] backend: no swallowed failure; token supplied as a BuildKit secret; a missing or invalid token fails the build
  • [x] backend: sourcemaps uploaded on a real (staging) deploy
  • [ ] backend: next "Deploy to Production" uploads sourcemaps and "Create Sentry release" goes green
  • [ ] backend: an induced 500 on staging resolves to src/*.ts frames in backend-nodejs
  • [ ] openhuman: token with org:read and the GitHub repo integration in Sentry, then SENTRY_SKIP_SET_COMMITS=0
  • [ ] opencompany: verify the CI token path end to end
  • [ ] chottu-core: tinyhumansai/chottu-core#81
  • [ ] dashboard / landing / openintents-core: decide which need Sentry
  • [ ] token rotation documented, with an owner for expiry (current backend token: backend-ci org token)

Gotcha for whoever rotates tokens next

Paste a token into read -s in iTerm and the terminal's bracketed-paste markers (ESC[200~ … ESC[201~) end up inside it. Sentry's proxy then answers every request with an empty-bodied 400, which looks like a bad token but isn't. Store secrets with printf %s "$T" | gh secret set … after checking that ${T:0:7} is sntrys_.

CodeGhost21 avatar Oct 19 '26 20:10 CodeGhost21

Update: backend green in production; chottu already done

Backend: verified on a real production deploy

Deploy to Production #181 (run 39580625214, 21 Oct, commit 697531e79c) succeeded end to end:

  • Build: Bundled 3078 files for upload → [sentry-sourcemaps] upload complete
  • Deploy to EKS: backend and backend-worker successfully rolled out
  • Create Sentry release: green, the first time since at least 29 Sep (it had failed on every run with Invalid token (401))

The log masked the upload target as ***/***, which confirms that the Production SENTRY_ORG / SENTRY_PROJECT secrets are tinyhumans / backend-nodejs, the project tinyhumansai/backend#1432 targets.

chottu-core: already complete

tinyhumansai/chottu-core#81 was closed as completed on 14 Oct, through chottu-core PR #90 (merged 13 Oct), before this tracker was filed. The chottu project exists on sentry.tinyhumans.ai.

Still open

  • [ ] Readable stack traces in prod. Waiting for the next real exception from release 181. Before the fix, the recurring Discord role-sync AxiosError 403 showed /app/dist/services/discord/roleSync.js:32; it should now resolve to src/…/roleSync.ts.
  • [ ] Staging events. backend-nodejs is meant to serve both staging and production (one project per product), but only the production environment has ever reported there. src/config/sentry.ts starts Sentry only when NODE_ENV === 'production'. Not changed yet.
  • [ ] openhuman commit association. Still skipped on purpose (SENTRY_SKIP_SET_COMMITS unset, so the workflow defaults to 1). Needs a token with org:read and the GitHub repository integration in Sentry.
  • [ ] opencompany. Verify the CI token path end to end (project 14).
  • [ ] dashboard / landing / openintents-core. Decide which need Sentry.
  • [ ] Token rotation. Document it and name an owner for the backend-ci org token's expiry.

CodeGhost21 avatar Oct 21 '26 12:10 CodeGhost21

Update: opencompany verified end to end, no change needed

The opencompany item ("verify the CI token path end to end") checks out. Nothing is swallowed, and its pipeline already does the post-deploy verification this tracker asks for.

Check Evidence
A missing token fails the build "Validate Sentry artifact-upload settings" exits 1 on an empty SENTRY_AUTH_TOKEN in build-desktop.yml, deploy-staging.yml and release-production.yml
No swallowed errors scripts/upload-sentry-symbols.sh runs set -euo pipefail with no || true. The Docker upload takes the token as a BuildKit secret; CI always validates the token first and passes URL, org and project as fixed values, so the Dockerfile's skip branch can't trigger there
Uploads really happen staging deploy run 37874993584 (9 Oct): Successfully uploaded source maps to Sentry (React, opencompany-frontend); Found 316 debug information files → Uploaded 11 missing debug information files (Rust, opencompany-core)
Events really stored production releases send a real crash event (sentry-test) and fail unless /organizations/tinyhumans/eventids/<id>/ returns 200. It passed in release runs 37059474010 (2 Oct) and 37125516400 (3 Oct)
Token scope the readback fails on 401/403, so its passing shows opencompany's token has org:read

The 3 Oct release failed on "Assert desktop analytics wire contract", not on Sentry; every Sentry step in it passed.

Minor, not blocking: the Rust upload logs Resolved source code for 0 debug information files, so Rust frames get function/file/line but no source context.

Outside this item: whether hosted tenants and the desktop app's Rust half actually report at runtime (DSN injection) is a separate question from the CI token path, and isn't re-verified here.

Remaining on this tracker

  • [x] backend: live and verified on prod deploy #181
  • [x] chottu-core: done via chottu-core#81 / PR #90
  • [x] opencompany: CI token path verified end to end (this comment)
  • [ ] backend: readable stack trace on the next real prod exception from release 181
  • [ ] backend: staging events (NODE_ENV gate; see previous comment)
  • [ ] openhuman: commit association (token with org:read + GitHub repository integration, then SENTRY_SKIP_SET_COMMITS=0)
  • [ ] dashboard / landing / openintents-core: decide which need Sentry
  • [ ] token rotation documented with an owner (backend backend-ci org token)

CodeGhost21 avatar Oct 21 '26 12:10 CodeGhost21

Update: backend staging now reports to Sentry; openhuman commit association configured

Backend staging → backend-nodejs (done)

Confirmed with Steven that one project serves both prod and staging. Staging never reported, for two reasons, both now fixed:

  1. Code: src/config/sentry.ts only initialised for NODE_ENV === 'production', and staging runs NODE_ENV=staging. Fixed in tinyhumansai/backend#1433 (production + staging; the environment tag falls back to NODE_ENV, so events arrive tagged staging).
  2. Runtime config: staging's mounted config.staging.json (secret openhuman-staging-config) had a SENTRY_DSN for project 5, openhuman's tauri-react. With the code fix alone, backend staging errors would have landed in the openhuman frontend project. Overridden with a SENTRY_DSN env var (project 2) on tinyhumans-backend and tinyhumans-backend-worker; nconf reads env before file, and the deploy doesn't touch it. Verified on the running pod: project=/2.

#1433's staging deploy (run 39609488630) succeeded: Bundled 3080 files → upload complete, and both deployments rolled out.

Follow-up: the project-5 DSN is still in openhuman-staging-config. It's harmless under the override but misleading; correct it when that secret is next edited.

openhuman commit association (configured, awaiting a release)

  • New Sentry internal integration openhuman-ci (Project: Write, Release: Admin, Organization: Read). Verified: 200 on the org's repo list, and it sees tinyhumansai/openhuman. The GitHub integration was already active with the repo connected.
  • Installed as SENTRY_AUTH_TOKEN in all four places openhuman keeps it (repo, Production, staging, App Development Production), then SENTRY_SKIP_SET_COMMITS=0.
  • The next openhuman release is the first test. Expect Associating commits with openhuman@… with no 403. To roll back without a code change, set SENTRY_SKIP_SET_COMMITS=1.

Remaining

  • [x] backend: prod + staging reporting, sourcemaps uploaded in both
  • [x] chottu-core, opencompany
  • [ ] openhuman: confirm commit association on the next release
  • [ ] backend: readable stack trace on the next real exception (prod or staging)
  • [ ] dashboard / landing / openintents-core: decide which need Sentry
  • [ ] token rotation: document owners/expiry for backend-ci (org token) and openhuman-ci (internal integration); clean up the unused org tokens gh-actions and developement-triage once owners confirm

CodeGhost21 avatar Oct 21 '26 13:10 CodeGhost21

Update: stack traces now resolve to source; two Sentry server faults fixed

Verifying "an error resolves to original source" uncovered two faults in the self-hosted Sentry server (production EKS: Helm release sentry in ns sentry; Kafka, ClickHouse, Redis and the symbolicator in ns database). Both affected every product, not just backend.

1. Ingestion silently stopped for ~10 hours (fixed)

  • About 03:40 UTC on 21 Oct, sentry-kafka-0, clickhouse-0 and redis-sentry-0 restarted together. The consumers reconnected at 03:41:49.
  • Relay started during the outage and its Kafka producer never recovered. Every event logged failed to produce message to Kafka … MessageTimedOut topic="ingest-events", yet clients still got 200. Org-wide accepted errors went 1,985 / 3,417 / 1,440 (01–03h UTC) to 0 from 04:00 until about 13:57.
  • Fix: kubectl -n sentry rollout restart deploy/sentry-relay. Accepted events resumed at 13:55. Events sent between about 03:40 and 13:57 UTC are lost.
  • This matches the 15 Sep incident (clients report success while nothing is stored).

2. No JavaScript sourcemaps were applied for any project (fixed)

  • The uploads were correct: the event carried debug ID a570fb0e…, and artifact bundle 330 held both cursorPagination.js and .js.map with that ID. Yet every event showed js_no_source, including 5/5 recent tauri-react events.
  • Cause: system.internal-url-prefix: 'http://sentry-web:9000' is a short name, but the symbolicator runs in ns database, where sentry-web is NXDOMAIN (symbolicator log: no records found for Query { name: Name("sentry-web.") }).
  • Fix: an ExternalName alias in database, outside the Helm release so upgrades don't remove it: kubectl -n database create service externalname sentry-web --external-name sentry-web.sentry.svc.cluster.local. To undo: kubectl -n database delete service sentry-web.

Proof

A test error thrown inside backend code on staging (decodeCursor), before and after the alias:

before after
top frame /app/dist/utils/cursorPagination.js:29 /utils/cursorPagination.ts:27
code throw new errors_1.BadRequestError(…) throw new BadRequestError('Invalid cursor format');
processing errors js_no_source none

The test events also confirm staging reporting end to end (project backend-nodejs, environment staging, release staging-04db9b0…). Test issues #41600–#41602 can be resolved.

Checklist

  • [x] backend: prod + staging reporting; sourcemaps uploaded and applied (stack traces resolve to src/*.ts)
  • [x] chottu-core, opencompany
  • [ ] openhuman: confirm commit association on the next release
  • [ ] dashboard / landing / openintents-core: decide which need Sentry
  • [ ] token ownership/expiry for backend-ci and openhuman-ci; clean up unused org tokens

Recommended (infra)

  • Alert on org-wide accepted errors = 0 for 30 min, or a Relay health check that covers Kafka, so a Relay wedge is caught in minutes, not hours.
  • Record the sentry-web alias in the infra repo or runbook. Longer term, move the symbolicator into ns sentry or set internal-url-prefix to the FQDN.
  • Find out why the database services all restarted at 03:40 UTC (node replacement?).

CodeGhost21 avatar Oct 21 '26 14:10 CodeGhost21

Product scope decided (Steven, 2026-10-21): dashboard and landing: no Sentry. openintents-core: yes. Tracked in tinyhumansai/openintents-core#232 (two projects, openintents-api (Rust) and openintents-web (Next.js), with payment-safe scrubbing designed in).

CodeGhost21 avatar Oct 21 '26 19:10 CodeGhost21

openintents-core: live

tinyhumansai/openintents-core#232 is live in production: two projects (openintents-api for the Rust api and worker, openintents-web for Next.js), payment-safe scrubbing (including capability URLs like /signin/{key}), strict sourcemap upload, and file/line for Rust through line tables. PRs openintents-core#233, #234 and #235, plus tinyhumansai/k8s#162.

Only check left there: the first real production errors resolving to source.

  • [x] openintents-core: Sentry added (decided by Steven 2026-10-21)
  • [x] dashboard / landing: decided no Sentry

CodeGhost21 avatar Oct 22 '26 07:10 CodeGhost21

Update: Sentry health alert live; root cause of the outages found

Alert (approved by Steven): live

tinyhumansai/backend#1434 adds a Sentry ingest check to the existing uptime monitor (→ Telegram "API Uptime Alerts"). Every run it reads Sentry's own API and goes DOWN when:

Check Catches The alert says to run
0 errors stored org-wide in 30 min Relay stuck after a Kafka restart (the ~10h loss on 21 Oct) kubectl -n sentry rollout restart deploy/sentry-relay
Newest searchable event > 15 min old Snuba consumer stuck (the frozen search the same evening) kubectl -n sentry rollout restart deploy/sentry-snuba-consumer
Sentry API not readable a revoked or under-scoped token

Verified live: the first scheduled run after merge (run 39770073512) logged [Sentry ingest] attempt 1/3 -> up: 440 errors stored in 30 min. Token: internal integration sentry-health (Organization: Read, Issue & Event: Read), repo secret SENTRY_HEALTH_TOKEN. Runbook: docs/runbooks/uptime-monitoring.md, "Sentry ingest".

Why the database services keep restarting

EKS Auto Mode is replacing the nodes under them. CloudTrail shows its own compute controller (eks-auto-mode-compute-…, from eks.amazonaws.com) terminating instances:

  • 21 Oct 19:48–19:49 UTC: 2 nodes. Kafka and ClickHouse moved (sentry-kafka-0: Scheduled on a new node, FailedAttachVolume … Multi-Attach error), and the Snuba consumer froze.
  • 22 Oct 03:35–03:37 UTC: 3 nodes, including the one running sentry-relay. Sentry survived this one.
  • 21 Oct 03:40 (the 10-hour loss) matches the same daily window but is outside the 24h audit view.

No person or deploy caused these. Whether a replacement breaks Sentry is luck, so the alert above detects it but doesn't prevent it.

Still open (infra)

  • [ ] Protect Sentry's stateful pods (sentry-kafka-0, clickhouse-0, redis-sentry-0, and the symbolicator in ns database) from Auto Mode disruption: karpenter.sh/do-not-disrupt: "true" / PodDisruptionBudgets, or a node pool that isn't consolidated
  • [ ] Record the sentry-web ExternalName alias (ns database) in the infra repo or runbook

CodeGhost21 avatar Oct 22 '26 11:10 CodeGhost21

Closing: the tracker's core goal is met

No Sentry step swallows a failure any more, and Sentry works end to end for every product that should have it.

Product Outcome
backend strict sourcemap upload (tinyhumansai/backend#1427, #1431, #1432); staging reports too (#1433); prod and staging traces resolve to src/*.ts
openhuman swallowed releases new / set-commits failures removed (#8105); commit association configured
opencompany already strict end to end (verified, no change needed)
chottu-core done in tinyhumansai/chottu-core#81
openintents-core new: Rust + Next.js reporting with payment-safe scrubbing, strict uploads (tinyhumansai/openintents-core#232)
dashboard, landing decided: no Sentry

Along the way, two faults in the self-hosted Sentry server that affected every product were found and fixed: Relay dropping all events after a Kafka restart, and sourcemaps never being applied (the sentry-web alias). An alert now catches the first kind of failure (tinyhumansai/backend#1434).

Follow-ups (moved out of this tracker)

  • tinyhumansai/openhuman#8201: openhuman: fail releases on a missing token, confirm commit association, record a source-resolved error
  • tinyhumansai/openhuman#8202: one release-name format across products
  • tinyhumansai/openhuman#8203: token ownership, rotation runbook, revoke unused tokens
  • tinyhumansai/k8s#165: protect Sentry's stateful pods from EKS Auto Mode; commit the sentry-web alias

CodeGhost21 avatar Oct 22 '26 11:10 CodeGhost21