This guide covers what an operator can do with the runtime: run it in shadow mode, read the heartbeat, pause work, roll back the current release, understand the proposal flow and merge-risk labels, and the steps that only the owner performs.
Each section names the code it describes. Anything not found in the code is marked as such.
A GitHub run is in shadow mode unless --live is given. rtd.mjs sets shadow = args.github && !args.live. In shadow mode, shadow.mjs wraps the GitHub client so that only read methods are forwarded. Every other method is a no-op that resolves without writing to GitHub.
node runtime/rtd.mjs --work-root <work-root> --github --repo <owner/repo> --repo-root <repo> \
--handler <handler-module> --providers <providers-module> --routing <routing-file>What a shadow run writes:
- Local state under
--work-root. - One file per pass,
<work-root>/shadow/cycle-<n>.jsonl. Each line is a decision that differs from the live decisions given with--live-decisions FILE. The file is empty when there are no differences.
Nothing is posted, labelled, merged or closed on GitHub. Pass --live only when you intend live writes; without it the run is shadow.
The supervisor has its own observe-only mode, described in supervisor.md. runtime/supervise.mjs --mode observe (the default) reads a GitHub fixture file and records decisions in <workspace>/.roundtable/state/supervisor-ledger.jsonl. It does not act. It makes no network calls.
The reference modules in examples/operator let the loop run in shadow mode from the repository alone. They are a starting point, not a live setup: handler.mjs reports every phase as failed (no implementer configured) and providers.mjs stubs every method so that it throws if called. routing.json uses placeholder model names. Replace all three before a live run.
node runtime/rtd.mjs --work-root <workspace>/.roundtable --github --repo <owner/repo> --repo-root <repo> \
--handler examples/operator/handler.mjs --providers examples/operator/providers.mjs --routing examples/operator/routing.json --loop --poll-ms 50--work-rootmust be a directory named.roundtablefor--loop.--poll-ms 50is the pause between passes; choose a larger value for normal use (defaultDEFAULT_POLL_MSin daemon-loop.mjs).- Without
--livethe run is shadow: each pass writes<workspace>/.roundtable/shadow/cycle-<n>.jsonland makes no GitHub write. Stop it with SIGTERM.
Run the steps in order. Steps 3 and 5 and every host unit edit are owner-only; see Owner-only steps.
-
Shadow run. Run the unit with
--loopand without--live, with its own work root<workspace>/.roundtable, as in the template rtd.service. Shadow mode is described in Shadow run. Each cycle writes state under the work root and oneshadow/cycle-<n>.jsonlwith the decisions that differ from--live-decisions FILE. To build that file from a copy of the host status table, runnode scripts/host-decisions-export.mjs --status-tsv FILE --out FILE. It keeps the last status of each issue, mapped to decision words:done,out-of-scopeandstopunchanged,heldandrunningtowait,errortoask; rows with other statuses are skipped. -
Readiness. Run the check and act on its output:
node scripts/cutover-check.mjs --work-root <workspace>/.roundtable --inventory docs/host-patch-inventory.md [--explained FILE]
- Exit
0: every check printsPASS. Go to step 3. - Exit
1: at least oneFAIL <check>: <detail>line. Fix that check and run again. - Exit
2: usage error.
The checks are:
shadow-coverage: the oldest and newestshadow/cycle-<n>.jsonlare at least 48 h apart.shadow-diff: every difference in a cycle file from the last 24 h has an entry in the explained file (defaultshadow/explained.json, a JSON array of{"issue": "<n>", "reason": "<text>"}). A malformed file fails.heartbeat:state/heartbeat.jsonexists and parses.scheduler-stall: the freeze ledger has noscheduler-stallentry in the last 24 h.inbox-timers-outbox:event-inbox.jsonl,timers.jsonandoutbox.jsonlin.roundtable/state/are non-empty.inventory: every row of host-patch-inventory.md issuperseded by ..., a ported rule with an existing test, ornot needed after cutover: <reason>. Rows markednot portedfail this check. The checker does not edit the inventory.
- Exit
-
Live with one worker (owner-only). Add
--live --workers 1 --exclusive-with <pidfile>toExecStart, then reload and restart the unit.<pidfile>is the host loop's pid file.rtdexits2before any side effect when that file names a live process, or when it does not hold a positive integer pid. A missing file means no holder. -
Ramp. Raise the base
--workers(default2) from1toward the host value of 6 to 8 over days. During freeze clusters the loop lowers the effective cap (effectiveCapin liveness.mjs). -
Rollback (owner-only). Remove
--livefromExecStart(or stop the unit), then reload and restart it. Then:- List the issues still labelled
rt:runningwithnode runtime/rtd.mjs status. - Requeue them with
/rt requeue. rt-commands.mjs accepts that word, but no code in this repository acts on it, so the requeue is done by hand on GitHub. - Restart the host scheduler.
Local state under the work root is kept for diagnosis and is not read by the host.
- List the issues still labelled
-
Owner-only steps. Step 3 starts a live run, and the unit edits in steps 1, 3 and 5 are host configuration. The rest of the owner-only work (tags, enabling units, the switch from
$RT_HOME, lingering, and--applyin Rolling backcurrent) is in Owner-only steps.
The supervisor reads <workspace>/.roundtable/state/heartbeat.json. The field names and allowed values are defined in supervisor.md:
| Field | Meaning |
|---|---|
schemaVersion |
Must be 1. |
writtenAt |
Epoch milliseconds when the file was written. |
daemon.pid |
Daemon process id. |
daemon.lastCycleAt |
Epoch milliseconds when the last daemon cycle ended. |
daemon.state |
running, stopping or stopped. |
frontChief.session |
Front Chief session name. |
frontChief.lastTurnAt |
Epoch milliseconds when the last front Chief turn ended. |
frontChief.state |
active, idle or gone. |
lastMaterialProgress |
null, or an object with kind (commit, verdict, pr), at and ref. |
A missing file is reported as missing. Malformed or invalid content is reported as malformed or invalid-schema. The parser never throws; see supervisor.md.
Note: this repository has the reader (runtime/supervise.mjs) and the writer function (writeHeartbeat in runtime/supervisor/heartbeat.mjs). No module in this repository calls writeHeartbeat, so the file is not produced by the code here. Check that the file exists and is recent before you trust it.
The code has two operator mechanisms. Nothing else is available.
- Effect: the queue reader in intake.mjs excludes any open issue labelled
rt:hold. The check is applied when the queue is read, so the issue is not picked up by a later pass. - To pause: add the label on GitHub.
- To resume: remove the label on GitHub.
- The runtime removes this label by itself only when a decomposition has released its child issues. It does not check or use the label otherwise.
- This does not interrupt a wake that is already running. The code does not show that it stops one.
When the auto-merge monitor cannot resolve a merge outcome, it records a main hold. Claims and merges stay paused until the hold is cleared. The monitor opens a GitHub issue for the manual check, titled "Manual merge-outcome check required ...".
node runtime/rtd.mjs --work-root <work-root> --providers <providers-module> --clear-main-pause- Effect: clears the persisted
mainMonitorrecord and, when the providers module exposespause, the pause backend. It prints{"status":"ok","cleared":<bool>}and exits 0. It is a no-op success when nothing is set. - It takes the same lock as a pass. If another pass holds the lock, it prints
{"status":"locked",...}and exits 75. It clears nothing in that case. - It does not check the pull request or
main. Check them first, as the issue text asks. - It does not close the escalation issue. Close that issue by hand.
- It does not remove labels from any issue.
validPauseandresumeFromPausein machine.mjs are not an operator mechanism. Nothing imports them, so they have no effect on a run. Do not use them.- There is no global pause flag and no runtime control API. The supervisor cannot start, stop or message the daemon or the front Chief session.
scripts/release.mjs exports a git commit to <base>/releases/<sha>. With --point-current it also points <base>/current at that release.
node scripts/release.mjs --base <base> --sha <rev> --point-current # dry run (default)
node scripts/release.mjs --base <base> --sha <rev> --point-current --apply # writes--basedefaults to$XDG_DATA_HOME/rtd, or~/.local/share/rtdwhenXDG_DATA_HOMEis unset.--shadefaults toHEADand is resolved to a full commit SHA.- Without
--applythe script prints the plan and writes nothing. - With
--apply, the export fails ifreleases/<sha>already exists. Export and pointing are separate steps in the code, so--point-currentonly succeeds for a commit that has not yet been exported. --point-currentfirst requirescurrentto be absent or a symlink. It then replaces the link atomically (replaceCurrentLinkin release.mjs).- The script stops and restarts no process.
Limits:
- There is no command for re-pointing
currentat a release that already exists inreleases/.replaceCurrentLinkis not exposed by the CLI. Rolling back to such a release is not covered by the code in this repository. resolveCurrentReleasechecks thatcurrentresolves toreleases/<sha>. It is a library function; the CLI does not call it.
Owner-only: --apply (with or without --point-current) changes the host. Dry runs are safe for anyone.
An issue labelled rt:proposed is not picked up while it lacks rt:approved.
- In intake.mjs, a
rt:proposedissue withoutrt:approvedis skipped. The exception is an issue that is already recovering (labelledrt:running,rt:askorrt:blocked). - Adding
rt:approvedmakes the issue eligible again, subject to the other queue rules (for example,type:bugortype:feature, orrt:gofor loop-created issues). - machine.mjs
pickQueuedrops everyrt:proposedissue, approved or not. Nothing in the production queue path calls it (its header says so).
So the behaviour that holds in the code is: rt:proposed alone keeps an issue out of the queue; rt:approved lets it in. Do not describe it as never runnable.
merge-risk.mjs mergeRisk({ paths, changedLines, ci, reviewDisagreement }) returns { label, reasons }:
| Label | When |
|---|---|
risk:high |
A safety file changed (hooks, bin/gh, limits or policy files, guard, CI workflows, scripts/check.mjs), or review disagreement is set. |
risk:medium |
More than 400 changed lines, or a protocol file changed (config.env, package.json, templates or prompts, verdict, classify, decide or review-ledger modules). |
risk:low |
Otherwise. |
If CI is not green, the level goes up by one, capped at risk:high. The reasons array lists each trigger, such as safety-file:<path> or ci-not-green.
The helper is pure. It does not merge anything and does not write GitHub labels. Nothing in this repository calls it outside its tests, so the labels are not applied automatically.
Notification outbox items can also go to IM channels. The routes table is <workspace>/.roundtable/im-routes.json, read at each end-of-cycle flush of rtd --loop and by the host outbox bridge. A missing file, or empty routes, means no IM send; the GitHub notices are unchanged.
{
"channels": {
"ops-slack": { "type": "slack", "urlEnv": "RT_SLACK_URL" },
"ops-tg": { "type": "telegram", "tokenEnv": "RT_TG_TOKEN", "chatEnv": "RT_TG_CHAT" }
},
"routes": { "stall-alert": ["ops-slack"], "digest": ["ops-slack", "ops-tg"] }
}typeiswebhook,slackortelegram.webhookandslackreadurlEnv;telegramreadstokenEnvandchatEnv.- The table holds only the names of environment variables. Set the values in the daemon's environment, never in the file. For example, enable the Slack channel by exporting
RT_SLACK_URLwith the incoming-webhook URL. routesmaps a notification subtype to channel names. Subtypes are the fixed templates inruntime/lib/outbox-im.mjs:merge-notice,action-pending-confirmation,approval-request,rollback-result,stall-alert,digest.- A shadow run (GitHub run without
--live) sends nothing to IM.
Set RT_NOTIFY_WEBHOOK_URL in the daemon's environment to POST each notification outbox item to that URL as JSON. The body has the fields id, ts, event, issue, pr, commit, recipient, summary (and commits for an umbrella-done notice), the same record the local file sink writes. Unset, nothing is sent. A shadow run sends nothing.
RT_NOTIFY_WEBHOOK_KEYis sent in the header named byRT_NOTIFY_WEBHOOK_HEADER(defaultx-rt-notify-key).RT_NOTIFY_WEBHOOK_SCHEME(optional): when set, the header value is<scheme> <key>, for exampleBearerwithRT_NOTIFY_WEBHOOK_HEADER=authorization. Unset, the header value is the raw key.- The host loop posts merge notifications (
done-pending-confirmation) through the same sink, after the GitHub write. A webhook failure is logged as one line on stderr and never dead-letters the item. - Delivery is at-least-once: a network error or non-2xx answer is retried up to three times with exponential backoff. Every attempt carries the same item
id, so the receiver must dedupe on it. - The key and the URL are never logged, and a failure message names only the HTTP status or
network error.
rtd --loop starts a loopback HTTP listener for signed webhook deliveries only when the operator enables it. The shipped default is runtime/defaults/webhook-listener.json with "enabled": false: when the file is absent or the key is false, no listener starts and no socket is opened.
To enable it, create <workspace>/.roundtable/webhook-listener.json (the workspace is the parent of .roundtable/). Its keys replace the default keys:
{
"enabled": true,
"host": "127.0.0.1",
"port": 8787,
"sources": {
"github": { "secretEnv": "RT_WEBHOOK_GITHUB_SECRET", "eventTypes": ["issues"] }
}
}enabled(defaultfalse): turns the listener on.host(default127.0.0.1): the bind address. Set a non-loopback address only on purpose.port(default8787): the TCP port.sources: each key is the source name in the URLPOST /webhook/<name>.secretEnvnames the environment variable that holds that source's HMAC secret; the file holds only the name. Set the variable in the daemon's environment. If an enabled source's variable is unset,rtd --loopfails at start and names the variable.eventTypeslists theX-GitHub-Eventvalues accepted for that source; other types are ignored.
Behavior: a request with a bad X-Hub-Signature-256 gets 401 and is not stored; a source not in sources gets 202 ignored; a delivery id already in the inbox gets 202 duplicate and is dropped. Accepted deliveries are appended to the event inbox as webhook events keyed by the delivery id, and they wake the loop. The body is limited to 1 MiB.
The listener stops when rtd --loop returns. Run node --test test/runtime/webhook-listener.test.mjs to check the behavior without a network.
These steps are for the owner. The loop and operators must not run them. This repository contains no script that performs them, and the code does not verify them. Record the result of each step outside the repository.
- Tag
rtd-v*: create a release tag for the daemon. No code here creates or checks tags. - Enable units on the host: the templates in
deploy/systemd/are not enabled or installed by any script. The owner replaces every<placeholder>, installs the unit, and runssystemctl --user enablefor it.rtd.servicehas no[Install]section. - Cut over from
$RT_HOME: switch the host from the previous install in$RT_HOMEto the new release. No code here does this. - Enable lingering for the service user, so that user units keep running without a login session. No code here does this.
Also owner-only: the --apply step of the rollback above, and any live run (--live).