Uh oh!
There was an error while loading. Please reload this page.
docs(relayfile): Guides section — PR review bot walkthrough (local + cloud) and a copy-paste agent brief - #59
Conversation
…t walkthrough The Relayfile docs explained each primitive well but never walked one build end to end, so the question "how do I actually wire this into my bot?" had no single page to land on. This adds a Guides group to the Relayfile sidebar and its first guide: a PR review bot, start to finish. The guide follows one build through the whole flow — `relayfile setup` for GitHub, verifying the mount and reading LAYOUT.md/.layout.md/_index.json instead of hard-coding paths, adding Linear/Notion/Slack via the live integration catalog, mounting the same workspace in every specialist sandbox with ensureMountedWorkspace and path-scoped tokens, coordinating orchestrator and specialists through shared files (recon in, findings out, streamed as each lands rather than waiting for the slowest), posting the review back by writing a discovered-schema JSON file, and triggering on new PRs with `relayfile listen` instead of running a webhook server. Verification and the dead-letter recovery path are part of the walkthrough, not an appendix. Quickstart gets a banner link to it so the guide is reachable from the page people land on first. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVwyjaMnm1PTRC6m7oXHJV Session-Id: 13b5d5ea-39b6-42f3-86df-6d7bf3570e4b
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 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 |
There was a problem hiding this comment.
1 issue found across 4 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="web/content/docs/file/review-bot.mdx">
<violation number="1" location="web/content/docs/file/review-bot.mdx:236">
P2: The commands this guide tells readers to run don't match the CLI reference (cli.mdx) that the guide links at the bottom. cli.mdx documents dead-lettered writeback inspection/replay as `relayfile ops list / replay` and integration management as only `connect / list / disconnect`, yet the guide uses `relayfile writeback status`, `relayfile writeback retry --opId`, `relayfile integration available --refresh`, `relayfile integration search --refresh --json`, and `relayfile integration set-metadata`. Reconcile the two so a reader following the walkthrough gets working commands (or update the CLI reference to cover the subcommands the guide introduces).</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| relayfile writeback status review-bot --json | jq | ||
| ``` | ||
| Pending writebacks should drain to zero within a sync cycle, and the command exits non-zero only when there are dead-lettered ops — so gate CI on the exit code, not on the lifetime `failed` counter. If `deadLettered` is non-empty, each record under `$MOUNT/.relay/dead-letter/<opId>.json` carries `lastStatus` and a truncated `lastBody` — fix the payload, then `relayfile writeback retry --opId <opId> review-bot`. Read denials are preserved separately in `$MOUNT/.relay/permissions-denied.log`, so an ACL mistake surfaces as a logged denial rather than a silent no-op. Never write anything under `.relay/` yourself. |
There was a problem hiding this comment.
P2: The commands this guide tells readers to run don't match the CLI reference (cli.mdx) that the guide links at the bottom. cli.mdx documents dead-lettered writeback inspection/replay as relayfile ops list / replay and integration management as only connect / list / disconnect, yet the guide uses relayfile writeback status, relayfile writeback retry --opId, relayfile integration available --refresh, relayfile integration search --refresh --json, and relayfile integration set-metadata. Reconcile the two so a reader following the walkthrough gets working commands (or update the CLI reference to cover the subcommands the guide introduces).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At web/content/docs/file/review-bot.mdx, line 236:
<comment>The commands this guide tells readers to run don't match the CLI reference (cli.mdx) that the guide links at the bottom. cli.mdx documents dead-lettered writeback inspection/replay as `relayfile ops list / replay` and integration management as only `connect / list / disconnect`, yet the guide uses `relayfile writeback status`, `relayfile writeback retry --opId`, `relayfile integration available --refresh`, `relayfile integration search --refresh --json`, and `relayfile integration set-metadata`. Reconcile the two so a reader following the walkthrough gets working commands (or update the CLI reference to cover the subcommands the guide introduces).</comment>
<file context>
@@ -0,0 +1,273 @@
+relayfile writeback status review-bot --json | jq
+```
+
+Pending writebacks should drain to zero within a sync cycle, and the command exits non-zero only when there are dead-lettered ops — so gate CI on the exit code, not on the lifetime `failed` counter. If `deadLettered` is non-empty, each record under `$MOUNT/.relay/dead-letter/<opId>.json` carries `lastStatus` and a truncated `lastBody` — fix the payload, then `relayfile writeback retry --opId <opId> review-bot`. Read denials are preserved separately in `$MOUNT/.relay/permissions-denied.log`, so an ACL mistake surfaces as a logged denial rather than a silent no-op. Never write anything under `.relay/` yourself.
+
+## 8. Trigger on a new PR without running a webhook server
</file context>
Preview deployed!
This is a Cloudflare Workers preview version of this PR's build. |
The review bot guide only described a workstation: `relayfile setup` with a browser, a long-lived local mount, a local fleet. That leaves the more common production shape undocumented — a bot provisioned once by CI and run in cloud sandboxes per PR. - A "Where it runs" table up front splits workstation / cloud sandboxes / serverless and states the rule the rest of the guide leans on: provisioning happens once, mounting happens per run. - Headless provisioning with RELAYFILE_CLOUD_TOKEN and --skip-mount, plus the SDK equivalent via RelayfileSetup.fromCloudTokens for a control plane that already holds Cloud tokens, with the rw_ id warning that goes with it. - Inspecting a workspace with no mount at all (`relayfile tree` / `read`), the credential resolution order a cloud runner actually uses (CLOUD_API_* env before ~/.agentworkforce/relay/cloud-auth.json), and the no-mount RelayFileClient path for functions with no writable disk. - Cursor-based catch-up noted where the event listener belongs in the cloud, so a deploy mid-afternoon doesn't drop PRs. Adds a second guide, "Review bot agent brief": a complete operating document addressed to the agent rather than the reader — environment, orient-first rules, ACL boundaries, the /runs run protocol and findings shape, discovery-first writeback, writeback verification, and a troubleshooting table. The page body *is* the document, so the existing markdown mirror makes it copy-paste ready: "Copy page as markdown", or curl /docs/file/markdown/review-bot-brief.md straight into AGENTS.md. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVwyjaMnm1PTRC6m7oXHJV Session-Id: 13b5d5ea-39b6-42f3-86df-6d7bf3570e4b
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Automated end-to-end verification of the Relayfile review-bot guide in this PR: this review was created by writing a JSON draft to /github/repos/AgentWorkforce/agentrelay.com/pulls/59/reviews/ through Relayfile, with no GitHub API call and no GitHub token held by the writer.
…kspace
Ran the review-bot guide end to end against a live Cloud workspace on
relayfile 0.10.41, including a real writeback: the review at
agentrelay.com#59 (pullrequestreview-5112118049) was posted by writing the
JSON draft the guide tells you to write. Several things the guide said —
inherited from the docs it was built on — turned out to be wrong.
Commands that do not exist in 0.10.41:
- `relayfile listen` (invented; also in events.mdx and introduction.mdx).
Replaced with `integration bind` for channel fan-out and the SDK's onWrite.
- `relayfile permissions` (cli.mdx). Removed, with a pointer to .adapter.md
and .relay/state.json deniedPaths instead.
- `seed --dry-run / --exclude / --batch-size` (cli.mdx). All rejected as
undefined flags. Also documented that `seed` and `ops list` resolve
credentials only from ~/.relayfile/credentials.json, not a Cloud session.
Paths that 404 against a live mount:
- The provider layout file is `<provider>/LAYOUT.md`, not `.layout.md`.
- Schemas and adapter contracts live under `/discovery/<provider>/…` with
literal {owner}/{repo}/{pullNumber} segments, not beside the records.
Contract corrections:
- GitHub names records `<number>__<slug>` (number first); the "id is the last
__ segment" rule is Linear's, not universal. Reads need the full directory
name, while the review write path takes the bare pull number.
- Records are envelopes: the provider object is under `.payload`.
- A review payload requires event, body AND comments.
- PUT /fs/file requires If-Match as well as X-Correlation-Id (412 without it).
- `relayfile status` reports pending/conflicts/denied for the local mirror;
dead-letter counts come from `writeback status`. Denials land in
.relay/state.json deniedPaths.
- One registered mirror per workspace per machine; a second mount is refused
rather than added, and `workspace join --name` renames an existing entry.
Also addresses the PR review: the guide/cli.mdx command mismatch is resolved
in cli.mdx's favour of the real binary, the brief now says every
angle-bracket placeholder must be filled, and the no-mount snippet names
where `client` comes from.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NVwyjaMnm1PTRC6m7oXHJV
Session-Id: 13b5d5ea-39b6-42f3-86df-6d7bf3570e4bkjgbot
commented
Sep 4, 2026
Verified end to end against a live workspaceRan the guide against a live Cloud workspace on Addressing the review comments
What the run found wrong
Also found: one registered mirror per workspace per machine (a second mount is refused, Not verifiedThe local mount round-trip. This machine already mirrors the workspace for another project and re-homing it was not worth the risk, so reads and the writeback went through 🤖 Generated with Claude Code |
There was a problem hiding this comment.
All reported issues were addressed across 9 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
… the CLI I tested against relayfile 0.10.41 while 0.10.53 was published, and worse, I concluded `relayfile listen` did not exist because it was absent from `relayfile --help`. It exists in both versions — it is simply hidden from the help summary. `relayfile listen --help` prints its usage, and the command delivered events for three of three test writes. Reverts that wrong edit in events.mdx, introduction.mdx, and the guide, and documents `listen` properly instead: - cli.mdx gains a `relayfile listen` section — the command was missing from the CLI reference entirely — with its real flags (`--provider`, `--path`, `--event`, `--run`, `--format text|json`, `--background`) and a note that it is absent from `--help` and that `relayfile help listen` prints the generic help. - events.mdx carries a real captured event rather than an invented one: small files arrive with content inlined (`inlineContent: true`) and a `correlationId` that ties an event back to the write that caused it. - Both docs now say to supervise a subscriber. On a busy workspace the stream ends mid-message (`read limited at 32769 bytes`) or on a frame EOF within seconds, and reconnecting immediately earns a 429 on the WebSocket handshake. Re-verified on 0.10.53, unchanged: no `relayfile permissions`, `seed` still rejects `--dry-run`/`--exclude`/`--batch-size`, `status` reports pending/conflicts/denied, `writeback status` reports pending/failed/ dead-lettered, and a second mount is refused without `--rehome`. Sidebar version badge 0.10.31 → 0.10.53. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVwyjaMnm1PTRC6m7oXHJV Session-Id: 13b5d5ea-39b6-42f3-86df-6d7bf3570e4b
kjgbot
commented
Sep 4, 2026
Correction: |
There was a problem hiding this comment.
All reported issues were addressed across 6 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…ve placeholders
Confirmed `--run` placeholder substitution live rather than taking the docs'
word for it. The event stream on a busy workspace drops within seconds, so a
single attempt is unreliable; a driver that reconnects with backoff and writes
only once the stream reports "Listening on" caught it on the second try. The
handler received:
ARG1=/runs/doc-verify-20260904/findings/drive-1-1.json {{path}}
ARG2=file.created {{type}}
ARG3=runs {{provider}}
ARG4=rev_2936535 {{revision}}
ARG5..17=type:file.created path:/runs/… revision:rev_… {{event}}
The surprise is `{{event}}`: it expands to the entire event as space-separated
key:value pairs — 13 tokens in this capture — so unquoted it splatters across
argv. That is why the CLI's own embedded example writes '{{event}}' in quotes.
Documented with a warning.
All five placeholders come from the binary's own flag help ("shell command per
event; supports {{path}}, {{type}}, {{provider}}, {{revision}}, {{event}}"),
which no page documented; four of them appeared nowhere in our docs at all.
Also documents `relayfile supervisor install`, which accepts every listen flag
and embeds them verbatim into a launchd/systemd unit that restarts on failure
— the supported way to keep a subscriber alive given the stream instability.
Verification scratch files under /runs/doc-verify-20260904/ have been deleted
from the workspace; /runs is empty again.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NVwyjaMnm1PTRC6m7oXHJV
Session-Id: 13b5d5ea-39b6-42f3-86df-6d7bf3570e4bkjgbot
commented
Sep 4, 2026
|
Five findings, all valid: - cli.mdx still described `seed` as respecting `--exclude` two lines above the warning saying it takes no flags. Dropped the claim. - reads-and-writes.mdx advertised a create example the code block never showed. Added the `.create.example.json` read. - The guide's step 8 ran `relayfile listen default` — the workspace this guide creates is `review-bot`, so the example would have failed. Fixed. - events.mdx's `onWrite` snippet filtered its own writes with `event.source === 'agent'`, a field the event schema doesn't have. The captured event uses `origin`, so it is now `event.origin === 'agent_write'`. - mount-layout.mdx claimed a fixed set of "four alias views" including `by-name/` under `github/repos/`, contradicting the guide and the brief. The alias conflict was real and the reviewer was right to flag it; checked against the live workspace to settle it rather than picking a side: /github/repos/<owner>__<repo>/pulls/ → by-creator, by-edited, by-id, by-state, by-title (flat namespace) /github/repos/<owner>__<repo>/issues/ → by-edited, by-id, by-state, by-title /linear/issues/ → by-id, by-assignee, by-edited, … (under the canonical subtree) /github/repos/by-name/… → 404, does not exist So the set and the location are both per-adapter and per-resource. mount- layout.mdx now says that, with the two locations contrasted, and notes that a flat alias directory's `_index.json` is a manifest of alias subdirectories rather than a record index. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVwyjaMnm1PTRC6m7oXHJV Session-Id: 13b5d5ea-39b6-42f3-86df-6d7bf3570e4b
Why
The Relayfile docs cover each primitive well — mount layout, reads/writes, ACLs, sync, the SDK — but there was no page that walks a single build from an empty machine to a working agent. Coming out of a call with someone building an open-source PR reviewer, the gap was concrete: how do I add integrations without wiring OAuth and webhooks per provider, and how do my specialist agents in separate sandboxes share context?
What
Adds a Guides group to the Relayfile sidebar with two pages.
1.
/docs/file/review-bot— Build a PR review botRuns one build end to end, annotated for both a workstation and a cloud fleet:
relayfile setupinteractively, plus headless provisioning withRELAYFILE_CLOUD_TOKENand--skip-mount, and the SDK equivalent (RelayfileSetup.fromCloudTokens→joinWorkspace→connectIntegration) for a control plane that already holds Cloud tokens.relayfile statusfields to gate on (dead-lettered, not the lifetimefailedcounter), readingLAYOUT.md/.layout.md/_index.jsoninstead of hard-coding paths, andrelayfile tree/readfor checking a workspace with no mount.integration available/search/connectfor Linear, Notion, Slack; Nango vs Composio; the Jira/ConfluencecloudIdfollow-up.ensureMountedWorkspacewithverifyProvider, a path-scoped token per specialist,handle.env()as the whole handoff; where a cloud process gets its credentials (CLOUD_API_*env before~/.agentworkforce/relay/cloud-auth.json); and the no-mountRelayFileClientpath for functions with no writable disk.onWriteas each lands rather than blocking on the slowest..adapter.md,.schema.json,.create.example.json), CREATE-by-non-canonical-filename,writeback statusand dead-letter recovery.relayfile listeninstead of a webhook endpoint, with cursor catch-up noted so a mid-afternoon deploy doesn't drop PRs.2.
/docs/file/review-bot-brief— Review bot agent briefA complete operating document written for the agent: environment variables, orient-before-acting rules, ACL boundaries, the
/runs/<run-id>/protocol and findings shape, discovery-first writeback, writeback verification, a troubleshooting table, and a numbered rules list.The page body is the document, so the existing markdown mirror makes it copy-paste ready with no new infrastructure:
(or the page's built-in Copy page as markdown action).
Quickstart gets a banner link to the guide; the guide links to the brief.
Notes
setting-up-relayfileskill; no new hostnames or endpoints are introduced..layout.md/_index.jsonis authoritative.node_modulesisn't installed in this checkout andnpm install/npm cihang in this environment, sonpm testand a build were not run. The added tests' assertions were hand-checked against the same regex/filtersgetProductSearchIndexuses. Note the workflows build the site but don't run vitest.🤖 Generated with Claude Code
https://claude.ai/code/session_01NVwyjaMnm1PTRC6m7oXHJV