Skip to content

fix: retry SMTP 4xx, 503 on agent auth DB errors, scope checkGroupUid to the org - #973

Merged
fclairamb merged 3 commits into
mainfrom
feat/todos-2026-11-21
Nov 21, 2026
Merged

fclairamb merged 3 commits into
mainfrom
feat/todos-2026-11-21

Conversation

@fclairamb

Copy link
Copy Markdown
Owner

Batch of fixes for three production issues seen on 2026-11-20.

  • SMTP 4xx replies are retried (452 4.4.5 Rate limit exceeded was classified as permanent and the alert was dropped). IsRetryableSendError now recognises go-mail's SendError codes; recipient addresses are stripped from the logged and stored error.
  • Agent WebSocket auth answers 503 + Retry-After on database errors instead of 401 (reconnect, nonce store, enrollment token lookup, Postgres and SQLite). Malformed agent UIDs are rejected before the lookup. The agent treats a 5xx at dial as a lost connection (WARN, retry).
  • checkGroupUid is resolved inside the caller's org (UID or slug) on create, update/upsert and clone: an unknown or foreign group gets 400 "check group not found" (REST and MCP), no more 22P02 from Postgres. Empty string still ungroups.

Not covered: a dedicated send-rate limiter after a rate-limit reply (retries use the job backoff); the import dry-run planner doesn't validate the group.

Closes fclairamb/solidping-business#100
Closes fclairamb/solidping-business#101
Closes fclairamb/solidping-business#102

🤖 Generated with Claude Code

fclairamb and others added 3 commits November 21, 2026 21:11
…clairamb/solidping-business#100)

A "452 4.4.5 rate limit" reply to RCPT TO failed the notification job for
good: IsRetryableSendError (internal/email/sender.go) only read the code
from a *textproto.Error, and go-mail returns its own SendError. It now uses
smtpReply(), so any 4xx is retryable; the email notification sender wraps it
in a RetryableError, which the notification job retries after its backoff
(job_notification.go also honours RetryableError now), as does the email job.
go-mail's ", affected recipient(s): ..." suffix is stripped from the logged
and returned error. TestSend_RateLimitReplyIsRetryableAndRedacted fails
before the fix.

Closes fclairamb/solidping-business#100

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…iramb/solidping-business#101)

During a database outage every agent reconnect got a 401: serveReconnect
(internal/handlers/agentws/handler.go) answered "Unknown agent" to any
GetAgent error and "Nonce already used" to any nonce store error, and
serveEnrollment read any token lookup error as a bad token (the DB layer
mapped every error to ErrEnrollmentTokenInvalid). Only not found, a bad
signature or a replayed nonce now give 401 (a malformed agent UID is
rejected before the lookup); other errors give 503 with Retry-After, logged
at WARN. The agent treats a 5xx handshake as a lost connection (WARN once,
re-claim). TestAgentAuthDatabaseDownIs503, TestReconnectNonceStoreFailureIs503
and TestWSBackendDial5xxIsConnLoss fail before the fix.

Closes fclairamb/solidping-business#101

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… clone (fclairamb/solidping-business#102)

A group slug passed as checkGroupUid (the MCP tools document "UID or
slug") reached Postgres as is and failed as an invalid uuid (22P02): the
caller got an internal error. CreateCheck, UpdateCheck and CloneCheck
(internal/handlers/checks/service.go) copied the value without a lookup,
so another org's group UID was accepted too. They now resolve it with
GetCheckGroupByUidOrSlug in the caller's org and return
ErrCheckGroupNotFound (400) otherwise; "" still ungroups. Upsert goes
through update/create, import already resolves groups by name.
TestCheckGroupUIDResolvedWithinOrg fails before the fix.

Closes fclairamb/solidping-business#102

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fclairamb fclairamb added autopilot frozen Batch PR under review: takes only its own fixes, new work goes to the next batch labels Nov 21, 2026
@codecov

codecov Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.08197% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.90%. Comparing base (1b51f89) to head (1baaf74).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
server/internal/handlers/checks/handler.go 33.33% 2 Missing ⚠️
server/internal/handlers/checks/service.go 95.83% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #973   +/-   ##
=======================================
  Coverage   90.90%   90.90%           
=======================================
  Files        1405     1405           
  Lines      145221   145270   +49     
=======================================
+ Hits       132006   132055   +49     
  Misses      13207    13207           
  Partials        8        8           
Files with missing lines Coverage Δ
server/internal/checkworker/backend/ws.go 84.26% <100.00%> (+1.10%) ⬆️
server/internal/db/postgres/agents.go 95.66% <100.00%> (+0.03%) ⬆️
server/internal/db/sqlite/agents.go 96.02% <100.00%> (+0.02%) ⬆️
server/internal/email/sender.go 83.06% <100.00%> (+0.46%) ⬆️
server/internal/handlers/agentws/handler.go 85.31% <100.00%> (+0.78%) ⬆️
server/internal/jobs/jobtypes/job_email.go 99.19% <100.00%> (ø)
server/internal/jobs/jobtypes/job_notification.go 98.05% <100.00%> (ø)
server/internal/notifications/email.go 92.83% <100.00%> (+0.07%) ⬆️
server/internal/handlers/checks/service.go 90.81% <95.83%> (+0.18%) ⬆️
server/internal/handlers/checks/handler.go 91.70% <33.33%> (-0.14%) ⬇️

... and 20 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fclairamb
fclairamb merged commit 88179aa into main Nov 21, 2026
41 checks passed
@fclairamb
fclairamb deleted the feat/todos-2026-11-21 branch November 21, 2026 22:20
fclairamb added a commit that referenced this pull request Nov 21, 2026
…invitation page (#974)

Stacked on #973: merge it first.

Closes fclairamb/solidping-business#103

## What changes
- **Server:** every OAuth provider (Google, GitHub, GitLab, Microsoft,
Discord, Slack, OIDC) now logs a WARN `OAuth token exchange failed` with
the provider and its answer when the authorization code exchange fails.
The message shown to the user is unchanged. Until now the provider's
reason (code already used, expired, `redirect_uri` mismatch) was
dropped, so a `TOKEN_EXCHANGE_FAILED` could not be diagnosed.
- **Dashboard:** the invitation page shows a refused sign-in
(`error_description` in the URL) in a banner
(`data-testid="invite-oauth-error"`), so a sign-in started from an
invitation that fails comes back to it with a visible error.

The error hidden inside `returnTo` was already fixed by dda98b7 (login
page lifts it out and strips it from the retry destination).

## Tests
- `TestTokenExchangeFailureIsLogged` (fails on the old code).
- `web/dash0/e2e/invitations.spec.ts`: new case for the error banner.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
fclairamb added a commit that referenced this pull request Nov 22, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.53.0](v0.52.0...v0.53.0)
(2026-11-22)


### Features

* **auth:** OIDC-only mode with IdP group admin roles
([#966](#966))
([1b51f89](1b51f89))
* **service:** install writes config.env, unit loads it via
EnvironmentFile
([#948](#948))
([e4b7fc4](e4b7fc4))


### Bug Fixes

* **aggregation:** drain the raw backlog in one run and log lag
([#978](#978))
([26b93cd](26b93cd))
* **deps:** update github.com/dop251/goja digest to 79d6ad3
([#972](#972))
([02c6821](02c6821))
* **deps:** update go dependencies (non-major)
([#955](#955))
([7dfbcd6](7dfbcd6))
* **deps:** update go dependencies (non-major)
([#968](#968))
([6c09bae](6c09bae))
* **deps:** update go dependencies (non-major)
([#979](#979))
([ee088b6](ee088b6))
* **deps:** update module github.com/oapi-codegen/oapi-codegen/v2 to
v2.9.0 ([#975](#975))
([1121e2e](1121e2e))
* **deps:** update module go.mongodb.org/mongo-driver/v2 to v2.10.1
([#950](#950))
([9e684c4](9e684c4))
* email validation, OAuth error display, translator crash guard, clone
slugs, watchdog pauses
([#959](#959))
([a20f951](a20f951))
* log OAuth code-exchange failures, show a refused sign-in on the
invitation page
([#974](#974))
([c4a8dca](c4a8dca))
* retry SMTP 4xx, 503 on agent auth DB errors, scope checkGroupUid to
the org ([#973](#973))
([88179aa](88179aa))
* **security:** block WebRTC around the browser egress proxy, survive an
invalid status page ?lang=
([#957](#957))
([79bdc82](79bdc82))
* **security:** keep OIDC-group admin grants revocable, mask resolved
channel references, contain browser popups
([#976](#976))
([6e0f09e](6e0f09e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge autopilot frozen Batch PR under review: takes only its own fixes, new work goes to the next batch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant