Skip to content

[12.x] Cloud exceptions - #61934

Merged
taylorotwell merged 15 commits into
laravel:12.xfrom
timacdonald:12.x-cloud-exceptions
Oct 24, 2026
Merged

taylorotwell merged 15 commits into
laravel:12.xfrom
timacdonald:12.x-cloud-exceptions

Conversation

@timacdonald

@timacdonald timacdonald commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Backports Laravel Cloud exception reporting from 13.x to 12.x as cherry-picked commits.

The other 13.x bootstrapper changes (scoped disks, read replicas, pooling, credential caching, cloud log channel) are intentionally left out.

On 12.x, symfony/console is ^7.2, so RawInputInterface is unavailable and the redacted command line in the console execution context is always null.

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

Thanks for submitting a PR!

Note that draft PRs are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@timacdonald
timacdonald force-pushed the 12.x-cloud-exceptions branch from 77c40e8 to 342e070 Compare October 9, 2026 06:17
This was referenced Oct 9, 2026
jackbayliss and others added 9 commits October 19, 2026 11:17
Backported as the rename only, without the facade and CloudManager.

* cloud facade

Update CloudManager.php

dont need this import after alll

Rename Cloud foundation to bootstrapper

holy pr feedback

facade bits

test

clean method names

* Update CloudBootstrapperTest.php

* cs

(cherry picked from commit 5fbd12d)
* Improve testing story

* Return if event writing was successful

* Return whether job was successfully forgotten or not

* Register cloud events earlier

* Make Stan happy

* Update tests

* Improve doc blocks

* Update CloudBootstrapper.php

---------

Co-authored-by: Taylor Otwell <taylor@laravel.com>
(cherry picked from commit cb7494d)
(cherry picked from commit 2795df5)
* Expose methods publicly

* formatting

---------

Co-authored-by: Taylor Otwell <taylor@laravel.com>
(cherry picked from commit 48ac5b8)
* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Extract Cloud command UUID for use as exception trace

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Improve test names

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* formatting

* tweak user handling for octaned

* Propagate the request trace ID to jobs dispatched from requests

Jobs are meant to be reported under the trace of the execution that
dispatched them. The trace is carried to the job in hidden Context,
written by the ContextDehydrating listener when the job's payload is
created.

That listener was only registered for console processes, so jobs
dispatched from HTTP requests never carried a trace. Their exceptions
were reported with a null trace_id. Worse, when one of those jobs
dispatched another job, the worker filled the gap with its own
process-wide command trace, grouping every such child job handled by
the worker under a single, unrelated trace.

The listener is now registered for requests as well. When the Context
does not already hold a trace, it falls back to the Cloud-Request-ID
header in requests (the same value the request's own exception reports
use) and to the command trace in the console.

This mirrors what Nightwatch does on Laravel Cloud, where the request
trace is also the Cloud-Request-ID and is propagated to jobs through
hidden Context. Unlike Nightwatch, the trace is written lazily when a
job is dispatched rather than when the execution starts, since only
job payloads need it and the framework has no hook before middleware.
Requests without a Cloud-Request-ID continue to report no trace, and
their jobs now match them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: jradtilbrook <jarryd@tilbrooktech.com>
Co-authored-by: Taylor Otwell <taylor@laravel.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit fee86a4)
@timacdonald
timacdonald force-pushed the 12.x-cloud-exceptions branch from b15d39f to 1bbedbc Compare October 19, 2026 00:18
@timacdonald
timacdonald marked this pull request as ready for review October 20, 2026 03:59
* Collapses into single listener

* Additional tests

* Capture correct execution time for Octane

* Introduce dehydration hook

* use class directly

(cherry picked from commit f6bcad9)
@timacdonald
timacdonald marked this pull request as draft October 20, 2026 04:02
@timacdonald
timacdonald marked this pull request as ready for review October 22, 2026 05:41
@taylorotwell
taylorotwell merged commit 3f73265 into laravel:12.x Oct 24, 2026
70 checks passed
@timacdonald
timacdonald deleted the 12.x-cloud-exceptions branch October 26, 2026 03:29
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.

4 participants