@sentry/junior-cloudflare 0.80.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@sentry/junior-cloudflare",
3
+ "version": "0.80.0",
4
+ "private": false,
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "type": "module",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/getsentry/junior.git",
12
+ "directory": "packages/junior-cloudflare"
13
+ },
14
+ "files": [
15
+ "plugin.yaml",
16
+ "skills"
17
+ ]
18
+ }
package/plugin.yaml ADDED
@@ -0,0 +1,13 @@
1
+ name: cloudflare
2
+ display-name: Cloudflare
3
+ description: Cloudflare production operations — Workers monitoring, deployments, builds, logs, DNS, and observability via the Cloudflare API MCP server
4
+
5
+ capabilities:
6
+ - api
7
+
8
+ config-keys:
9
+ - account.id
10
+ - zone.id
11
+
12
+ mcp:
13
+ url: https://mcp.cloudflare.com/mcp
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: cloudflare
3
+ description: Cloudflare production operations via the Cloudflare API MCP server. Use when users ask to investigate Workers errors or performance, check build or deployment status, query logs, inspect DNS records, check load balancer pool health, review Zero Trust tunnels, or manage Cloudflare resources. Do not use for Sentry issues, GitHub/Linear ticketing, or non-Cloudflare infrastructure.
4
+ ---
5
+
6
+ # Cloudflare Operations
7
+
8
+ Use this skill for Cloudflare production operations through Cloudflare's hosted API MCP.
9
+
10
+ Default to read-only investigation. Cloudflare OAuth or API token scopes are the permission boundary; this plugin cannot allowlist individual Cloudflare API operations inside MCP.
11
+
12
+ ## MCP basics
13
+
14
+ Cloudflare MCP exposes three tools:
15
+
16
+ - `docs`: search Cloudflare developer documentation for product behavior and terminology.
17
+ - `search`: inspect the current Cloudflare API spec.
18
+ - `execute`: call Cloudflare APIs with minimal JavaScript.
19
+
20
+ Use `docs` when Cloudflare product behavior is unclear. Use `search` before every `execute`; the spec is the source of truth for current methods, paths, parameters, and response shapes. Keep `execute` calls small, scoped, and read-only unless the user has explicitly approved a state-changing change.
21
+
22
+ ## Reference loading
23
+
24
+ Load references conditionally based on the request:
25
+
26
+ | Need | Read |
27
+ | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
28
+ | Worker errors, failed builds, logs, Logpush, DNS checks, LB health, tunnels | [references/workflows.md](references/workflows.md) |
29
+ | Any state-changing request: deploy, rollback, DNS, WAF, LB, Access, Logpush, storage, account membership | [references/safety-and-permissions.md](references/safety-and-permissions.md) |
30
+ | Auth failures, permission errors, multiple accounts/zones, rate limits, stale operations | [references/troubleshooting-workarounds.md](references/troubleshooting-workarounds.md) |
31
+
32
+ ## Workflow
33
+
34
+ 1. Classify the request as read-only investigation or state-changing work.
35
+ 2. Resolve target scope: explicit user account/zone/resource wins; otherwise use `cloudflare.account.id` and `cloudflare.zone.id` config; otherwise discover with MCP and ask one focused question if ambiguous.
36
+ 3. For any Cloudflare API call, search the MCP API spec first. Do not call Cloudflare API paths from memory or from bundled docs.
37
+ 4. Keep investigation bounded: last 30 minutes for "right now", last 24 hours for retrospective checks, and recent N builds/deployments unless the user asks for more.
38
+ 5. Before any state-changing API call, load [references/safety-and-permissions.md](references/safety-and-permissions.md), show current state and the intended change, then wait for explicit approval.
39
+ 6. Lead with concrete findings, then evidence. Include dashboard links when IDs are available.
40
+
41
+ ## Guardrails
42
+
43
+ - **Read-first.** Default to investigation. Do not execute writes in response to ambiguous requests like "fix this" or "roll it back" — investigate and propose a plan first.
44
+ - **Search owns API selection.** The bundled references give workflows, not API authority.
45
+ - **Confirm before writes.** No Worker deploy, rollback, DNS create/update/delete, load balancer change, WAF rule change, Access policy change, or R2/KV/D1 destructive action without explicit user approval after showing current state and change summary.
46
+ - **Never delete data by default.** For R2, KV, and D1, support list/inspect/read. Avoid delete/truncate/drop unless the user explicitly asks and confirms.
47
+ - **Redact sensitive data.** Do not paste raw log bodies, Worker source, env var values, token values, or authorization headers.
48
+ - **Stop on auth failures.** If the MCP server returns an auth error, stop and tell the user. Do not guess at missing permissions.
49
+ - **No scope creep.** Operate only on the account/zone/resource the user specified. Do not enumerate or modify resources in other accounts or zones.
@@ -0,0 +1,69 @@
1
+ # Safety and Permissions
2
+
3
+ ## Write operations requiring explicit confirmation
4
+
5
+ **Never execute the following without fetching current state, showing a before/after summary, and receiving explicit user approval:**
6
+
7
+ | Category | Requires confirmation |
8
+ | ------------------- | ------------------------------------------------------------------------------------------------ |
9
+ | Workers | Deploy (new version), rollback, route create/update/delete, script delete, env var/secret change |
10
+ | DNS | Record create, update, delete (any type — A, AAAA, CNAME, MX, TXT, SRV) |
11
+ | Load Balancers | Pool create/update/delete, monitor create/update/delete, LB failover |
12
+ | WAF / Firewall | Rule create, update, disable, delete; ruleset deploy |
13
+ | Access / Zero Trust | App policy change, tunnel create/delete, connector restart |
14
+ | Logpush | Job enable/disable, destination change, job delete |
15
+ | Storage | R2 bucket delete, KV namespace delete, D1 database drop; **no destructive ops by default** |
16
+ | Account | API token create/delete, member add/remove |
17
+
18
+ ## Pre-write checklist
19
+
20
+ Before executing any state-changing API call:
21
+
22
+ 1. **Identify the resource exactly.** Confirm account ID, zone ID, resource name, and resource ID.
23
+ 2. **Fetch current state.** Use a `GET` call to show what exists now.
24
+ 3. **State the intended change.** Name the Cloudflare operation, method, and the exact fields that will change.
25
+ 4. **Summarize impact.** What breaks if this fails? Is there a rollback path?
26
+ 5. **Ask for approval.** Do not proceed until the user explicitly confirms.
27
+ 6. **Execute and verify.** After the write, confirm the new state with a follow-up `GET`.
28
+
29
+ ## Rollback runbook
30
+
31
+ 1. Search for Workers script deployments and list recent deployments.
32
+ 2. Identify target (last known good version by timestamp or user input).
33
+ 3. Diff compatibility date, bindings metadata, routes, and cron triggers between current and target.
34
+ 4. Confirm the rollback target with the user — include version tag, deploy timestamp, and any config deltas.
35
+ 5. Search for the current deployment operation, then execute it with the target version pinned.
36
+ 6. Verify: check tail logs and analytics for error rate stabilization.
37
+
38
+ ## DNS change safety
39
+
40
+ - Always fetch the existing record by name and type before modifying.
41
+ - Show full current record: name, type, content, TTL, proxied status, priority (if MX).
42
+ - Warn on apex (`@`) records — TTL and CNAME flattening can affect zone behavior.
43
+ - Warn on DMARC (`_dmarc`), SPF (TXT on root), and DKIM records — changes can break email delivery.
44
+ - Confirm zone ID matches the user's intended domain — zone names can be ambiguous in multi-zone accounts.
45
+ - Do not delete records by ID without showing the full record content first.
46
+
47
+ ## Recommended API token permission sets
48
+
49
+ Suggest least-privilege tokens. Do not request or use an all-powerful token by default.
50
+
51
+ | Task | Minimum token permissions |
52
+ | ------------------------------------------- | --------------------------------------------------------------------------------------- |
53
+ | Read-only ops (monitoring, logs, analytics) | Account Resources: Read, Zone: Read, Workers Scripts: Read, Logs: Read, Analytics: Read |
54
+ | Worker deploy / rollback | Workers Scripts: Edit (add Workers Routes: Edit if routes change) |
55
+ | DNS management | DNS: Edit, Zone: Read |
56
+ | Load balancer management | Load Balancers: Edit, Zone: Read |
57
+ | Logpush job management | Logs: Edit |
58
+ | Zero Trust / Access | Access: Edit, Zero Trust: Edit |
59
+ | R2 / KV / D1 read-only | corresponding Read scopes only |
60
+
61
+ When the user's token lacks required permissions, stop and explain what permission is needed rather than attempting workarounds.
62
+
63
+ ## Sensitive data redaction
64
+
65
+ - Do not print Worker script source code in responses.
66
+ - Do not print env var values, secrets, or binding credentials.
67
+ - Do not print full authorization headers, cookies, or tokens from log samples.
68
+ - For log bodies and HTTP payloads, print only a short representative sample (1–3 lines) and summarize the pattern.
69
+ - For DNS records, printing record values is fine (they are public) — but flag if a TXT record appears to contain a secret.
@@ -0,0 +1,85 @@
1
+ # Troubleshooting and Workarounds
2
+
3
+ ## Auth failures
4
+
5
+ **Symptom:** MCP returns 401 or "unauthorized" errors.
6
+
7
+ - Stop and tell the user the session is not authorized for the Cloudflare MCP.
8
+ - The Cloudflare MCP uses OAuth. If the user has not authorized yet, they will see an auth prompt — follow Junior's OAuth resume flow.
9
+ - Do not attempt to bypass auth. Do not guess at token scopes.
10
+
11
+ **Symptom:** API calls return 403 "Permission denied" or "Insufficient permissions".
12
+
13
+ - The authorized account lacks the required permission for this resource.
14
+ - Tell the user which operation failed and which Cloudflare permission scope is needed (see `safety-and-permissions.md`).
15
+ - Suggest creating a more scoped token from `dash.cloudflare.com/profile/api-tokens`.
16
+
17
+ ## Multiple accounts
18
+
19
+ **Symptom:** account discovery returns more than one account.
20
+
21
+ - Do not guess which account to use.
22
+ - Show the user the list (name + ID) and ask them to specify.
23
+ - Once identified, suggest they configure `cloudflare.account.id` for this channel.
24
+
25
+ ## Zone name ambiguity
26
+
27
+ **Symptom:** zone lookup by domain returns multiple zones (e.g. test + production zones).
28
+
29
+ - Show all matching zones with their IDs and statuses.
30
+ - Ask the user to confirm the intended zone.
31
+ - Note: some accounts have zone aliases; the `status: active` zone is usually the production zone.
32
+
33
+ ## MCP tool failures
34
+
35
+ **Symptom:** `execute` returns an unexpected error or empty result.
36
+
37
+ - Use `search` to re-confirm the operation shape before retrying.
38
+ - Check whether the operation requires `account_id` vs `zone_id` — this is a common mistake.
39
+ - Use `docs` to verify current product behavior if the spec seems stale.
40
+ - If the MCP server itself returns 5xx, note this and retry once. If it persists, report the error.
41
+
42
+ **Symptom:** `search` returns no results for an expected operation.
43
+
44
+ - Try a broader search term (e.g. `workers` instead of `workers/scripts/deployments`).
45
+ - The spec may use different names than Cloudflare's product docs; use `docs` to clarify terminology.
46
+
47
+ ## Analytics data delays
48
+
49
+ Cloudflare analytics pipelines typically have a 1–2 minute delay. For "right now" questions, note this delay and use tail logs for live data instead of analytics queries.
50
+
51
+ ## Log retention and plan limits
52
+
53
+ - Workers tail logs are live only — they do not provide historical log retrieval.
54
+ - Logpush provides historical logs but requires configuration (destination bucket or external service). If the user has not configured Logpush, tail is the only real-time option.
55
+ - Workers analytics retention varies by plan. Enterprise customers may have longer retention.
56
+ - If a query returns fewer results than expected, check whether plan limits or retention windows are truncating the data.
57
+
58
+ ## Rate limits
59
+
60
+ **Symptom:** API returns 429 Too Many Requests.
61
+
62
+ - Wait a few seconds and retry the query once.
63
+ - If still throttled, report the rate limit and stop.
64
+ - Do not loop or retry aggressively — Cloudflare enforces per-second and per-minute limits.
65
+
66
+ ## Operation changed or not found
67
+
68
+ **Symptom:** An expected Cloudflare operation returns 404.
69
+
70
+ - Use `search` against the current spec. Do not hand-guess a corrected path.
71
+ - Use `docs` to look up the current API surface for the product area.
72
+ - Cloudflare frequently changes API surfaces; the spec in `search` is authoritative.
73
+
74
+ ## Workers Builds vs Pages
75
+
76
+ Cloudflare has two CI systems:
77
+
78
+ - **Workers Builds** — for Worker scripts deployed via `wrangler`
79
+ - **Pages** — for static sites and Pages Functions
80
+
81
+ If the user asks about "builds" and it's unclear which system, ask whether they are deploying a Worker or a Pages project.
82
+
83
+ ## GraphQL Analytics API
84
+
85
+ Some deep analytics (request counts by colo, detailed error breakdown, Web Analytics) are only available through Cloudflare's GraphQL Analytics API at `https://api.cloudflare.com/client/v4/graphql`. Use the `docs` tool to find the relevant GraphQL datasets. Note that GraphQL queries are POST requests with a JSON body containing the query string.
@@ -0,0 +1,121 @@
1
+ # Cloudflare Workflows
2
+
3
+ ## Investigate Worker errors after a deploy
4
+
5
+ 1. List recent deployments to identify which version is live:
6
+ - Search for Workers script deployments, then execute the current list operation.
7
+ 2. Check Worker analytics for error rate change after the deploy:
8
+ - Search for Workers analytics queries and filter by script name and time window covering the deploy.
9
+ 3. Check Worker tail/live logs if the script is still erroring:
10
+ - Search for Workers tail or live logs and start a diagnostic tail session if available.
11
+ 4. Cross-reference with Sentry if errors are instrumented — hand off to the sentry skill for event details.
12
+
13
+ **Report:** current deployment version, error rate before/after deploy, sample error messages, and relevant Cloudflare dashboard link.
14
+
15
+ ---
16
+
17
+ ## Find latest failed Workers Build
18
+
19
+ 1. List recent builds for the account:
20
+ - Search for Workers Builds list operations and filter for failed or recent builds.
21
+ 2. Get the failing build's details:
22
+ - Search for the build detail operation using the build ID.
23
+ 3. Fetch the build logs:
24
+ - Search for build log retrieval and execute it only for the relevant build.
25
+
26
+ **Report:** build ID, trigger (branch/commit), failure timestamp, error lines from build log, dashboard link.
27
+
28
+ ---
29
+
30
+ ## Query logs for a specific ray ID or error
31
+
32
+ 1. Tail logs for the Worker in question (live or recent):
33
+ - Search for Workers tail or live logs and start a diagnostic tail session if available.
34
+ 2. For Logpush (stored logs), check job health first:
35
+ - Search for account-level or zone-level Logpush jobs.
36
+ - Look for `last_complete` and `last_error` fields to confirm delivery health
37
+ 3. If the user has a ray ID (`CF-Ray` header value), it can be used to search stored logs in the configured destination (R2, S3, Splunk, etc.) — note this is outside Cloudflare's API surface.
38
+
39
+ ---
40
+
41
+ ## Check Logpush delivery health
42
+
43
+ 1. List jobs:
44
+ - Search for account-level or zone-level Logpush jobs.
45
+ 2. For each job, check:
46
+ - `enabled`: whether the job is active
47
+ - `last_complete`: last successful delivery timestamp
48
+ - `last_error`: last error timestamp and message
49
+ - `error_message`: most recent error detail
50
+ 3. Flag jobs where `last_error` is more recent than `last_complete`.
51
+
52
+ **Report:** table of job names, destinations, enabled status, last complete, last error.
53
+
54
+ ---
55
+
56
+ ## Check DNS record and proxy status
57
+
58
+ 1. Resolve zone ID from domain name:
59
+ - Search for zone lookup by name and execute it with the requested domain.
60
+ 2. List DNS records (optionally filter by name or type):
61
+ - Search for DNS record list/filter operations and constrain by record name or type.
62
+ 3. For each relevant record, note:
63
+ - `name`, `type`, `content` (IP/value), `ttl`, `proxied` (orange/grey cloud)
64
+ - For MX records: `priority`
65
+ - For TXT records: full content (SPF/DMARC)
66
+
67
+ **Caution:** Report what exists before suggesting changes. See `safety-and-permissions.md` before making DNS changes.
68
+
69
+ ---
70
+
71
+ ## Check load balancer pool health
72
+
73
+ 1. List pools:
74
+ - Search for load balancer pool list operations.
75
+ 2. Get health for a specific pool:
76
+ - Search for pool health operations.
77
+ 3. Check origins within the pool for `healthy` flag and failure counts.
78
+ 4. Check associated monitors for their health check config:
79
+ - Search for load balancer monitor detail operations.
80
+
81
+ **Report:** pool name, total origins, healthy origin count, failing origins and their IPs, monitor type and expected response.
82
+
83
+ ---
84
+
85
+ ## Prepare a Worker rollback
86
+
87
+ **This is a write operation. Follow the safety workflow in `safety-and-permissions.md`.**
88
+
89
+ 1. List deployments to find the rollback target:
90
+ - Search for Workers script deployments and list recent versions/deployments.
91
+ 2. Identify last known good deployment (by version tag, timestamp, or user input).
92
+ 3. Compare compatibility date, bindings, routes, and env var metadata between current and target.
93
+ 4. Show the proposed rollback: current version → target version, timestamp delta, any binding or config changes.
94
+ 5. **Wait for explicit user approval.**
95
+ 6. Deploy the target version:
96
+ - Search for the current Worker deployment operation and execute it with the target version pinned.
97
+ 7. Monitor error rate and tail logs after rollback.
98
+
99
+ ---
100
+
101
+ ## Audit recent configuration changes
102
+
103
+ 1. Fetch account audit log:
104
+ - Search for account audit logs and fetch a bounded recent page.
105
+ 2. Filter by actor, action type, or resource type relevant to the incident window.
106
+ 3. For zone-level changes, also check zone-specific audit entries.
107
+
108
+ **Report:** timestamp, actor (user/API key), action, resource type/name, change summary.
109
+
110
+ ---
111
+
112
+ ## Inspect Zero Trust tunnel health
113
+
114
+ 1. List tunnels:
115
+ - Search for Access or Zero Trust tunnel list operations.
116
+ 2. Get tunnel details and connection status:
117
+ - Search for tunnel detail and tunnel connection operations.
118
+ 3. Check `status` field: `healthy`, `degraded`, `inactive`, `down`.
119
+ 4. Note the number of active connections and their originating connectors.
120
+
121
+ **Report:** tunnel name, status, connector count, edge locations connected, dashboard link.