Skip to content

fix(sentry): pass the Throwable so workflow-generation failures are diagnosable - #135

Merged
escapeboy merged 1 commit into
developfrom
fix/sentry-diagnosable-log-context
Aug 3, 2026
Merged

fix(sentry): pass the Throwable so workflow-generation failures are diagnosable#135
escapeboy merged 1 commit into
developfrom
fix/sentry-diagnosable-log-context

Conversation

@escapeboy

Copy link
Copy Markdown
Owner

Part of the fleetq unresolved-issue sweep. Addresses Sentry #1035 (GenerateWorkflowFromPromptAction: LLM call failed).

Problem

The issue arrived at Sentry as a bare message — no exception class, no stacktrace, no application context. Verified against the raw event JSON: context held only monolog.channel / monolog.level, and there was no log_context, no error, no ids.

Cause: the catch block logged 'error' => $e->getMessage() — a string. sentry-laravel's handler promotes context['exception'] to captureException() (class + stacktrace + grouping) and otherwise falls back to captureMessage():

// vendor/sentry/sentry-laravel/src/Sentry/Laravel/SentryHandler.php:164
$exception = $record['context']['exception'] ?? null;
$isException = $exception instanceof Throwable;
...
$isException ? $this->hub->captureException($exception) : $this->hub->captureMessage(...);

Confirmed by contrast rather than assumption: of the four unresolved fleetq issues, only #1030 has a stacktrace — and OidcSocialController is the only one of the four call sites that already passes 'exception' => $e. The other three pass a message string and all three are stacktrace-less.

Change

One key added to the existing context array. No behaviour change, no new branching.

Scope note

This makes the next occurrence diagnosable; it does not root-cause the LLM failure, because the events Sentry holds today contain nothing to root-cause from. Stating that plainly rather than claiming a fix.

The cloud-layer siblings (#824 BaseStageJob, #847 ProcessAssistantMessageJob) live in overrides/ in the private repo and are fixed there — their base counterparts already call SentryEventCapturer with the Throwable, so community edition was never affected.

Tests

The equivalent assertion (Throwable reaches the log context) is covered on the OIDC path in the private repo — 14 passed there. This action has no existing test harness and mocking the gateway for a one-key context addition would be scaffolding for its own sake, so it ships untested; pint + phpstan clean.

…iagnosable

Sentry #1035 arrived as a bare message: no exception class, no stacktrace, no
context. sentry-laravel promotes `context['exception']` to captureException();
passing only `$e->getMessage()` yields captureMessage() instead.

Verified by contrast in the same app: OidcSocialController already passes the
Throwable and its issue (#1030) is the only one of the four with a stacktrace.
@escapeboy
escapeboy merged commit 4a11b16 into develop Aug 3, 2026
3 checks passed
@escapeboy
escapeboy deleted the fix/sentry-diagnosable-log-context branch August 3, 2026 16:38
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.

1 participant