cloudflare-observability-review
Skill9 starsChanged 2 months 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
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 7 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Use this runbook to answer "what happened in production?" for stellar-raven-codemode using Cloudflare Workers Logs, platform invocation …
- Very specific: line 12
When the investigation is part of an eval round, agent-run forensic review, or other multi-agent maintenance pass, record the query inputs, …
- Distinctive: line 19
Prefer Cloudflare-native request identity for one invocation.
- Very specific: line 30
Never print secrets from .env, .dev.vars, Wrangler, Cloudflare, or MCP responses.
- Very specific: line 32
Use Cloudflare API MCP for historical evidence.
- Distinctive: line 34
Do not copy raw IPs, IP hashes, or IP-derived fingerprints into app logs.
- Very specific: line 41
Do not infer identity from IP/geo/TLS fields unless explicitly doing an abuse review with a separate privacy decision.
- Distinctive: line 56
Use a narrow time window.
- Very specific: line 57
Use unique non-secret markers in clientInfo.name or user-agent when the harness allows it.
- Distinctive: line 109
Wait 30-90 seconds for ingestion before querying.
- Distinctive: line 124
If looking for traces, query OTel/span events by:
- Very specific: line 148
Always split by from — a memo hit and an upstream fetch differ by orders of magnitude, so a mean over both is meaningless.
- Distinctive: line 322
NOT mean the turn lacked evidence — earlier steps hold it.
- Very specific: line 324
Use demo-execute.resultTruncated to identify truncation.
- Distinctive: line 372
Do not reintroduce a model-forwarded correlation id unless production evidence shows Cloudflare/auth observability fails for common …
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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
Use this runbook to answer "what happened in production?" for
stellar-raven-codemode using Cloudflare Workers Logs, platform invocation
events, and OTel spans.
When the investigation is part of an eval round, agent-run forensic review, or other
multi-agent maintenance pass, record the query inputs, Ray IDs, and verdict in the relevant
round ledger (.agents/rounds/) or .agents/TODO.md so the evidence survives outside the
current context window.
Principle
Prefer Cloudflare-native request identity for one invocation. Use the app's privacy-safe OAuth subject/client hashes only for cross-request attribution.
Observability works without a model-facing correlationId contract. Same-user
concurrent MCP tasks are rare, and for debugging/evals we join requests by Ray ID,
time window, user-agent/client marker, host/path/method/status, and auth mode. If an
investigation needs stronger cross-request grouping, add privacy-safe auth
subject/client fields to app logs rather than asking models to forward ids.
Safety Rules
- Never print secrets from
.env,.dev.vars, Wrangler, Cloudflare, or MCP responses. - Use Cloudflare API MCP for historical evidence.
wrangler tailis only a convenience stream; a miss there is not evidence that logs are absent. - Do not copy raw IPs, IP hashes, or IP-derived fingerprints into app logs. Cloudflare platform events already expose IP-bearing request headers.
- It is OK to query and use Cloudflare-native private/platform fields (IP-bearing headers, geo, TLS/client fingerprint fields, user-agent) inside a bounded investigation when they are needed to join or separate requests. Report them only when directly relevant; otherwise report Ray IDs, time windows, paths, statuses, and app event fields.
- Do not infer identity from IP/geo/TLS fields unless explicitly doing an abuse review with a separate privacy decision.
What Joins Reliably
For one HTTP invocation:
- Response
cf-rayheader -> Workers Logs. Strip the colo suffix:a15a1ed37fa5b049-ATL->a15a1ed37fa5b049. - Workers app JSON logs:
$metadata.type = "cf-worker". - Workers platform invocation logs:
$metadata.type = "cf-worker-event". - OTel spans:
$metadata.type = "span", joined bycloudflare.ray_id.
Across a controlled eval/research run:
- Use a narrow time window.
- Use unique non-secret markers in
clientInfo.nameor user-agent when the harness allows it. - Group by service, host, path, method, status, user-agent, and Ray IDs.
Across arbitrary third-party MCP traffic:
- Join one invocation through the Ray ID and Cloudflare request metadata.
- For successful OAuth requests, group across invocations by
subjectHashand/orclientHashfrom the authoritativemcp_requestsummary. Child events join through$metadata.requestId; they do not repeat the hashes. - Old grants issued before client attribution have
clientHash = null. Never fill that gap from user-agent or network fields. - Accept that rare same-user concurrency may be ambiguous.
Identity caveats:
subjectHashis the same 16-hexhashPrefix(subject)used by playground and artifact events.clientHashis a 16-hex, versioned, domain-separated HMAC of the OAuth client id. The raw client id lives only in encrypted grant props.- Rotating
MCP_SERVER_SECRETcreates a temporary split: old grants retain old props while new grants derive new user/client hashes. Demo cookies rotate too. - A wrong named API key intentionally falls through to the OAuth provider and
appears as
accessMode = "oauth-rejected"; do not derive identity from rejected credentials. A valid key appears asaccessMode = "api-key". - OAuth-provider
OPTIONS /mcppreflights emit nomcp_requestapp event.
Live Probe
Generate a known request when needed. Use a named API key (Authorization: Bearer
<name>:<token>). An operator creates one with
npm run mcp-key -- create <name> --out <file>, which writes the credential to a
mode-0600 file. Read it from that file without echoing 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-90 seconds for ingestion before querying.
Query Workflow
- Discover fields if needed with Cloudflare API MCP
/workers/observability/telemetry/keys. - Query recent events with filters:
[
{ "key": "$metadata.service", "operation": "eq", "type": "string", "value": "stellar-raven-codemode" },
{ "key": "$metadata.requestId", "operation": "eq", "type": "string", "value": "<ray-without-colo>" }
]- If looking for traces, query OTel/span events by:
[
{ "key": "cloudflare.script_name", "operation": "eq", "type": "string", "value": "stellar-raven-codemode" },
{ "key": "cloudflare.ray_id", "operation": "eq", "type": "string", "value": "<ray-without-colo>" }
]- For broader reviews, group counts by
$metadata.type,$workers.event.request.path,$workers.event.response.status,$workers.event.request.headers.user-agent, orcloudflare.ray_id. - For cross-request OAuth review, filter app events to
evt = "mcp_request", then group bysubjectHashorclientHash. Use each matching event's$metadata.requestId/rayIdto join child tool/op events and spans. A null client hash means a pre-attribution grant, not an anonymous user.
Skill Retrieval (skill_read)
Skill bodies are fetched from their pinned upstream at read time, not bundled
(ARCHITECTURE.md §6). evt = "skill_read" is the only view of that path.
- Latency profile: group
msbyfrom(memo|cache|upstream). Always split byfrom— a memo hit and an upstream fetch differ by orders of magnitude, so a mean over both is meaningless. - Availability:
evt = "skill_read"withoutcome = "error", grouped by canonicalidandfrom. This is the accepted-risk dependency on raw.githubusercontent.com made observable; a risingcould not fetchrate is the early signal from REAL traffic. - Availability, synthetic:
evt = "skill_canary"— the hourly cron (src/skills/canary.ts) that fetches every pinned file with the caches bypassed. This is the only detector for a Cloudflare-side egress failure, and the only one that works with zero user traffic. Query it whenskill_readis silent: silence there means "nobody asked", never "everything is fine". Two joint readings worth knowing:skill_canary ok=falsewhilecheck-mirrors --fetchis green in CI → the content is fine and our access to it is broken. Cloudflare/network, not upstream.- No
skill_canaryevents at all → the cron is not firing. The detector is down, which reads identically to healthy unless you check.refresh.ymltreats a verdict older than 3h as a failure for exactly this reason.
- Does anyone read sections? group by
shape(whole|sections|files|mixed). Feeds the open question inideas/skill-discovery-without-bundling.md— ifwholedominates, the section catalog entries (skill-sectioncount incatalog/manifest.json) are dead weight. - Which skills are actually used? group by
id; a long never-read tail is evidence for shrinking the read surface. retrievalscounts distinct pinned files a call fetched (a##section read costs 1; N companion files cost N+1). Fields carry no body text and no caller identity — the id is a public catalog id.- Expect an
upstreamread in tens of milliseconds and amemohit near 0 ms.
A NEW field VALUE is not filterable immediately. Filtering
evt = "skill_read" returned zero for ~20 minutes after the first one was ever
emitted, while the events were demonstrably present — joining by
$metadata.requestId showed skill_read sitting right next to the execute
line it belonged to. The filter index lags first appearance. This is a sharper
version of the Field Map warning below: when a filter returns zero for something
you have good reason to believe exists, do not conclude it is missing. Query
broadly (service filter only) and filter client-side, or join by
$metadata.requestId from an event you CAN find. Costs one query instead of an
afternoon of debugging a working emitter.
Demo Playground Failures
For /playground/chat screenshots or user-visible tool cards, do not start only
from the screenshot timestamp. The screenshot may be captured after the failing
turn, or from a local browser that is replaying retained UI state. First search
a wide recent window (usually 10 hours, or the user's stated window) for app
events:
evt = "demo-execute"grouped byokandevidenceOutcome.evt = "demo-chat"withexecuteFailures > 0, grouped byexecuteFailures,finishReason, and Ray/request ID.- Span view for
codemode.execute, grouped by$metadata.messageandsandbox.ok, to separate model-code failures from sandbox/runtime failures.
Then join each failing request by $metadata.requestId:
demo-search: query size, requested/effective limits, hit/total/omitted counts, gated/backfill counts, truncation, and top ids.demo-execute:ok,evidenceOutcome,codeChars, truncation/count fields,ms.op: operation ids/outcomes/timings inside the execute attempt.demo-chat:searchCalls,executeCalls,executeFailures,finishReason,budgetExhausted, andfinalNeededButMissing.cf-worker-event: path/method/status/user-agent and, when needed, the Cloudflare private/platform fields used to disambiguate same-user traffic.
demo-chat-start records only message counts/sizes and subject correlation:
evt = "demo-chat-start"grouped by$metadata.requestId,model,openAiApiMode,reasoningEffort,auth,historyMessages, anduserMessages.latestUserChars,historyChars: sizing clues for truncation/body issues.subjectHash: privacy-safe per-demo-session join key; do not infer real identity from it.
Question, code, result, answer, and provider-error content is intentionally not logged. When wording matters, use user-supplied screenshots/text and mark any inference from counts, operation ids, timestamps, and Ray IDs as best-effort.
Common diagnosis patterns:
object is not iterable (cannot read property Symbol(Symbol.iterator))with code containingPromise.all({ ... })is model-authored JavaScript, not an upstream service outage. The retry should rewrite toPromise.all([callA, callB]).Execution timed outafter successfuloplines usually means the model wrote a slow/broad script or hit the sandbox's 60s wall-clock cap. CheckcodeChars, broad list limits, and operation timings before blaming a service.demo-chatcan still finish with an answer after failed executes; inspectexecuteFailures, not onlyfinishReason.
Field Map
Cloudflare's query/filter keyspace flattens app JSON log fields. If a returned
event object displays app data under source.evt, filter and group by evt unless
the keys endpoint shows the source.* variant
for that dataset. A query using source.evt = "demo-search" can miss events
that evt = "demo-search" finds.
High-value fields:
- MCP request summary:
accessMode,subjectHash,clientHash,requestId,rayId,method,status. Successful requests include identity keys (null outside attributed OAuth); rejected events omit them entirely. - The older
authapp field is redacted to*****by Cloudflare and is not useful for grouping; the/mcpsummary deliberately usesaccessMode. - Browser auth-flow rejections:
evt = "auth_reject"withstatusandreason. Group by both fields.src/auth/workos.tsowns the emitters. Consent retries useretryConsent()with HTTP 303 and a constant reason, such asCSRF token mismatchorTerms acknowledgement required. Authorization errors with an allowed redirect use HTTP 303 anderror.codeas the reason. Without an allowed redirect,text()returns HTTP 400. Its reason usesunredirectable:followed by the error code, error class, orunknown. Callback state failures use HTTP 400. Their reasons match their constant response bodies:Invalid or expired state,Invalid login state, orState binding mismatch. These events omit identity fields. Never hash rejected credentials. Token-exchange failures inside@cloudflare/workers-oauth-provider(/token,/register) stay opaque — status and path only. - App JSON logs:
evt,queryChars,requestedLimit,effectiveLimit,omittedCount,gatedHits,backfillHits,hits,total,truncated,top,ok,evidenceOutcome,codeChars, result/log truncation fields,latestUserChars,historyChars,historyMessages,userMessages,subjectHash,auth,model,openAiApiMode,reasoningEffort $metadata.service,$metadata.requestId,$metadata.type,$metadata.trigger,$metadata.message$workers.event.rayId,$workers.requestId,$workers.event.request.headers.cf-ray$workers.event.request.headers.user-agent$workers.event.request.headers.mcp-protocol-version$workers.event.request.path,$workers.event.request.method,$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
omittedCount is total - hits for the scorer
tiers consulted by that page; like total, it is a floor rather than an
exhaustive missed-result count. A null effectiveLimit means validation or a
refusal prevented the search page from running.
Privacy-sensitive fields already present in platform logs:
$workers.event.request.headers.cf-connecting-ip$workers.event.request.headers.x-real-ip- precise geo, TLS, and client-fingerprint-like metadata
Measurement Traps
Each of these produced a confidently wrong conclusion in a real investigation. They are silent: the query succeeds, the number looks plausible, and nothing signals the error.
- Do not sum request counts without filtering
$metadata.type. App JSON log rows (cf-worker) inherit their invocation's status, so grouping every row by$workers.event.response.statuscounts logging volume, not requests. The unfiltered total can be more than double the real request count. Filter to the invocation type before quoting any request total or rate. search/demo-searchtruncatedis catalog pagination, not byte truncation. It meanstotal > hits.length— more catalog entries matched than the page returned (src/catalog/search.ts). It says nothing about the model-boundary byte cut. A "94% truncated" figure read this way is a category error and cannot justify any payload-size conclusion. Execute-result byte truncation isdemo-execute.resultTruncated/ the--- SOURCE BASIS ---block.recoveryAdviceDeliveredis a host delivery latch, not model compliance. It is set when the checkpoint becomes visible in the tool result, not when the model acts on it. Never infer model behavior from it.evidenceStateon ademo-stepis per-step. The final answering step makes no tool calls, soevidenceState: "none"there is structural and does NOT mean the turn lacked evidence — earlier steps hold it.sourceBasisexists when the result is truncated or an operation provides allowed source metadata. Usedemo-execute.resultTruncatedto identify truncation. Untruncated results with source metadata have no stored result artifact.canonicalUrlCountcomes from the full redacted result before truncation. A zero count cannot show that truncation removed a URL.- A single wide-window
view: "events"query returns a tiny, unrepresentative slice — it is NOT "all the matching events underlimit." On one filter (cf-worker-event,path = /authorize,limit: 500), a flat 7-day query returned about 1% of the events that the same filter returned over consecutive 6-hour windows. The few survivors looked like a plausible complete set, which is what makes this lethal. A returned count far belowlimitis therefore NOT evidence that few events matched. Slice any window wider than ~6h and sum, and never conclude "this never happens" from a flat multi-day query. - ABR sampling is not an iid sample of the filtered set.
abr_levelis 1 for windows of about 12h or less and 10 for wider ones; concatenating windows at different levels biases any ratio computed across them. Query in equal, narrow windows when a ratio matters, and report the level observed. - Check the shape before matching.
rows[].transcriptis an array of objects;transcript.includes("...")is element equality and always returns false.verdictis an object whose label isverdict.score, so comparing verdicts directly compares object identity and reports 100% change. Both mistakes fail silently and look like findings. - The AI Gateway replays completions, so repeats are not samples. The demo
gateway carries
cache_ttl: 300; within that window an identical request returns the recorded completion. It is invisible from inside the Worker — same frames, same telemetry, no marker — and gateway logs will not settle it either, because the demo setscollectLog: false. The tell is arithmetic: a repeat that returns byte-identical answer text at a latency no inference could produce: a multi-step agentic turn that returns thousands of identical characters in about one second is a replay.demoModelSettingssendscf-aig-skip-cache: trueon every demo request, so demo repeats are independent — but any older stored run, and any NEW measured surface that talks to a gateway, needs the header or the same trap returns. Compare repeat latency AND output length before trusting a p50.
Decision Heuristic
- Request-level debugging: Ray ID is enough.
- Controlled eval/research review: Ray ID plus time window and unique marker is enough.
- Ordinary user support: Ray ID plus auth mode, user-agent, host/path/status, and nearby events is usually enough.
- Multi-request attribution by authenticated user/client: use the existing
request-summary
subjectHash/clientHash; do not infer missing attribution from platform fingerprint fields. - Exact separation of rare same-user concurrent tasks: accept ambiguity unless there is evidence it matters enough to add a new app-level mechanism.
Do not reintroduce a model-forwarded correlation id unless production evidence shows Cloudflare/auth observability fails for common investigations.
Report Shape
End with:
- Query inputs: timeframe, filters, Ray IDs, datasets/views.
- Joined evidence: app JSON logs, platform events, spans.
- Gaps: ingestion delay, missing auth subject/client, no session header, etc.
- Privacy notes: IP-bearing or fingerprint-like fields observed.
- Recommendation: Cloudflare-only, add auth subject/client fields, or change service code/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.

