Skip to content

feat: add sentry config - #745

Merged
thesujai merged 4 commits into
mainfrom
feat/sentry-config
Sep 22, 2026
Merged

thesujai merged 4 commits into
mainfrom
feat/sentry-config

Conversation

@thesujai

@thesujai thesujai commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #

Changes

How was this tested?

Checklist

  • I have read the contributing guidelines
  • pnpm build, pnpm test, pnpm typecheck, pnpm lint:ci, and pnpm format:check pass locally
  • Tests added/updated where it makes sense
  • No hand-edits to generated code (packages/trueforge-sdk, python/trueforge_sdk, .github/fern/openapi/openapi.json, docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge
  • Docs / .env.example updated if configuration or behavior changed

Note

Medium Risk
Opt-in observability only, but it adds startup dependency on auth-server Sentry lookup in TrueFoundry mode and new error reporting on agent dual-write and schedule dispatch paths that could surface sensitive tenant/agent metadata in Sentry extras.

Overview
Adds opt-in Sentry error reporting for TrueForge (default off; no-op when NODE_ENV is development, test, or local). Server and controller processes call initSentry at startup with component tags (server / controller).

Configuration is extended with SENTRY_ENABLED, SENTRY_DSN, JSON SENTRY_ADDITIONAL_TAGS, and TrueFoundry-mode TRUEFOUNDRY_AUTH_SERVER_URL / TRUEFOUNDRY_TENANT_NAME. Outside TrueFoundry mode, a explicit SENTRY_DSN is required when enabled; in TrueFoundry mode, the DSN and init options come from the auth server sentry-auth-data endpoint (Bearer TRUEFOUNDRY_API_KEY). Sentry is initialised with no default integrations and global tags including service, version, and any extra tags.

Critical-path failures are reported via captureCriticalException in schedule dispatch (handoff / process run), TrueFoundry agent dual-write cleanup AggregateErrors, and when an agent is missing a required TrueFoundry external_id.

Reviewed by Cursor Bugbot for commit 5a6f2ba. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Sep 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5a6f2ba

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@truefoundry/trueforge Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread packages/trueforge/src/sentry/initSentry.ts
Comment thread packages/trueforge-core/src/core/sandbox/Sandbox.ts Outdated
Comment thread packages/trueforge/src/truefoundry/TrueFoundryServiceFoundryServerClient.ts Outdated
Comment thread packages/trueforge/.env.example Outdated
Comment thread packages/trueforge/src/main.ts Outdated
Comment thread packages/trueforge/src/main.ts Outdated
Comment thread packages/trueforge-core/src/core/sandbox/Sandbox.ts Outdated
Comment thread packages/trueforge-core/src/core/sandbox/Sandbox.ts Outdated
Comment thread packages/trueforge/src/controller/scheduleDispatch.ts
Comment thread packages/trueforge/src/sentry/captureCriticalException.ts Outdated
Comment thread packages/trueforge/src/sentry/index.ts
Comment thread .changeset/trueforge-sentry-p1.md Outdated
Comment thread packages/trueforge/.env.example Outdated
Comment thread packages/trueforge/src/controller/Controller.ts Outdated
Comment thread packages/trueforge/src/controller-main.ts Outdated
Comment thread packages/trueforge/src/main.ts Outdated
Comment thread packages/trueforge/src/main.ts Outdated
Comment thread packages/trueforge/src/main.ts Outdated
Comment thread packages/trueforge/src/truefoundry/errors.ts
Comment thread packages/trueforge/src/truefoundry/initTrueFoundrySentry.ts Outdated

@chiragjn chiragjn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. review capture sites and think from debugging perspective - will we be able to pin point the entity - agent, sesssion, schedule, etc and look at the db state or reproduce it?
  2. I would like to refactor this in a way we can push all truefoundry related code to truefoudry folder/

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d001b7a. Configure here.

Comment thread packages/trueforge/src/truefoundry/TrueFoundryServiceFoundryServerClient.ts Outdated
@thesujai
thesujai merged commit f98e575 into main Sep 22, 2026
10 checks passed
@thesujai
thesujai deleted the feat/sentry-config branch September 22, 2026 17:36
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.

3 participants