Repository navigation
feat(router): agent_guide_fetched analytics + dashboard recorder exclusion - #162
Conversation
The router's half of relay-agent docs/ANALYTICS_BRIEF.md (phase 1): - ARELAY_ANALYTICS binding to the shared arelay_agent_analytics dataset. - One agent_guide_fetched data point per external GET that negotiated to /u/<handle>/agent.md and whose upstream answered 2xx; HTML, HEAD, direct guide paths, Worker subrequests, redirects, 404, 410 and errors write nothing. Same ordered v1 schema and daily HMAC visitor pseudonym as relay-agent, with a pinned known-answer test. - Fails closed (no write) without ANALYTICS_VISITOR_HASH_SECRET or the binding; never changes a response. - The traffic recorder now excludes /u/<handle>/dashboard (and subpaths), so dashboard requests and ?grant= URLs are never cloned or recorded. - deploy-router.yml syncs ANALYTICS_VISITOR_HASH_SECRET atomically via wrangler deploy --secrets-file from a 0600 runner-temp file, removed in an always() cleanup. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Session-Id: 8fa30995-3394-4357-aadf-23aee1464578
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Devin Review found 1 potential issue.
1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
…order Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Session-Id: 8fa30995-3394-4357-aadf-23aee1464578
There was a problem hiding this comment.
Review completed against the latest diff
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ccac57e. Configure here.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Session-Id: 8fa30995-3394-4357-aadf-23aee1464578
|
Preview deployed!
This is a Cloudflare Workers preview version of this PR's build. |
…ommit (#165) * ci(router): accept a later successful web deploy that includes this commit A newer push supersedes a queued web deploy in its concurrency group, so a router run waiting for its own commit's web deploy saw it cancelled and gave up (#162's router never shipped). Ship once any successful web deploy of this commit or a descendant exists; still refuse if this commit's own web deploy failed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * ci(router): deploy the accepted revision; a lookup error never releases - Check out the revision whose web deploy succeeded (this commit or the later one that contains it), so router and pages always match. - Only look for a later deploy after this commit's own deploy was read and is not a failure; a transient lookup error just retries. - An identical SHA is accepted through the same path. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * ci(router): a failed gh api lookup replaces the value instead of appending Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Router half of phase 1 of relay-agent's
docs/ANALYTICS_BRIEF.md(relay-agent #11). Companion: AgentWorkforce/relay-agent#15.What
ARELAY_ANALYTICS→ Analytics Engine datasetarelay_agent_analytics(same dataset relay-agent writes).agent_guide_fetched: written once per externalGETthat content-negotiated to/u/<handle>/agent.md(arelay.to, www.arelay.to, agentrelay.com/u/) and only after the upstream guide answered 2xx. HTML, HEAD, direct/u/<handle>/agent.mdpaths (no double count), Worker subrequests (cf-worker), redirects, 404, 410 and upstream errors write nothing. A 2xx guide implies the Registry resolved a known handle.router/src/analytics.ts) — deliverynot_applicable, outcomenone, latency-1, writerrouter. Same daily HMAC visitor pseudonym, with a known-answer digest pinned in both repos.ANALYTICS_VISITOR_HASH_SECRETor the binding nothing is written; write failures never change the response.isAgentPageRequestPathnow covers/u/<handle>/dashboardand subpaths, so the dashboard and any?grant=exchange URL are never cloned or recorded (tested with a grant sentinel).deploy-router.ymlsyncsANALYTICS_VISITOR_HASH_SECRETatomically: only present secrets are written to a 0600 file in$RUNNER_TEMP, passed towrangler deploy --secrets-file(additive; omitted secrets are kept), and removed in analways()step. The existing wait-for-web-deploy gate (ci(router): deploy the router only after this commit's web deploy succeeds #154) is unchanged.Tests
router/test/guide-analytics.test.tscovers both hosts, HTML, HEAD, subrequests, 301/302/404/410/500/503, no secret, no binding, throwing writes, sentinel privacy, dashboard and grant recorder exclusion, schema parity, client classes,cf.countryvs spoofed headers, and pseudonym rotation. Router: 127 tests pass andtscis clean.🤖 Generated with Claude Code
Note
Medium Risk
Touches every proxied guide request path and deploy-time secret handling; analytics is best-effort but recorder exclusions change what traffic is stored for replay.
Overview
Adds server-side
agent_guide_fetchedanalytics on the edge router: after a content-negotiated external GET reaches/u/<handle>/agent.mdand the upstream returns 2xx, the worker writes one v1 Analytics Engine point (client class,cf.country, daily HMAC visitor pseudonym) via newrouter/src/analytics.tsand theARELAY_ANALYTICSbinding. HTML/HEAD, direct guide URLs, Worker subrequests, and non-2xx responses are skipped; missing secret or binding fails closed without affecting responses.Traffic recorder exclusions widen: the whole
/u/namespace is treated as agent-page traffic (covering dashboards), and any URL with agrantquery param is never cloned—so dashboard bearer tokens stay out of the replay corpus.Deploy now optionally syncs
ANALYTICS_VISITOR_HASH_SECRETthrough a short-lived0600JSON file andwrangler deploy --secrets-file, with cleanup in analways()step.Reviewed by Cursor Bugbot for commit 2f5e0e9. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Adds server-side analytics to the router: one
agent_guide_fetcheddata point is written per external GET that negotiated to/u/<handle>/agent.mdand got a 2xx upstream. HTML, HEAD, direct guide paths, Worker subrequests, redirects, 404/410, and upstream errors write nothing; the schema matches relay-agent's v1 layout, including the daily HMAC visitor pseudonym and a client class and country read from the original request'scf, never from caller-controlled headers.The traffic recorder now skips the entire
/u/namespace and any URL carrying agrantparameter, so dashboard requests and grant exchange URLs are never cloned or recorded. Analytics fail closed: no binding or no secret means no writes, and write failures never alter the response.Deploy
deploy-router.ymlsyncsANALYTICS_VISITOR_HASH_SECRETatomically via a 0600 secrets file in$RUNNER_TEMP, passed towrangler deploy --secrets-fileand removed in analways()step.Written for commit 2f5e0e9. Summary will update on new commits.
Agent Relay sessions
claudesession8fa30995· opened viagh pr create· last active 2026-10-08