Skip to content

docs(factory): add the Running Factory runbook (local + cloud) - #60

Merged
khaliqgant merged 2 commits into
mainfrom
docs/factory-running-guide
Sep 4, 2026
Merged

docs(factory): add the Running Factory runbook (local + cloud)#60
khaliqgant merged 2 commits into
mainfrom
docs/factory-running-guide

Conversation

@khaliqgant

@khaliqgantkhaliqgant commented Sep 4, 2026

Copy link
Copy Markdown
Member

What

A new Factory docs page, Running Factory (/docs/factory/running), in the style of the Relayfile run-locally/cloud guides: a hands-on runbook for running the loop on one machine first, then each half in the cloud.

  • Prerequisites — tool table, including the requirement that the workspace GitHub App installation covers the target repos (otherwise every write 403s with Resource not accessible by integration)
  • Localfactory init, a durable broker identity (AGENT_RELAY_STATE_DIR + AGENT_RELAY_BROKER_NAME, why restarts collide without it), dry-run, the dispatch sequence (claim → isolated worktree → implementer → PR publish → reviewer → human review, mergePolicy: never), fleetHealth tuning for large workspaces, and a crash-recovery table with the three post-crash residues and their one-line fixes
  • Cloud — CLI control plane + fleet nodes (--backend relay, enrollment, agent-relay.ts, factory.node.json, repo:<label> tags, lease-fenced takeover, one-host-per-workspace, dedicated broker isolation) and the hosted control plane via @agent-relay/factory/hosted (createHostedFactory + DurableObjectHostedFactoryStateStore, the ports table, runOnce/ingestCompletion, epoch fencing, token roles)

Also registers the page in the Run nav group and bumps the sidebar version badge from the stale 0.1.34 to the published 0.1.86.

Why

The local runbook is distilled from a verified end-to-end run today (issue → dispatch → implementer agent → app-authored PR #7 → review → human merge on AgentWorkforce/factory-test-infra), including every failure mode hit along the way. The hosted-cloud section is written against the actual src/hosted API surface, not just the README.

Verification

  • npm --workspace web run test — 31/31 pass (product-docs, docs-markdown-components, llms-txt, code-fence-meta)
  • Frontmatter, internal links, and the nav slug resolve against the content loader path (content/docs/factory/running.mdx)

Summary by cubic

Adds a Running Factory runbook covering local dispatch and cloud deployment, and registers it in the Guides nav group. The page covers prerequisites, the full local loop, crash recovery, and both cloud shapes (CLI control plane with fleet nodes, hosted control plane). Aligns Where it runs with the hosted control plane, gates node up on Agent Relay 11.3.1, and bumps the sidebar version badge from 0.1.34 to 0.1.86.

Written for commit 423f0a6. Summary will update on new commits.

Review in cubic

@chatgpt-codex-connector

chatgpt-codex-connectorBot commented Sep 4, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

ReviewStatusCommitReview trigger
📝 Code ReviewCompleted2026-09-04T17:45:11.806349Zef4e7fbPR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitaiBot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

Next included review available in 49 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: d3442206-780c-44de-88c0-779e96896f90

📥 Commits

Reviewing files that changed from the base of the PR and between ef4e7fb and 423f0a6.

📒 Files selected for processing (3)
  • web/content/docs/factory/running.mdx
  • web/content/docs/factory/where-it-runs.mdx
  • web/lib/product-docs-nav.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 8e776afa-4998-4dca-9236-6419396ccb7a

📥 Commits

Reviewing files that changed from the base of the PR and between 9ddc603 and ef4e7fb.

📒 Files selected for processing (2)
  • web/content/docs/factory/running.mdx
  • web/lib/product-docs-nav.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Adds a complete Running Factory runbook. It covers local, cloud, and hosted operation, including setup, dispatch, recovery, leases, tokens, and telemetry. The Factory navigation now includes the runbook and shows version 0.1.86.

Changes

Factory operations documentation

Layer / File(s)Summary
Local Factory workflow
web/content/docs/factory/running.mdx
Documents prerequisites, local initialization, broker setup, dry runs, dispatch, execution, recovery, cleanup, and status inspection.
Remote and hosted operation
web/content/docs/factory/running.mdx
Documents fleet-node deployment, hosted control-plane integration, durable state, leases, recovery, tokens, and telemetry guidance.
Runbook publication
web/content/docs/factory/running.mdx, web/lib/product-docs-nav.ts
Adds related-documentation links, updates the Factory version badge to 0.1.86, and adds the Running Factory navigation item.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk:⚪ Minimal · up to ef4e7

The new Running Factory runbook is published through Factory navigation and documentation checks pass. No current merge-blocking risk is identified.

Poem

A rabbit read the Factory guide,
With broker maps tucked by its side.
It planned each run,
Then checked each node,
And hopped through recovery wide.
The new page joined the navigation tide.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly and concisely identifies the main change: adding the Running Factory runbook for local and cloud usage.
Description check✅ PassedThe description directly explains the new documentation page, its local and cloud coverage, navigation registration, version update, and verification results.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/factory-running-guide

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit:ef4e7fb690

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

agent-relay cloud enroll --token ocl_node_enr_…

# each boot — node up auto-discovers agent-relay.ts in the working directory
agent-relay node up

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Require 11.3.1 before invoking node up

When readers follow this runbook with Agent Relay 11.3.0 or earlier, node up prints the active workspace key, but this executable block has neither a version gate nor the warning present on the linked where-it-runs page, and the prerequisites merely say Agent Relay must be installed. Require 11.3.1 or later before this command so copying the runbook into a logged or transcribed terminal does not expose an administrative credential.

AGENTS.md reference: AGENTS.md:L25-L31

Useful? React with 👍 / 👎.

Comment threadweb/content/docs/factory/running.mdx Outdated
Comment on lines +117 to +119
### Hosted control plane in Cloud

`@agent-relay/factory/hosted` is the worker-safe control-plane entrypoint — no Node filesystem or process dependency, the complete sweep (`reconcile invocation completions → discover → triage → dispatch → merge gate → idempotent writeback`) driven by your host:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update the linked page for hosted control planes

This new section documents a control plane that runs in a Cloud worker, while the page presented above as the conceptual map still states in where-it-runs.mdx:66-72 that Cloud only receives reporting, no hosted Factory runs the loop, and running in Cloud is merely coming soon. Readers following the cross-link now receive mutually exclusive availability guidance, so update that page alongside this section or clearly distinguish this self-hosted worker API from the unavailable offering.

Useful? React with 👍 / 👎.

Comment threadweb/content/docs/factory/running.mdx Outdated

| Symptom | Cause | Fix |
|---|---|---|
| `Live state changed before writeback` | The run died after claiming the issue | `gh issue edit <n> --remove-label factory:in-progress`, re-dispatch |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make crash recovery work without implicit gh auth

For the documented default github.identity: "auto" setup, the prerequisites explicitly say users do not need gh auth login, yet this recovery command invokes gh issue edit. After a crash in that standard configuration, the prescribed cleanup therefore fails for users who followed the prerequisites exactly; either require/authenticate gh for this recovery path or provide a cleanup command that uses Factory's connected App identity.

Useful? React with 👍 / 👎.

@github-actions

github-actionsBot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Preview deployed!

EnvironmentURL
Webhttps://f19e6c84-agentrelay-web.agent-workforce.workers.dev

This is a Cloudflare Workers preview version of this PR's build.

@khaliqgant

khaliqgant commented Sep 4, 2026

Copy link
Copy Markdown
MemberAuthor

Review feedback addressed in 423f0a6:

  • P1 — node up version gate: the prerequisites row now requires Agent Relay 11.3.1+, and a <Warning> sits directly above the node-online block (matching the where-it-runs wording) so the command is never copied into a transcribed terminal on 11.3.0 or earlier.
  • P2 — where-it-runs contradiction: where-it-runs.mdx's closing section now distinguishes the three things Cloud does today (reporting, fleet enrollment/placement, and self-hosting the control plane in a Cloud worker you own — linking here) from the managed hosted Factory that is still coming. The hosted section here also states up front that it is the self-hosted worker path.
  • P2 — recovery without gh: the crash-recovery table now leads with removing the factory:in-progress label in the GitHub UI, with the gh issue edit form as the optional variant for operators who do have a local login.
  • Nav: the runbook now lives under a Guides group in the Factory sidebar (mirroring the Relayfile section from docs(relayfile): Guides section — PR review bot walkthrough (local + cloud) and a copy-paste agent brief #59) instead of the Run group.

npm --workspace web run test: 31/31 pass.

@cubic-dev-aicubic-dev-aiBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found and verified against the latest diff

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/factory/running.mdx">
<violation number="1" location="web/content/docs/factory/running.mdx:107">
P1: Require Agent Relay 11.3.1 or later before `agent-relay node up`; older versions print the active workspace key, so this copyable command can expose an administrative credential.</violation>
<violation number="2" location="web/content/docs/factory/running.mdx:121">
P3: This page documents a hosted control plane (`@agent-relay/factory/hosted`, `createHostedFactory`, `DurableObjectHostedFactoryStateStore`), but the existing 'Where it runs' page in the same Factory nav group says 'There is no hosted Factory that runs the loop for you yet: the control plane is something you run, on a machine you choose.' The two pages contradict each other. Align the 'Where it runs' claim (or the hosted section) so the docs don't present opposite answers about whether a cloud-hosted control plane exists.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

agent-relay cloud enroll --token ocl_node_enr_…

# each boot — node up auto-discovers agent-relay.ts in the working directory
agent-relay node up

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Require Agent Relay 11.3.1 or later before agent-relay node up; older versions print the active workspace key, so this copyable command can expose an administrative credential.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At web/content/docs/factory/running.mdx, line 103:
<comment>Require Agent Relay 11.3.1 or later before `agent-relay node up`; older versions print the active workspace key, so this copyable command can expose an administrative credential.</comment>
<file context>
@@ -0,0 +1,175 @@
+agent-relay cloud enroll --token ocl_node_enr_…
+
+# each boot — node up auto-discovers agent-relay.ts in the working directory
+agent-relay node up
+```
+
</file context>
Suggested change
agent-relay node up
# Requires Agent Relay >= 11.3.1; older versions print the active workspace key
agent-relay node up


Run **one** control-plane host per workspace; multiple processes on that host are fenced by a shared lock. Active/active across hosts is deliberately unsupported. For production, point `AGENT_RELAY_STATE_DIR` at a directory distinct from any project broker and set `fleetHealth.requireDedicatedBroker: true` — Factory then refuses to silently reuse an interactive broker. `batchSize` defaults to 1 and is capped at 5.

### Hosted control plane in Cloud

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: This page documents a hosted control plane (@agent-relay/factory/hosted, createHostedFactory, DurableObjectHostedFactoryStateStore), but the existing 'Where it runs' page in the same Factory nav group says 'There is no hosted Factory that runs the loop for you yet: the control plane is something you run, on a machine you choose.' The two pages contradict each other. Align the 'Where it runs' claim (or the hosted section) so the docs don't present opposite answers about whether a cloud-hosted control plane exists.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At web/content/docs/factory/running.mdx, line 117:
<comment>This page documents a hosted control plane (`@agent-relay/factory/hosted`, `createHostedFactory`, `DurableObjectHostedFactoryStateStore`), but the existing 'Where it runs' page in the same Factory nav group says 'There is no hosted Factory that runs the loop for you yet: the control plane is something you run, on a machine you choose.' The two pages contradict each other. Align the 'Where it runs' claim (or the hosted section) so the docs don't present opposite answers about whether a cloud-hosted control plane exists.</comment>
<file context>
@@ -0,0 +1,175 @@
+
+Run **one** control-plane host per workspace; multiple processes on that host are fenced by a shared lock. Active/active across hosts is deliberately unsupported. For production, point `AGENT_RELAY_STATE_DIR` at a directory distinct from any project broker and set `fleetHealth.requireDedicatedBroker: true` — Factory then refuses to silently reuse an interactive broker. `batchSize` defaults to 1 and is capped at 5.
+
+### Hosted control plane in Cloud
+
+`@agent-relay/factory/hosted` is the worker-safe control-plane entrypoint — no Node filesystem or process dependency, the complete sweep (`reconcile invocation completions → discover → triage → dispatch → merge gate → idempotent writeback`) driven by your host:
</file context>

@khaliqgant
khaliqgant merged commit 7450bf9 into mainSep 4, 2026
4 checks passed
@khaliqgant
khaliqgant deleted the docs/factory-running-guide branch September 4, 2026 20:21
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@khaliqgant