Skip to content

feat: Show the coding agent hint when no DSN is set - #8432

Draft
wedamija wants to merge 1 commit into
masterfrom
danf/agent-hint-no-dsn
Draft

wedamija wants to merge 1 commit into
masterfrom
danf/agent-hint-no-dsn

Conversation

@wedamija

@wedamija wedamija commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

What

The coding agent hint from #8269 only printed when a DSN was set. It now prints without one too, and starts by saying so:

[sentry] No DSN is set, so this run sends nothing to Sentry. When one is set: Sentry will get errors from this app but not the request trace around them, and none of its logs. The checklist shows what to change. …

Every other condition is the same: an agent is running the app, it's not CI, tracing or logs is off, and the file that calls sentry_sdk.init() was changed by this user in the last hour.

Why

Agents rarely have a DSN while they set up Sentry. In 76 real first-setup requests to a coding agent, 4 gave one. The usual request is closer to "add Sentry, I'll put the DSN in production myself". The agent then runs the app and its tests with no DSN, sees no hint, and finishes.

Today the hint only reaches those agents when they make up a local DSN to test with.

How much this helps is not clear yet. In 37 agent sessions on this change, with no DSN in the request, the agent nearly always did make up a local DSN, so the hint printed in its usual form. The new no-DSN form printed in 3 of the 37. That's why this is a draft.

What this doesn't fix

Most new setups guard the call: if dsn: sentry_sdk.init(...). Without a DSN, init() never runs there, so there's still nothing to print. In an earlier test on a FastAPI app, all three agents wrote that guard, and the hint printed in none of the sessions.

The same change is needed on 2.x. That's not in this PR.

Changelog Entry

  • The setup hint for coding agents now also prints when no DSN is set. It starts by saying that no DSN is set and that the run sends nothing to Sentry.

The hint only printed when a DSN was set. Agents rarely have one while they
set up Sentry: the user adds it to production later, so the app and its
tests run without it, and the agent finishes before the hint can print.

It now prints without a DSN too, and starts by saying that no DSN is set
and that this run sends nothing to Sentry. Every other condition for the
hint is unchanged.
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

PR risk: medium

For commit efa7f20.

Main concerns: reach.

This label is a hint for reviewers, not an approval.

@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Coverage Results 📊

✅ 59481 passed | ⏭️ 3127 skipped | Total: 62608 | Pass Rate: 95.01% | Execution Time: 163m 51s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +41
Passed Tests 📈 +33
Failed Tests 📉 -1
Skipped Tests 📈 +9

➖ Removed Tests (1)

View removed tests
  • test_execution_outcome[start_sync_execution-SUCCEEDED-None]
    • File: tests.integrations.boto3.test_stepfunctions

All tests are passing successfully.

✅ Patch coverage is 100.00% (6 of 6 changed executable lines covered; target 80%).
Project statement coverage is 90.17% (unchanged from base (edb9135) to head (efa7f20)).

Changed files with executable lines (1)
File Patch coverage Changed executable lines
sentry_sdk/_agent_hint.py 100.00% 6/6 covered; partial branches: 168
Coverage diff
@@            Coverage Diff             @@
##        master     #8432       +/-##
==========================================
  Coverage    90.17%    90.17%        —%
==========================================
  Files          201       201         —
  Tracked lines     22184     22187        +3
  Branches      7772      7774        +2
==========================================
+ Hits         20005     20007        +2
- Misses        2179      2180        +1
- Partials      1282      1283        +1

Generated by Coverage Action

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant