cloudflare-observability-review
Skill17 starsChanged 2 days agoApache-2.0View on GitHub
Investigate live Cloudflare Workers observability for stellar-raven-codemode. Use when reviewing production MCP request logs, playground/demo telemetry, traces, Ray IDs, request headers, telemetry query results, eval observability, agent-run forensics, or whether Cloudflare metadata is enough without app-level correlation IDs.
- Reads credentials
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- audit-reviewabilitySkill
- golden-truthSkill
- improvements-pipelineSkill
- live-drift-resolutionSkill
- retrieval-system-auditSkill
- run-evalsSkill
- truth-maintenanceSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 19
Never print secrets from .env, .dev.vars, Wrangler, Cloudflare, or MCP responses.
- Very specific: line 20
Use the Cloudflare API MCP for historical evidence.
- Distinctive: line 75
Wait 30 to 90 seconds for ingestion before you query.
- Very specific: line 150
No canary events: the cron is not firing.
- Distinctive: line 155
Do not start from a screenshot timestamp.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Cloudflare observability review
Answer "what happened in production?" from Workers Logs, platform invocation events, and OTel
spans. State the question first, then run the narrowest query that can answer it: one Ray ID or a
short window before a wide sweep. Stop when the question is answered. In a round, record the query
inputs, Ray IDs, and verdict in the round ledger or .agents/TODO.md.
Cloudflare-native request identity is enough for one invocation. Use the app's privacy-safe
subjectHash and clientHash only to attribute across requests. Do not add a model-forwarded
correlation ID unless production evidence shows this fails for common investigations.
Safety
- Never print secrets from
.env,.dev.vars, Wrangler, Cloudflare, or MCP responses. - Use the Cloudflare API MCP for historical evidence.
wrangler tailis a convenience stream; a miss there is not evidence that logs are absent. - Platform fields that carry IPs, geo, TLS, or client fingerprints may be queried inside a bounded investigation to join or separate requests. Report them only when directly relevant, never copy them into app logs, and never infer identity from them outside an abuse review with its own privacy decision.
What joins
One invocation:
- The response
cf-rayheader joins to Workers Logs. Strip the colo suffix:a15a1ed37fa5b049-ATLbecomesa15a1ed37fa5b049. - App JSON logs have
$metadata.type = "cf-worker"; platform invocation logs have"cf-worker-event"; OTel spans have"span"and join bycloudflare.ray_id.
A controlled eval or research run: a narrow time window plus a unique non-secret marker in
clientInfo.name or the user-agent, grouped by path, method, status, and Ray ID.
Third-party traffic across requests:
- Group by
subjectHashorclientHashfrom themcp_requestsummary. Child events join through$metadata.requestIdand do not repeat the hashes. subjectHashis the 16-hexhashPrefix(subject)that playground and artifact events use.clientHashis a 16-hex HMAC of the OAuth client ID.clientHash = nullmeans a grant issued before client attribution, not an anonymous user. Never fill the gap from user-agent or network fields.- Rotating
MCP_SERVER_SECRETsplits hashes between old and new grants, and rotates demo cookies. - A wrong named API key falls through to OAuth and appears as
accessMode = "oauth-rejected"; a valid key is"api-key". Never derive identity from rejected credentials. OPTIONS /mcppreflights emit nomcp_requestevent.- Rare same-user concurrent tasks can stay ambiguous. Accept that unless evidence shows it matters.
Live probe
Generate a known request when you need one. Use a named API key from a mode-0600 file (an
operator creates it with npm run mcp-key -- create <name> --out <file>). Do not echo it and do
not load .env into the shell:
RAVEN_KEY_FILE=<path to the credential file>
MARK="raven-live-telemetry-$(date +%s)"
BODY=$(node -e 'const m=process.argv[1]; console.log(JSON.stringify({
jsonrpc:"2.0", id:0, method:"initialize",
params:{protocolVersion:"2025-06-18", capabilities:{},
clientInfo:{name:m, version:"0.0.0"}}
}))' "$MARK")
curl -i -sS https://raven.stellar.org/mcp \
-H "Authorization: Bearer $(cat "$RAVEN_KEY_FILE")" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
--data "$BODY" |
awk 'BEGIN{IGNORECASE=1} /^HTTP\//{print} /^cf-ray:/{print} /^content-type:/{print} /^mcp-session-id:/{print}'Wait 30 to 90 seconds for ingestion before you query.
Query
- Discover fields when needed: Cloudflare API MCP
/workers/observability/telemetry/keys. Events for one request:
[ { "key": "$metadata.service", "operation": "eq", "type": "string", "value": "stellar-raven-codemode" }, { "key": "$metadata.requestId", "operation": "eq", "type": "string", "value": "<ray-without-colo>" } ]Spans for one request:
[ { "key": "cloudflare.script_name", "operation": "eq", "type": "string", "value": "stellar-raven-codemode" }, { "key": "cloudflare.ray_id", "operation": "eq", "type": "string", "value": "<ray-without-colo>" } ]- Broader reviews: group counts by
$metadata.type,$workers.event.request.path,$workers.event.response.status,$workers.event.request.headers.user-agent, orcloudflare.ray_id. - Cross-request OAuth review: filter
evt = "mcp_request", group bysubjectHashorclientHash, then join child events and spans by$metadata.requestId.
Measurement traps
Each of these fails silently: the query succeeds and the number looks plausible.
- Filter
$metadata.typebefore you count requests. App log rows inherit their invocation's status, so an unfiltered group counts log volume and can more than double the request total. - Filter by
evt, notsource.evt, unless the keys endpoint shows thesource.*variant. The keyspace flattens app JSON fields. - A new field value is not filterable at once. The filter index can lag the first emission by
about 20 minutes. When a filter returns zero for something you have reason to expect, query by
service only and filter client-side, or join by
$metadata.requestId. - A wide
view: "events"query returns a small, unrepresentative slice, not every match underlimit. Slice any window wider than about 6 hours and sum. Never conclude "this never happens" from one multi-day query. - ABR sampling is not uniform across window sizes.
abr_levelis 1 for windows up to about 12 hours and 10 above. Use equal, narrow windows for a ratio and report the level. truncatedonsearchanddemo-searchis catalog pagination (total > hits.length), not byte truncation. Byte truncation isdemo-execute.resultTruncatedand the--- SOURCE BASIS ---block.recoveryAdviceDeliveredis a host delivery latch, not model compliance.evidenceStateon ademo-stepis per step. The final answering step makes no tool calls, so"none"there is structural.sourceBasisexists when a result is truncated or an operation provides allowed source metadata.canonicalUrlCountcomes from the full result before truncation, so a zero count cannot show that truncation removed a URL.- Check the shape before you match stored results.
rows[].transcriptis an array of objects, andverdictis an object whose label isverdict.score. String or identity comparisons on either return a wrong answer without an error. - AI Gateway can replay completions. The demo gateway has
cache_ttl: 300, and a replay is invisible from the Worker.demoModelSettingssendscf-aig-skip-cache: true, so demo repeats are independent; any other measured surface that talks to a gateway needs that header. Compare repeat latency and output length before you trust a p50.
Skill reads
Skill bodies are fetched from their pinned upstream at read time (ARCHITECTURE.md §6).
evt = "skill_read": groupmsbyfrom(memo,cache,upstream) and never average across them. Expect tens of milliseconds forupstreamand near zero formemo. For availability, filteroutcome = "error"and group byidandfrom.shape(whole,sections,files,mixed) andidshow what is read; this feeds the open question inideas/skill-discovery-without-bundling.md.retrievalscounts pinned files fetched. Events carry no body text and no caller identity.evt = "skill_canary": the hourly cron (src/skills/canary.ts) fetches every pinned file with caches bypassed. It is the only detector that works with no user traffic. Silence inskill_readmeans nobody asked, not that reads work.ok=falsewhilecheck-mirrors --fetchis green in CI: the content is fine and our access from Cloudflare is broken.- No canary events: the cron is not firing. That reads the same as healthy unless you check;
refresh.ymlfails on a verdict older than 3 hours for this reason.
Playground failures
Do not start from a screenshot timestamp; the capture can postdate the failing turn. Search a wide recent window (about 10 hours, or the stated window) in slices:
evt = "demo-execute"grouped byokandevidenceOutcome.evt = "demo-chat"withexecuteFailures > 0, grouped byfinishReasonand request ID. A chat can finish with an answer after failed executes.- Spans for
codemode.execute, grouped by$metadata.messageandsandbox.ok, to separate model-code failures from sandbox failures.
Then join each failing request by $metadata.requestId: demo-search (limits, hit and omitted
counts, top IDs), demo-execute (ok, evidenceOutcome, codeChars, truncation, ms), op
(operation IDs, outcomes, timings), demo-chat (searchCalls, executeCalls, executeFailures,
finishReason, budgetExhausted, finalNeededButMissing), and demo-chat-start (model,
openAiApiMode, reasoningEffort, message counts and sizes, subjectHash).
Question, code, result, answer, and provider-error text is not logged. Use text the user supplies, and mark inference from counts and IDs as best-effort.
object is not iterablewithPromise.all({ ... })is model-authored JavaScript, not a service outage.Execution timed outafter successfuloplines usually means a slow or broad script hit the 60-second sandbox cap. CheckcodeChars, list limits, and operation timings first.
Field map
- MCP request summary:
accessMode,subjectHash,clientHash,requestId,rayId,method,status. Rejected events omit the identity keys. Cloudflare redacts the olderauthfield, so group byaccessMode. - Auth-flow rejections:
evt = "auth_reject"withstatusandreason;src/auth/workos.tsowns the emitters and reason strings. These events omit identity fields. Failures inside@cloudflare/workers-oauth-provider(/token,/register) show only status and path. - App logs:
evt,queryChars,requestedLimit,effectiveLimit,omittedCount,gatedHits,backfillHits,hits,total,truncated,top,ok,evidenceOutcome,codeChars,latestUserChars,historyChars,historyMessages,userMessages,model,openAiApiMode,reasoningEffort.omittedCountistotal - hitsfor the consulted tiers and, liketotal, a floor. A nulleffectiveLimitmeans validation or a refusal stopped the search. - Metadata:
$metadata.service,.requestId,.type,.trigger,.message. - Platform:
$workers.event.rayId,$workers.requestId,$workers.event.request.path,.method,.headers.user-agent,.headers.mcp-protocol-version,.headers.cf-ray,$workers.event.response.status. - OTel:
cloudflare.script_name,cloudflare.ray_id,cloudflare.colo,cloudflare.asn,http.response.status_code,url.full,user_agent.original,traceId,spanId. - Privacy-sensitive, already in platform logs:
cf-connecting-ip,x-real-ip, precise geo, TLS, and client-fingerprint metadata.
Report
End with the query inputs (timeframe, filters, Ray IDs, views), the joined evidence, the gaps (ingestion delay, missing attribution), any privacy-sensitive fields observed, and one recommendation: Cloudflare-only is enough, add auth subject or client fields, or change service code or docs.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

