Skip to content

Track goals across days with automations, give every agent Harness Relay's own tools (browser, mail, calendar) through one MCP gateway, and keep what reaches other people in an outbox - #87

Draft
cyyeh wants to merge 29 commits into
mainfrom
claude/bold-archimedes-fc9x97
Draft

cyyeh wants to merge 29 commits into
mainfrom
claude/bold-archimedes-fc9x97

Conversation

@cyyeh

@cyyeh cyyeh commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

What and why · 改了什麼、為什麼

This adds the four abilities the capability review rated "not met", one commit each. Later commits fix what independent reviews and CI found, and add Prettier.

1. Automations that track a goal across days (#83), 2611f78

  • What the UI calls an automation (自動任務; a schedule in the API, the code and the data) sends the team a message when the user clicks Run once now, at set times, or when a program calls its webhook. It can track a goal. Each run it starts, in the same chat or in a new chat each time, gets the goal and the latest 12 progress notes in its briefing.
    • The notes are data there, never instructions.
  • Agents end a reply with <progress status="working|done|blocked">…</progress>.
    • The block becomes a progress card and a note.
    • The automation keeps the latest 30 notes, and done switches it off.
  • A run whose replies all fail, or that cannot start, is tried again after 5, 30 and 120 minutes.
    • A run that a quit, restart or update cut off is tried again at startup.
    • Run now and webhook calls are never retried.
  • Runs that carry a tracked run on are tracked too: its message that waited in the queue, the user's answer to its question, and Retry and Continue of its replies (schema 33, from the third review).
  • No set times: the first of five kinds, and a new automation's default, sent only by Run once now and its webhook, with no On to switch. The kinds keep one row, which scrolls sideways on a phone.
  • In the sidebar, New chat and New automation (a lightning bolt; "Automation" as its English text) share the row.
  • Webhooks (step 2 of the triggers proposal): POST /api/hooks/:id with a bearer token sends the automation's message (on Windows the drawer's example is PowerShell's Invoke-RestMethod). The JSON body goes with it as an <event> block the agents treat as data.
    • Only the token's SHA-256 is stored, compared in constant time. A wrong token gets a 404.
    • Bodies are limited to 20 KB and calls to one every 10 seconds.
    • This is the only route without a browser sign-in.
  • Schema 31 (and 33 for the tracked runs).

2. Harness Relay's own tools through one MCP gateway, and the outbox (#84), 969e7cd

  • Every CLI starts a small MCP program as the relay MCP server (Grok and the open agents in full access only: below it, the sandbox that holds their commands holds the MCP servers they start too, and keeps them out of data/tmp; Give Grok and the open agents Harness Relay's own tools below full access, over a loopback HTTP MCP endpoint #88 is about lifting that). Each turn gets its own copy of the program and a token, both in data/tmp, which sandboxes cannot reach on macOS and Linux.
    • On Windows a token serves one connection only, and its file is deleted once the CLI's own program has shown it.
  • The program passes each call over a local socket, a named pipe on Windows.
  • What a call may do depends on its tier:
    • read runs.
    • act asks in the chat below full access, saying what the call will do. "Always allow" is keyed relay:<tool>.
    • send never runs in the turn.
  • The CLI's own question about one of these tools (named exactly as the gateway's: mcp__relay__<tool>, Codex's relay:<tool>) is answered yes without a card, also in an automation run, so the gateway decides by tier.
  • Outbox: a send call becomes a card that only the user's Send executes, once.
    • An identical call while one waits is the same item.
    • Retry, Resend and edits discard what the reply had waiting; branches copy no waiting card.
    • Cards are brought up to date at startup, and a waiting card counts as "Needs you": its notification names the agent and what it would send.
  • Tool groups (browser, mail, calendar) are set per CLI and per member in Settings → Tool library. Schema 32.

3. A browser of its own (#85), 1bd7c89

  • One headless Chrome, Edge or Chromium per conversation, driven over --remote-debugging-pipe, so no debugging port is opened. It has a profile of its own, removed with the conversation.
  • Every connection goes through a proxy of its own. It listens on loopback only, serves only Harness Relay's browsers (each with its own password), and connects only to addresses it checked. So DNS rebinding and WebSockets are caught too.
  • It opens only http and https. It never reaches Harness Relay's own ports or link-local and metadata addresses, not even behind a host name.
  • An address on this computer or the local network is reached only on a host and port the chat's browser opened, and the question about such a page says so. A name that leads both to the internet and here is never opened.
  • Below full access, each new host is asked about like a web fetch, also when a click leads there.
    • Pop-ups are closed at once.
    • Page preloading is off.
    • Calls run one at a time.
  • Tools:
    • browser_open and browser_snapshot: the page's text, with links, buttons and fields numbered. Snapshots run in an isolated world the page's script cannot reach.
    • browser_click and browser_type: the question names the element as the page does and shows the whole text. A click on an element the page covered is refused.
    • browser_screenshot: shown in the reply.
  • A small CDP client of its own; no browser library added.

4. Mail and calendar (#86), 5cca923

  • IMAP, SMTP, MIME and CalDAV clients of Harness Relay's own; no library added.
  • Accounts use an app password, kept in the credential store and never given to a CLI.
    • A saved password goes only to the servers it was given for.
    • It is never shown, not even in part.
  • Tools:
    • mail_search, mail_read and calendar_events (read).
    • mail_draft and calendar_create (act).
    • mail_send and calendar_invite (send, through the outbox, from the account the card shows).
  • Settings has presets for Gmail, iCloud, Fastmail and Yahoo, a Test button, and calendar discovery.
  • OAuth providers (Google Calendar, Microsoft 365) are left for later.

5. What the independent reviews, CI and the user's trials found: bdc59b1, 8baa8f4, 517e38f, b6b2e95, 0f83b3e, 6fc3160 and after

  • Three reviews of the four commits (one per area), a security review of the whole change, and then a second and a third review of the whole pull request were each done by a separate agent. 6fc3160 fixes the third review's findings.
  • After it, as the user asked: schedules with no set times, their default and their row (6fc3160, 913b5ff, bce2ef5); the open agents get the tools in full access (4a6531c, with Give Grok and the open agents Harness Relay's own tools below full access, over a loopback HTTP MCP endpoint #88 for below it); the UI calls schedules automations (3c54f67); the sidebar's two buttons (18e5cac); the outbox's notification says what waits (4b7b036).
  • CI's Windows jobs found two tests that expected Linux's answers on Windows (895a5e6, 995fc51).
  • 0f83b3e also brings the new features to the website (both pages and site/llms.txt) and the guided tour (version 17).
  • Every finding is fixed, with a test. The details are in the comments below.
  • e7c31f0: the accounts' note in Settings spoke of MCP servers' "variable and header values"; it now says how passwords are kept.

6. Prettier, a930940 and 382d9a5

  • Prettier 3.10.1, pinned, in the root and in desktop/, with one set of settings (.prettierrc.json):
    • 140 columns, as wide as most of the code already is;
    • single quotes;
    • code inside template strings left alone.
  • npm run format and npm run format:check, also in desktop/ for that package alone. CI checks the formatting before the typecheck.
  • Left alone (.prettierignore): Markdown, the lockfiles, generated icons and manifest, the CLIs' recorded fixtures, and the landing page's HTML.
  • a930940 adds the setup and its docs; 382d9a5 is the reformat alone (351 files, nothing but Prettier's changes), so a review can skip it.

Fixes #83, fixes #84, fixes #85, fixes #86.

How it was tested · 怎麼測試

  • New unit tests:
    • test/tracking.test.ts and test/orchestrator-tracking.test.ts.
    • test/gateway.test.ts: the real MCP program over a real socket.
    • test/outbox.test.ts and test/orchestrator-gateway.test.ts.
    • test/browser.test.ts: a real Chromium against local pages, skipped where none is found. It covers the gate and the proxy, pop-ups, WebSockets, speculation rules, a hostile page and calls at the same time.
    • test/browser-proxy.test.ts: the proxy on its own.
    • test/connectors.test.ts: stand-in IMAP, SMTP and CalDAV servers on this computer, STARTTLS injection and oversized answers included.
    • test/connectors-web.test.ts.
  • Additions to app, auth, store, prompt, schedule, tools, tools-web, notify, process and config tests.
  • New end-to-end scenarios:
    • A tracked automation's progress card, and the automation switching off.
    • A webhook's token shown once, and a call from outside the browser, on an automation with no set times.
    • Below full access, the CLI's own question about Harness Relay's tool answered with no card, and the gateway's card about adding a calendar event.
    • A fake Claude Code starting the real gateway program and calling mail_send; the card waits until Send delivers it to a stand-in SMTP server, and a second one is discarded.
    • In full access, an open agent (OpenCode's fake) starting the gateway's program from its session's mcpServers and calling mail_send, which waits in the outbox.
  • npm run typecheck and npm run build pass.
  • npm test: 3415 pass, 5 fail. The same 5 fail on main too: this container runs as root, so tests that rely on permission bits fail (open-state, openhands ×2, orchestrator-folders, orchestrator).
  • npm run test:e2e (Chromium, Linux): 416 pass, 39 skipped, 0 fail at 6fc3160 (and every pass at 0f83b3e, 8baa8f4 and after the reformat before it); the specs each later commit touches again after it (456 tests now, with the open agent's gateway test).
  • On GitHub at 995fc51: CI passed (Node 22 and 24, Windows, the packaged app on Linux and Windows), End-to-end passed (Linux on Node 22 and 24, macOS and Windows), and CodeQL.
  • After the reformat: the typecheck (root and desktop), the build and npm test give the same results as before it, and npm run format:check passes in the root and in desktop/.
  • Several new browser and tracking tests were checked by putting the old code back: they fail without the fixes.
  • Not tried:
    • Any real CLI, since none is installed here. Grok and the open agents get the gateway in full access only, as their sandbox covers the MCP servers they start (only OpenCode's fake was tried end to end); Muse Code may do the same. A CLI that asks about an MCP call without the server's name still asks itself. Both are listed in Known limitations.
    • Any real mail or calendar provider.
    • The browser on macOS or Windows.

Docs and translations · 文件與翻譯

Both languages, in the same commits:

  • Architecture: schedules (automations in the UI), the tool library and gateway, browser, mail and calendar, security, persistence, known limitations.
  • Sandboxing, the user guide, and the developer guide (layout, RELAY_BROWSER, HTTP API, test files).
  • The triggers proposal and the proposals index.
  • The README, the website (both pages and site/llms.txt) and the guided tour.
  • AGENTS.md and CONTRIBUTING: the gateway's and the browser proxy's security rules; Prettier (commands, the checks before a commit, the code rule).
  • The README's scripts, the developer guide's commands and CI, the desktop app's README and the pull request template's checklist: npm run format and format:check.
  • The e2e README: scenarios, counts, "Each CLI at a glance", and what is not covered.
  • Both locales.

Screenshots · 截圖

Taken with the end-to-end tests' fake CLIs at the head of this pull request, English in the light theme and 繁體中文 in the dark one. The e2e: words in the messages steer the fake CLIs.

English · light 繁體中文 · dark
The New automation page: no set times by default, the five ways it runs on one row, and a goal to track; in the sidebar, New chat and New automation (a lightning bolt) share the row · 新自動任務頁:預設不定時、五種時間選項在同一列、追蹤的目標;側邊欄的「新對話」與「新自動任務」(閃電圖示)各占一半
An automation's run: the reply's <progress> block shown as a card · 自動任務的執行:回覆的進度卡片
The Automation drawer: times, goal, progress, and a webhook whose token is shown once · 自動任務抽屜:時間、目標、進度、只顯示一次權杖的 webhook
The outbox: a mail waiting for the user's Send · 待送出匣:等你按「送出」的郵件
Below full access, the gateway's own card for an act says what the call will do; the CLI's own question about the tool was answered for the user, so there is no second card · 完全存取以下,gateway 自己的卡片說明這個動作要做什麼;CLI 自己對這個工具的詢問已代為回答,所以沒有第二張卡片
The browser asking before it opens a new host (below full access) · 瀏覽器開啟新網站前先詢問(完全存取以下)
Settings → Tool library: each group can go to any CLI (Grok and the open-source agents in full access only), and the mail and calendar accounts · 設定 → 工具庫:每個工具組別都能給任何 CLI(Grok 與開源 agent 只在完全存取時),以及郵件與行事曆帳號
On a phone (Pixel 7): the New automation page, its five ways on one row that scrolls sideways · 手機:新自動任務頁,時間選項維持一列、可以左右滑動
<img src="https://github.com/Agentic-System-Lab/harness-relay/blob/a9bced76f85bc67e0611f4a2417667843096fc23/pr-screenshots/phone-new-automation-zh-TW-dark.png?raw=true" width="260">
On a phone (Pixel 7): the outbox card · 手機:待送出匣卡片

Checklist · 檢查清單

  • npm run format:check, npm run typecheck, npm test and npm run build pass · 都通過 (but for the 5 tests above that fail as root, before and after)
  • npm run test:e2e passes, if I changed the UI, the HTTP API, the orchestrator or an adapter · 修改了介面、HTTP API、協調器或轉接器時,端對端測試通過 (Chromium on Linux; CI runs macOS and Windows)
  • npm run desktop:typecheck passes and I tried npm run desktop, if I changed desktop/ · desktop/ changed only by Prettier: its typecheck, its build and desktop/scripts/smoke.ts pass; npm run desktop not tried, as this container has no display · 只有 Prettier 改到 desktop/:型別檢查、建置與 smoke 測試通過;這裡沒有畫面,沒試 npm run desktop
  • User-facing text and docs come in both English and 繁體中文 · 都有中英文
  • I read the whole diff, also the parts an agent wrote, and everything above is true · 我讀過整份 diff(包括 agent 寫的部分),以上所寫都是事實

🤖 Generated with Claude Code

https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN

…e woken by a program on this computer

Tracking a goal (#83)
- A schedule can name a goal (`goal`): each run it works on, here or in a new chat each time, gets the goal and the latest 12 progress notes in its briefing (`trackingSection()`).
- Agents end a reply to a scheduled message with `<progress status="working|done|blocked">…</progress>`; `src/shared/tracking.ts` reads it, the reply keeps it as a `progress` part (a card in the chat), and the schedule keeps the latest 30 notes.
- `done` switches the schedule off with a note; `blocked` keeps it on and says what the agent needs.
- A run whose replies all fail, or that cannot start, is tried again after 5, 30 and 120 minutes unless the next time comes first; a run a restart cut off (`inFlight`) is tried again at startup (`Scheduler.recover()`). A stopped run is not retried.

Webhooks (step 2 of the triggers proposal)
- `POST /api/conversations/:id/schedule/hook` makes a token, shown once; only its SHA-256 is kept (`schedules.hook_hash`, never in a conversation object). `DELETE` removes it.
- `POST /api/hooks/:id` with `Authorization: Bearer <token>` sends the schedule's message now, with the JSON body (at most 20 KB) as `ChatMessage.event`, given to the agents as an `<event>` block the briefing calls data. The only route without a browser's sign-in; Host, Origin and JSON checks still apply; a wrong token is a 404; one call per 10 seconds.
- The schedule drawer shows the progress notes and the webhook (with a `curl` example).

Schema
- Version 31: `schedules.goal`, `schedules.tracking`, `schedules.hook`, `schedules.hook_hash`, `messages.event`.

Docs and tests
- Architecture (Schedules, Security, Known limitations), user guide, developer guide (HTTP API, test files), the triggers proposal and the proposals index, the READMEs, and the e2e README, all in both languages; locales in both languages.
- New `test/tracking.test.ts`, `test/orchestrator-tracking.test.ts`; webhook and goal tests in `test/app.test.ts`, `test/auth.test.ts`, `test/store.test.ts`, `test/prompt.test.ts`, `test/schedule.test.ts`; two end-to-end scenarios in `schedule.spec.ts` with a new `e2e:progress` directive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
…nd keep what reaches other people in an outbox until the user sends it

Gateway (#84)
- `src/server/gateway.ts`: the server writes a small MCP program into its data folder (`gateway/relay-mcp.mjs`, from `gatewayShim.ts`) and listens on a socket beside it (a named pipe on Windows). Each turn of an agent with one of the tool groups gets a grant: a token for that turn alone, in a file under `data/tmp`, and an MCP server `relay` added to its MCP servers, so every adapter passes it on. The token ends with the turn.
- Tiers: `read` runs; `act` asks in the chat below full access through the turn's own approvals (keyed by the tool, so "always allow" works; not asked again right after the CLI asked about the same tool); `send` never runs in the turn and goes to the outbox.
- Tool groups (`browser`, `mail`, `calendar`) in the tool library (`relayTools`, none at first), given per CLI and per agent (`relay:<group>`), shown in Settings → Tool library and in the team editor. Not for the open agents, whose sandbox does not open the socket.
- In the desktop app the program runs on the Node.js Harness Relay's own sandbox host uses (`gatewayNode()`); without one, the tools are not offered and Settings says why.

Outbox
- `src/server/outbox.ts` and the `outbox` table: a `send` call's item (tool, arguments, title, preview) and an `outbox` part with its card in the reply; an equal call while one waits is the same item. `POST /api/conversations/:id/outbox/:itemId` with `{ action: 'send' | 'discard' }` sends it once with the server's own credentials, or drops it; the card and a note say what happened. A waiting item counts as waiting for the user (sidebar, notifications). An item a restart cut off while sending is never sent again. Agents read it with `outbox_status`.

Schema
- Version 32: the `outbox` table.

Docs and tests
- Architecture (Tool library, Security, Persistence, Known limitations), user guide, developer guide (layout, HTTP API, tests), AGENTS.md and CONTRIBUTING (the gateway's rule), all in both languages; locales in both languages.
- New `test/gateway.test.ts` (the real MCP program over a real socket), `test/outbox.test.ts`, `test/orchestrator-gateway.test.ts`; tool groups in `test/tools.test.ts`, `test/tools-web.test.ts`, `test/app.test.ts`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
…nd type, and show the user screenshots

Browser tools (#85)
- `src/server/browser/`: one headless Chromium (or Chrome, or Edge) per conversation, started through `process.ts` with `--remote-debugging-pipe` (a new two-pipe option on fds 3 and 4), so no debugging port is opened; a profile of its own in the data folder, removed with the conversation; never the user's browser or sign-ins.
- `cdp.ts`: a small CDP client over the pipe (NUL-ended JSON, answers by id, events by session), so no browser library is added.
- `find.ts`: `RELAY_BROWSER` (new, checked at startup), else Playwright's newest Chromium, else the system's Chrome, Chromium or Edge.
- What it may open (`navigationVerdict()`): only http and https; never Harness Relay's own ports on this computer, nor link-local, multicast, unspecified or metadata addresses. Every document pauses first (`Fetch`): a main-frame page on a host the chat's browser has not opened is asked about below full access (kind `fetch`, keyed by host, so "always allow" holds), also when a click leads there; declined, the browser goes back to the page it was on. Downloads, file choosers and dialogs are refused.
- Tools on the gateway: `browser_open`, `browser_snapshot` (read: the visible text with links, buttons and fields numbered, a password's value never), `browser_click`, `browser_type` (act: real mouse and key events), `browser_screenshot` (read: a PNG in the chat's attachments folder, shown in the reply and given as an image). Page text comes back marked as data from a web page. The browser closes after 10 idle minutes.

Docs and tests
- Architecture, sandboxing, user guide, developer guide (layout, `RELAY_BROWSER`, tests) and AGENTS.md, in both languages.
- New `test/browser.test.ts`: the pipe client against stand-in streams, finding a browser, what may be opened, and with a real Chromium (skipped where none is found) a local page opened, read, clicked, typed into and screenshotted, a declined host, and the profile removed; two pipes in `test/process.test.ts`; `RELAY_BROWSER` in `test/config.test.ts`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
…ave drafts, list and add events, and anything sent waits in the outbox

Mail and calendar tools (#86)
- `src/server/connectors/`: IMAP (`imap.ts`: LOGIN, LIST, EXAMINE, UID SEARCH, UID FETCH, APPEND, literals both ways, STARTTLS), SMTP (`smtp.ts`: EHLO, STARTTLS, AUTH PLAIN or LOGIN, envelope, dot-stuffed DATA), MIME (`mime.ts`: a plain-text UTF-8 message with RFC 2047 headers and no Bcc header; reading text/plain, else HTML as text, in any charset and transfer encoding) and CalDAV (`caldav.ts`: a time range's events, a new event with `If-None-Match: *`, calendar discovery on the same provider, redirects not followed, times in UTC from a wall-clock time in a time zone), all without a library.
- Accounts in Settings → Tool library → Mail and calendar accounts (`ConnectorStore`): app passwords in the credential store, masked in the UI, never given to a CLI; presets for Gmail, iCloud, Fastmail and Yahoo; Test signs in without sending; Find calendars. Servers: TLS or STARTTLS, plain only to this computer; never Harness Relay's own ports.
- Tools on the gateway: `mail_search`, `mail_read`, `calendar_events` (read), `mail_draft`, `calendar_create` (act), `mail_send`, `calendar_invite` (send: the outbox, sent only on the user's Send). Mail and events come back marked as data from the user's mailbox or calendar.
- Routes: `GET /api/connectors`, `PUT /api/connectors/mail/:id`, `PUT /api/connectors/calendar/:id`, `DELETE /api/connectors/:kind/:id`, `POST /api/connectors/:kind/:id/test`, `POST /api/connectors/calendar/discover`.
- The Claude Code fake can call a tool of the real gateway program it was given (`e2e:mcp`, `e2e/fake-cli/lib/mcp.cjs`).

Docs and tests
- Architecture, user guide, developer guide (layout, routes, tests), the READMEs, AGENTS.md and the e2e README (a new scenario, its counts, what is not covered), in both languages; locales in both languages.
- New `test/connectors.test.ts` against stand-in IMAP, SMTP and CalDAV servers on this computer (`test/fake-mail-servers.ts`), `test/connectors-web.test.ts`; the routes in `test/app.test.ts`; an end-to-end scenario in `tools.spec.ts` where a fake CLI calls `mail_send` through the real gateway and the user's Send delivers it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
Comment thread src/server/connectors/mime.ts Fixed
Comment thread src/server/connectors/mime.ts Fixed
Comment thread test/browser.test.ts Fixed
…y, the browser and mail

Three independent reviews of the four commits before this one found these; each is fixed here,
with a test.

Tracked goals and webhooks
- A run the server stopped while shutting down (quit, restart, update) stays in flight, so the
  next start tries it again; before, only a crash kept it.
- Only the schedule's own run in flight is retried: switching it off (or a new goal, or Stop)
  takes it out of flight, so a one-time schedule switched off stays off.
- Run now and a webhook's call are never retried, so a one-time schedule keeps its own time.
- A reply that only reports progress is not counted as a pass, and its card shows.
- `<progress>` blocks: the status read among other attributes; a block inside a fence with more
  in it left as code; the live reply's tail hidden only for a real block.
- The webhook body's `<` is escaped, so it cannot close its `<event>` block; Content-Length is
  checked before the body is read, which is read up to the limit only.

Gateway and outbox
- "Asked by the CLI just now" matches only a request for the gateway's tool by its exact name
  (`mcp__relay__<tool>`, `relay__`, `relay/`, `relay.`), never a command, path or URL holding it.
- Each grant gets its own copy of the shim and its token in `data/tmp`, removed with the turn
  and at the next start, so a sandboxed command can change neither.
- `act` approvals are keyed `relay:<tool>`, apart from other servers' tools of the same name,
  and take no folder lock.
- Retry, Resend and an edited message discard what the reply had waiting, so no item waits
  without a card; a branch copies no waiting card; at startup an item cut off while sending has
  its card brought up to date.
- The shim answers a `null` or array line as an invalid request and refuses a call over 1 MB;
  the server reads lines up to 4 MB.
- An MCP server named `relay` is refused in the library. Cards, titles and the gateway's status
  follow the turn's language. Shared pages leave outbox cards and webhook bodies out.
- `mail_send` and `calendar_invite` pin the account when the card is made.

Browser
- Every request pauses, not only documents: in the tab, and in its frames and workers in other
  processes (auto-attached before they start). Harness Relay's own ports and metadata addresses
  are refused there too.
- A host name's addresses are looked up first, so a name leading to a metadata address or to
  Harness Relay is refused.
- A window a page opens is closed before it loads anything (every request of its refused, then
  closed, as `window.open()` waits for it), and the agent is told.
- Calls on a conversation's browser run one at a time, in order.
- The agent is told why a page was refused (declined, never opened, nobody to ask).
- A password field's value is never read, also as its label.
- An anchor of the open page is not waited for.

Mail and calendar
- An answer to STARTTLS with more after it is refused, for IMAP and SMTP, since that came before
  TLS from anyone on the way.
- iCalendar text escapes every line break, a bare CR too, and drops other control characters.
  Lines fold at 75 octets between characters. A quoted parameter is read whole.
- An all-day event's end is shown as its last day.
- Encoded subject words and long recipient lists fold under 78 characters.
- HTML character references past U+10FFFF or in the surrogates become U+FFFD instead of failing
  the read; hexadecimal ones are read.
- Discovery's "same provider" is the same host or one under the given host's domain, never a
  country's public domain, an address only as itself, and never https to http.
- A kept password goes only to the servers it was given for: changing a mail server, or a
  calendar's address to another provider's (also in discovery), asks for it again.
- What a page, a mail or an event says cannot end its data block or make rows of its own
  (`dataBody()`, `dataLine()`, `dataAttr()`).

Docs, in both languages
- Architecture: schedules' retries, the gateway's files and keys, the outbox, the browser's
  gate, mail and calendar, the table rows' periods, and known limitations (Windows' `data/tmp`;
  DNS rebinding and WebSockets in the browser).
- User guide, sandboxing, the developer guide's test list, and the e2e README's per-CLI table
  and what it does not cover.
- No schema change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
…acked goals

A fresh independent security review of the whole change, and the three limits the earlier
fixes only documented, are closed here, each with a test.

Browser
- Every connection goes through a proxy of its own on loopback (`browser/proxy.ts`), which
  serves only the browsers Harness Relay started (a password each, answered through
  `Fetch.authRequired`) and connects only to addresses it checked, from the same lookup as the
  gate: DNS rebinding and WebSockets are caught, and Chromium looks up no name itself.
- An address on this computer or the local network is reached only on a host and port the
  chat's browser opened while it led there: a page cannot reach local services by itself, and a
  host allowed for the internet that now leads here is refused (`moved`).
- WebRTC keeps to the proxy; page preloading is off (speculation-rules prefetch and prerender
  reached Harness Relay's port before), and a prerendered page is closed.
- Snapshots run in an isolated world: the page's script cannot change what they read, elements
  stay in that world, numbers go on from one snapshot to the next, and a click on an element
  the page laid something over is refused.
- Questions about clicking and typing name the element as the page does, never the agent's
  words, and show the whole text to type.
- Hosts full access opened are asked about again below it; a scheduled run reuses none.
- Chromium gets only the environment it needs (no keys, tokens or proxy settings), and the
  system's own browser is preferred to Playwright's, which never updates itself.

Gateway
- On Windows, where data/tmp cannot be protected, each token serves one connection and its file
  is removed once the CLI's shim has shown it.
- A connection must show its token within 10 seconds and 512 bytes; at most 256 connections;
  stopping the gateway ends them.

Mail and calendar
- An address's name may hold no `<`, `>`, `"`, `@`, backslash, control or formatting character,
  and the envelope takes the address that was checked: the card shows exactly who a mail goes
  to (before, a crafted name sent it elsewhere).
- Reading a mail's HTML takes linear time (one crafted mail held the server for a minute).
- IMAP answers are limited to 16 MB (literals and untagged responses included), SMTP replies to
  256 KB, calendar answers to 16 MB.
- An outbox item goes out from the account its card showed, found by its id alone.
- Passwords are shown as set or not, never their last characters.

Tracked goals
- Progress notes go into the briefing as data: one line each, the blocks' tags in them written
  so they close or open nothing (`dataBody()` now covers opening tags too), and the briefing
  says notes are reports, never instructions.

Docs, in both languages
- Architecture, user guide, sandboxing, the developer guide (layout, `RELAY_BROWSER`'s order,
  the test list with the new `test/browser-proxy.test.ts`), AGENTS.md and CONTRIBUTING (the
  browser's proxy rule).
- No schema change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
Comment thread src/server/connectors/mime.ts Fixed
Comment thread test/browser-proxy.test.ts Fixed
- Settings → Tool library: the mail and calendar accounts' note said "Variable and header values are
  kept in…", the MCP servers' words. It now says passwords are kept there and never shown, not even
  in part (`connectors.passwordsIn`), in both locales.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
Removed again in a later commit: the description links them by this commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
…formatting in CI

- Prettier 3.10.1 (pinned: a new version can format differently), in the root and in desktop/,
  with one set of settings (`.prettierrc.json`): 140 columns, as wide as most of the code already
  is, single quotes, and code in template strings left as it is.
- `npm run format` and `npm run format:check` (and the same in desktop/, for that package alone).
- Left alone (`.prettierignore`, `desktop/.prettierignore`): Markdown, the lockfiles, the web app
  manifest and icons `npm run icons` writes, the CLIs' recorded fixtures, and the landing page's
  HTML (its whitespace, JSON-LD and the search engines' verification files).
- CI checks the formatting before the typecheck.

Docs, in both languages: AGENTS.md (commands, the commit checks, the code rule), CONTRIBUTING,
the README's scripts, the developer guide (running, CI), the desktop app's README, and the pull
request template's checklist. The reformat itself is the next commit, apart from this one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
- `npm run format` over the repository, the desktop app included: nothing but Prettier's changes
  (line breaks, quotes, parentheses, trailing commas), in a commit of their own so a review can
  skip it.
- Checked after it: the typecheck (root and desktop), the build, `npm test` (the same 5 tests fail
  as before, on main too: they rely on permission bits, and this container runs as root) and the
  end-to-end tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
The description keeps linking them by the commit that added them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN

cyyeh commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Independent review · 獨立審查

Three agents reviewed the four commits independently, one for each area:

A fourth agent then did a security review of the whole change (03de8e5..bdc59b1).

None of them wrote any of the code. Each of the first three was asked to check four things:

  • the features work as the issues and docs say;
  • the change brings no new problems (bugs, security, regressions);
  • the unit tests cover enough;
  • the docs are up to date, in both languages.

They read the code and confirmed what they could with throwaway probe tests (a real Chromium, a TLS stand-in, the orchestrator harness).

Every finding is fixed, with a test for each behaviour:

  • the first three reviews' findings in bdc59b1;
  • the security review's findings in 8baa8f4, together with the three limits bdc59b1 had only documented: DNS rebinding and WebSockets in the browser, and the Windows token file.

What they found, and what changed · 發現與修正

Tracked goals and webhooks (#83)

Finding Severity Fix
A normal quit, restart or update cleared inFlight, so the run it cut off was never tried again (only a crash kept it) High While the server shuts down, a run's end leaves it in flight; recover() retries it at the next start
A one-time schedule switched off during its run was switched back on for a retry Medium Only the schedule's own run in flight is retried; switching it off, a new goal or Stop take it out of flight
A failed Run now replaced a one-time schedule's own time with a retry, and the time was lost Medium Only the scheduler's times are retried (retries: true); Run now and webhook calls never are
A reply holding only a <progress> block counted as a pass, so its card was hidden Medium Progress and outbox parts count as having said something
<progress> parsing: a fence's closing line was taken with the block; extra attributes hid the status; HTML's own <progress value> hid a streaming reply Low Separate patterns for a plain and a fenced block, the status read among attributes, a stricter streaming tail
A webhook body could close its <event> block, and its size was checked only after reading all of it Low < written as <; Content-Length checked first, and the body read no further than 20 KB

Gateway and outbox (#84)

Finding Severity Fix
"The CLI just asked" matched any request text, so an always-allowed ls notes/relay/browser_type let the next browser_type run unasked Medium Only a kind-other request whose tool is exactly mcp__relay__<tool> (or relay__, relay/, relay.) counts (gatewayToolNamed())
Retry or Resend left an outbox item waiting with no card: "Needs you" for good Medium A reply taken back discards what it had waiting (discardFor()); the reply that comes again asks anew
A branch copied a waiting card whose Send could only fail Low-med Branches copy answered cards only
After a restart, a card cut off while sending still offered Send Low-med reconcileOutbox() updates it at startup
The shim in data/gateway/ was writable by a sandboxed command when the data folder is under a temp folder Low-med One copy of the shim per grant, beside its token in data/tmp, removed with the turn
Windows gives no sandbox protected paths, so data/tmp can be read there Low Documented in Known limitations (both languages); closed in 8baa8f4 (below)
"Always allow" for browser_click also allowed another server's bare browser_click Low The gateway's approvals are keyed relay:<tool>
A JSON null line crashed the shim; one over-long line cut the socket for the rest of the turn Low Invalid requests are answered; the shim refuses calls over 1 MB; the server reads lines up to 4 MB
English text in the Chinese UI (gateway status, outbox titles and labels) Low Status codes are translated in the UI; tools write in the turn's language (ctx.lang)
Smaller issues: shared pages kept outbox cards; leftover token files; an MCP server named relay dropped silently; act calls took the folder lock; mail_send resolved its account again at Send Low All fixed: SHARE_DROP, RUN_TMP_PREFIXES, the name reserved, noLock, the account pinned on the card (bind)

Browser, mail and calendar (#85, #86)

Finding Severity Fix
A pop-up (target=_blank, window.open) loaded with no check, Relay's ports included; images, frames and fetches were not checked either Medium Every request pauses, also in other-process frames and workers (auto-attached before they start). Pop-ups are closed before they load anything, and the agent is told
A man in the middle could add A2 OK after the STARTTLS answer, read inside TLS as the server's Medium An answer to STARTTLS with anything after it is refused, for IMAP and SMTP (STARTTLS_EXTRA)
Host names were not resolved: 169.254.169.254.nip.io or metadata.google.internal could be opened Medium A host name's addresses are looked up and checked like the name. DNS rebinding and WebSockets were left as documented limits here, then closed in 8baa8f4 (below)
Two agents' calls shared one page: one cleared the other's current, and their navigations aborted each other Med-low One call at a time per conversation's browser, in order
A bare CR in an event's text could start an ATTENDEE line, an invitation that bypasses the outbox Low-med Every line break is escaped, a bare CR included, and other control characters are dropped
Page, mail or event text could close its <web_page>, <mail> or <calendar> block or forge rows Low dataBody(), dataLine(), dataAttr()
Discovery's "same provider" took x.co.uk and attacker.co.uk as the same, and allowed https → http Low sameProvider(): the same host, or one under the given host's domain (not a country's public one); an IP address only as itself; never https → http
A kept password followed a changed server or discovery URL Low A changed mail server, or a calendar address at another provider, needs the password again (connectorPasswordAgain)
Smaller issues: &#N; past U+10FFFF threw; a long password could leak as a label; long non-ASCII subjects were not folded; iCal folding split emoji; all-day ends were exclusive; a quoted CN with : broke parsing; a #fragment waited 20 s; a blocked redirect said "the user did not allow" Low All fixed, each with a test

Security review of the whole change, and the limits left open (8baa8f4)

Finding Severity Fix
A crafted recipient (Alice <attacker@evil> <alice@company>) showed one address on the card while the mail went to another Medium An address's name may hold no <, >, ", @, backslash, control or formatting character; the envelope takes the address that was checked
One crafted HTML mail (400 KB of <) held the whole server for about 64 s each time mail_read read it Medium HTML-to-text in linear time, with no regex that can backtrack quadratically (the same mail now takes 5 ms)
Speculation-rules prefetch and prerender reached Relay's port: the browser makes them outside the page, so the gate never saw them Med-low Every connection goes through the browser's own proxy, which refuses them; page preloading is also off in the profile, so they are not made at all
DNS rebinding, and WebSockets, which never pause in the gate (bdc59b1 only documented them) Medium The proxy is on loopback with a password per browser. It connects only to addresses checked with the gate's own lookup, and Chromium looks up no name itself
A page could reach services on this computer or the local network (a dev server, Docker's API) with its fetches and frames, unasked Medium Local and private addresses are reached only on a host and port the chat's browser opened while it led there. A host allowed for the internet that now leads here is refused (moved)
A progress note could close <progress_notes> and plant a second <tracked_goal> in every later run's briefing Med-low Notes go in as data, one line each, with the blocks' tags neutralised (opening ones too). The briefing says notes are reports, never instructions
Click and type cards showed the agent's own words; long typed text was cut to 80 characters Low The card names the element as the page does, from the latest snapshot, and shows the whole text with its length
A page's script could change what a snapshot returned, or move the numbered element Low Snapshots run in an isolated world; elements stay there; numbers carry on between snapshots; a click on a covered element is refused
Hosts opened once stayed open for later scheduled or lower-permission calls Low Full-access grants are asked about again below full access; a scheduled run reuses none
Mail and calendar answers had no size limit Low IMAP 16 MB (literals and untagged responses included), SMTP 256 KB, CalDAV 16 MB
The gateway socket had no connection limit or token timeout Low Token within 10 s and 512 bytes; at most 256 connections; stopping ends them
On Windows a sandboxed command could read a turn's token file (bdc59b1 only documented it) Low There each token serves one connection, and its file goes once the CLI's own shim has shown it
Smaller issues: an account looked up by name at Send; Chromium got the server's whole environment; a stale bundled Chromium preferred; long passwords showed their last 4 characters Low Pinned by id (accountId); browserEnv(); the system's browser first; passwords fully masked

Still open, and documented: on Linux as root (a container) Chromium cannot use its own sandbox.

Tests · 測試

  • npm run typecheck and npm run build pass.
  • npm test: 3403 pass, 5 fail. The same 5 fail on main too (checked at 03de8e5): this container runs as root, and those tests rely on permission bits.
  • test/browser.test.ts, with the real Chromium: 20 pass. They cover:
    • Relay's port (a stand-in) never reached through a click, a redirect, a host name, an image, a frame, a fetch, a WebSocket, a prefetch or a prerender;
    • pop-ups from a link and from window.open();
    • two calls at the same time;
    • a hostile page;
    • scoped host grants.
  • Several of them were checked against the old code:
    • with the old Document-only gate put back, the gate and pop-up tests fail;
    • without the proxy, the WebSocket and speculation-rules tests fail.
  • test/browser-proxy.test.ts: 4 pass.
  • npm run test:e2e, the full run: 415 pass, 39 skipped, 0 fail, at 8baa8f4 and again after the reformat (382d9a5).

After the reviews · 審查之後

  • Screenshots are in the description, in both languages and on a phone, taken with the end-to-end tests' fake CLIs.

  • They showed one wrong text, fixed in e7c31f0: the mail and calendar accounts' note in Settings spoke of MCP servers' "variable and header values". It now says passwords are kept there and never shown.

  • Prettier (a930940, 382d9a5):

    • one set of settings for the repository and the desktop app;
    • npm run format and format:check, checked in CI;
    • the docs in both languages.

    The reformat is a commit of its own. After it, the typecheck (root and desktop), the build, npm test and the end-to-end tests give the same results as before. The desktop app's build and desktop/scripts/smoke.ts pass too.

Still not tried · 仍未測試

  • Any real CLI.
  • Any real mail or calendar provider.
  • The browser on macOS and Windows.
  • npm run desktop itself (this container has no display).

These are listed in the PR description and in the e2e README's "What they do not cover".


Generated by Claude Code

…CI found

Browser
- Chromium on Linux keeps its crash reports under `$XDG_CONFIG_HOME/<browser>` (`~/.config/google-chrome`,
  say) whatever its `--user-data-dir`: Harness Relay's browser wrote in the user's own browser's
  folder. It now starts with its config and cache folders in its profile (`launchEnv()`); a test with
  the real browser checks that nothing is written in the home it was given (it failed before).
- Finding a browser builds each system's paths as that system writes them, whichever system it runs
  on (the test of macOS's paths failed on Windows).

Protected paths
- `protectedReads()` reads `$XDG_CONFIG_HOME` from the environment it is given, not the server's when
  it is given one: on GitHub's runners, which set it, the tests found the runner's own Chrome folder.

CodeQL
- HTML mail as text: tags are removed in one linear pass that never joins the pieces of a tag into
  one (`<scr<b>ipt>` left `<script>`), and keeps a `<` that starts no tag (`x < 5`), as a browser does.
- The test pages escape what a request sent before showing it, or answer it as plain text.

Docs, in both languages: AGENTS.md and CONTRIBUTING (the browser's environment), architecture (the
browser) and the developer guide's test list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
…lose what the second review found

A second independent review of the whole pull request; the rest of its findings (the website, the
guided tour, the data storage docs, the pop-up test) come in the next commit.

Gateway
- A CLI's own question about one of Harness Relay's tools, named exactly as the gateway's
  (`mcp__relay__<tool>`, Codex's `relay:<tool>`), is answered yes without a card, also in a scheduled
  run and in a conversation that refuses questions; the gateway decides by the tool's tier (a read
  runs, an act is asked about with what it will do, a send waits in the outbox). Before, the CLI's
  card showed only its arguments, hid the gateway's own, and a scheduled run refused even a read.
- Grok gets the tools in full access only: below it, its sandbox keeps the MCP servers it starts out
  of data/tmp, where the program and token are (`GATEWAY_FULL_ACCESS_ONLY`); Settings says so.
- A connection with a token the server does not know, or serves already, gets one answer and ends
  (or ends after the token's wait); such connections have a limit of their own.

Tracked goals
- Only the runs a schedule starts are told the goal and report on it: a reply to the user's own
  message in that chat ("how is CI?") switches nothing off.

Browser
- Its profiles' folder (`data/browser`, cookies under a fixed key) is a protected path, made at start.
- A name that leads both to the internet and to this computer or the local network is never opened
  (`mixed`); the question about a page here says that its pages may then reach that host and port.
- Screenshots are written for the user's account only, and a branch copies those its replies show
  and points them at its copy.

Mail and calendar
- Calendar answers are read in one linear pass (a hostile server's 3 MB took 75 s before).
- The invitation card names the calendar it goes out from; an `accountId` an agent gives is dropped.
- Outbox results and the Test and Find calendars errors in the user's language, the server's own
  words after them.

Tests for each; locales and server texts in both languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
…s Relay's tools, and finish the second review's fixes

Website, in both languages (site/index.html, site/zh-TW/index.html, site/llms.txt)
- "Messages on a schedule": a goal to track, retries and a webhook.
- "One tool library": Harness Relay's own browser, mail and calendar, and the outbox.
- The safety list: mail and calendar passwords in the credential store.

Guided tour, in both languages (tour version 17, so people who finished it see it once more)
- "When the team needs you": a mail or an invitation waits in the outbox for Send or Discard.
- "Messages on a schedule": a goal to track, and a webhook.
- "Tool library": Harness Relay's own tools.

The browser's pop-ups
- Google Chrome sometimes lets a script's window make its first request before it is held (CI's
  Node 22 job saw it): the docs no longer say a pop-up loads nothing, but what holds: it is closed at
  once, and like every connection what it asks for goes through the proxy. Its test now aims the
  pop-ups at Harness Relay's stand-in port, which nothing reaches.

Tests
- The invitation card names its calendar, fails without one, and an id an agent gives is dropped.
- End to end: a mail discarded from the outbox (the card, the note, nothing sent).

Docs, in both languages
- User guide: where the tools keep their data (accounts, passwords, the outbox, the browser's
  profiles and screenshots); the CLI's own question answered for Harness Relay; Grok in full access only.
- Architecture: the CLI's question (`cliApproval()`), Grok's limit, mixed names and the question about
  a page here, the gateway's connections, screenshots and profiles in persistence.
- Sandboxing, the developer guide's test list, the e2e README; `find.ts`'s header (the system's
  browser comes first).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN

cyyeh commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

CI, and a second independent review · CI 與第二次獨立審查

CI (517e38f, 0f83b3e)

Check What failed Fix
Typecheck, test, build (Node 22, 24) test/protect.test.ts found the runner's ~/.config/google-chrome. Chromium on Linux keeps its crash reports under $XDG_CONFIG_HOME/<browser> whatever its profile, so Harness Relay's browser wrote into the user's own browser folder; and protectedReads() read XDG_CONFIG_HOME from the server even when given an environment The browser starts with its config and cache folders in its profile (launchEnv()); protectedReads() reads XDG_CONFIG_HOME from the environment it is given. A test with the real browser checks nothing is written in the home it is given; it failed on the old code
Typecheck, test, build (Windows) The browser finder built macOS paths with Windows separators Each system's paths are built as that system writes them
CodeQL (3 high) HTML mail to text could rebuild <script> from pieces (<scr<b>ipt>); two test pages echoed a request's text as HTML Tags are removed in one linear pass that never joins pieces of a tag, keeping a < that starts none (x < 5); the test pages escape what they echo, or answer as plain text
Node 22, pop-up test (once) With the runner's Google Chrome, a pop-up from window.open() sometimes made its first request before it was held (Chromium never did here) The docs no longer promise a pop-up loads nothing: it is closed at once, and like every connection, what it asks for goes through the proxy. The test aims the pop-ups at Harness Relay's stand-in port, which nothing reaches

Second independent review · 第二次獨立審查

A new agent reviewed the whole pull request: correctness, new problems, test coverage and docs, including the website and the guided tour. It did not write any of the code.

It confirmed several things are fine:

  • the reformat (382d9a5) is formatting only (Prettier run twice on a930940 gives the same tree);
  • the migrations are appended only;
  • the webhook route's checks hold;
  • the outbox's Send runs once;
  • the gateway's tokens hold, and the browser's proxy flags are as described;
  • the mail and calendar parsers hold on hostile input.

Every finding is fixed in b6b2e95 and 0f83b3e, with a test where it is code.

Finding Severity Fix
Each CLI asked about every relay MCP call before it reached the gateway. A scheduled run refused even a read, and Claude Code's card showed only {ref} and hid the gateway's own card (which names the element and shows the whole text). Codex was asked twice: its relay:<tool> name was not recognised High A CLI's own question about a tool named exactly as the gateway's (mcp__relay__<tool>, Codex's relay:<tool>…) is answered yes, with no card, also in a scheduled run or a conversation that refuses questions. The gateway then decides by tier: a read runs, an act is asked about with what it will do, a send waits in the outbox. The old "not asked twice within a minute" shortcut is gone
A reply to the user's own message in a tracking chat counted as progress: "how is CI?" answered done switched the schedule off Medium-low Only the runs a schedule starts are told the goal and report on it
Grok's sandbox denies data/tmp to the MCP servers it starts, so the gateway's program could not even load there below full access Low Grok gets the tools in full access only (GATEWAY_FULL_ACCESS_ONLY); Settings and the docs say so
The browser's profiles (data/browser/<conversation>, cookies under a fixed key) were readable by sandboxed agents Medium A protected path, made at startup
A name with both an internet and a local address got local access after one generic question (the connection falls back to the second address) Medium-low Such a name is never opened (mixed). The question about a page on this computer or the local network says its pages may then reach that host and port
Connections with a wrong token stayed open and counted toward the 256-connection cap, so 256 of them locked every agent out Low Such a connection gets one answer and ends (or ends after the token's 10 s); connections without a live token have a limit of their own
Unclosed <calendar-data> or <response> made the calendar parser quadratic Low One linear pass. The test's hostile answer took 75 s on the old code and now takes milliseconds
Screenshots were written readable by other users Low 0600, folder 0700
A branch lost the browser's screenshots its replies showed Low A branch copies them and points the copied text at its copies
Outbox results and the Test and Find calendars errors were English only Low In the request's language, with the server's own words after them
The invitation card did not say which calendar it went out from, and an accountId an agent gave was kept Low The card names the calendar (none, and nothing waits); Harness Relay always sets the id itself
Docs: the website, site/llms.txt and the guided tour said nothing of the new features; the user guide's data section, a few sentences (user-guide on the CLI's question, the Grok limit, find.ts's header) were wrong — See below

Docs · 文件

All in both languages:

  • Website (site/index.html, site/zh-TW/index.html, site/llms.txt):
    • "Messages on a schedule" gains goals, retries and the webhook;
    • "One tool library" gains Harness Relay's browser, mail, calendar and the outbox;
    • the safety list names mail and calendar passwords;
    • the site tests pass.
  • Guided tour (version 16 → 17, so people who finished it see it once more):
    • the outbox card in "When the team needs you";
    • goals and the webhook in "Messages on a schedule";
    • Harness Relay's tools in "Tool library".
  • User guide:
    • where the new features keep their data;
    • the CLI's own question answered for Harness Relay;
    • Grok's limit.
  • Architecture:
    • cliApproval() and the known limits;
    • mixed names;
    • the gateway's connections;
    • screenshots and profiles under persistence.
  • Also updated: sandboxing, the developer guide's test list and the e2e README.

Tests · 測試

  • npm run format:check, npm run typecheck, npm run desktop:typecheck and npm run build pass.
  • npm test: 3409 pass, 5 fail. The same 5 fail on main too: this container runs as root, and those tests rely on permission bits.
  • New tests for each fix:
    • the CLI's question in an asking and a refusing conversation;
    • Grok below and in full access;
    • a tracking chat's own message;
    • the browser profiles as protected paths;
    • mixed names, and the question's wording;
    • a stranger's gateway connection;
    • calendar parsing time;
    • screenshots carried into a branch;
    • errors in both languages;
    • the invitation card.
  • Checked against the old code: the browser-home, XDG_CONFIG_HOME, HTML tag, gateway connection and calendar timing tests fail without their fixes.
  • End to end:
    • a new step discards a mail from the outbox;
    • npm run test:e2e (Chromium, Linux): 415 pass, 39 skipped, 0 fail at 0f83b3e. On GitHub at 0f83b3e: CI passed (every job, Windows and the packaged app included) and CodeQL with no alert; End-to-end passed (every job: Linux on Node 22 and 24, macOS and Windows).

Still not tried · 仍未測試

  • Any real CLI.
    • Claude Code's and Codex's question names match what their adapters build from the real CLIs' messages.
    • An ACP CLI that names an MCP call without the server's name still asks itself; this is listed in Known limitations.
  • Any real mail or calendar provider.
  • The browser on macOS and Windows.
  • npm run desktop.

Generated by Claude Code

… and add schedules with no set times

Fixes what a third independent review of the pull request found, and adds a
kind of schedule that only Run once now and its webhook send.

Tracked goals
- A scheduled message that waited in the queue, the user's answer to a
  question a tracked run asked, and Retry and Continue of a tracked run are
  tracked too (`carriedTracking()`): they are told the goal, their
  `<progress>` block is read, and `done` switches the schedule off.
- Each reply keeps its run (`messages.tracked`, schema version 33), so Retry
  and Continue find it; a pause keeps it (`RunPause.tracked`).
- A retry the scheduler planned is skipped once a report came after the time
  that failed (the user's own Retry, say).
- `splitProgress()` reads only from the last `<progress`, so a long reply
  with many unclosed blocks is read in time in proportion to it.

Browser
- A call holds the browser (`hold()`/`release()`), so its idle timer never
  closes it while the user is asked about a host, nor while the gateway asks
  about a click or typing (`GatewayTool.asking`).

Mail and calendar
- Harness Relay's own IMAP, SMTP and CalDAV errors, and the outbox's, are in
  the request's language (`t().conn`), with the server's own words after them.

Windows
- The webhook's example is PowerShell's `Invoke-RestMethod` for a server on
  Windows (the hook's answer says the server's `platform`).
- In the desktop app on Windows without Node.js on the PATH, Settings says
  so (`no-node-path`), not that Settings → Sandboxes installs one.

Schedules with no set times
- A new kind, `manual` ("No set times" / "不定時"): no times, so only Run once
  now and the webhook send it. The form has no On and no missed times for it;
  it is saved on, and saving turns it on again after its reached goal
  switched it off. The five kinds go three over two where they do not fit
  one row (always in English).
- The sidebar's clock and the drawer's status say how it is sent.

Docs (both languages)
- User guide: no set times, and On for it; architecture: the `manual`
  repeat, which runs are tracked, the browser's idle hold.
- AGENTS.md, the developer guide and `gatewayShim.ts`: where the shim is
  written; sandboxing: `data/browser` and the gateway's files in `data/tmp`;
  open agents: they do not get Harness Relay's tools; the website, `llms.txt`
  and the READMEs: Grok gets them in full access only, and no set times.
- Guided tour (still version 17, not released): no set times in the schedule
  step; its fingerprint updated.
- Developer guide: the HTTP API (the hook's `platform`) and the test list;
  e2e README: the new end-to-end test and the changed ones.

Tests
- Tracking through the queue, an answer, Retry and Continue, and the skipped
  retry; the browser held past its idle time; the gateway's `asking` hook and
  `no-node-path`; the parser's time; connectors' errors in both languages;
  the schedule's PowerShell example and no set times; the store's schema 33
  and the no-set-times summary.
- End to end: below full access, the CLI's own question about Harness
  Relay's tool answered for the user, and the gateway's card about adding a
  calendar event (against a CalDAV stand-in); the webhook's test now uses a
  schedule with no set times; the phone layout of the five kinds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
… times first

- The five kinds stay on one row, which scrolls sideways where they do not
  fit (a phone, or English, which needs about 440px), as the CLI picker's
  row does (`.schedule-kinds` shares its rules); the chosen kind is scrolled
  into the row's view when it changes and when the form opens
  (`revealChosen()`, now shared from `CliPicker.tsx`). This replaces the
  three-over-two layout.
- No set times comes first (`SCHEDULE_KINDS`); a new schedule still starts
  as every week.
- The phone test checks one row, lets only that row scroll, and a saved kind
  at the row's end in view when the drawer opens again.
- Docs (both languages): the user guide lists no set times first and says
  the row swipes on a phone; the developer guide's test list and the e2e
  README describe the phone test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
- A new schedule's form (the New schedule page, and a chat's Schedule with
  none) starts with no set times: only Run once now and its webhook send
  it. Weekdays at 09:00 stay ready for when another kind is picked.
- The New schedule page's intro says a schedule is sent when you run it,
  when its webhook is called, or at set times (both languages).
- Docs (both languages): the user guide, architecture and the developer
  guide's test list say a new schedule starts with no set times.
- Tests: the new form's kind, and no day or time problems for no set times.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
- On Windows a gateway without Node.js says no-node-path (Settings installs
  none there), so the started gateway's test expects that there, and checks
  the macOS and Linux answer with a gateway set for Linux, which needs no
  server (CI's Windows job failed on it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
…k gets them

Below full access one sandbox holds both the commands these CLIs run and the MCP
servers they start, so the gateway's program could not read its token without
every command reading it too. In full access there is no such sandbox, and
nothing kept them from the tools but a rule of their own.

Gateway
- The open agents join Grok in `GATEWAY_FULL_ACCESS_ONLY`: a member of
  OpenCode, Goose, Cline, OpenHands or Pi gets the `relay` MCP server in full
  access, in the MCP servers its adapter passes its CLI, and none below it.

Settings
- Settings → Tool library offers each group to every CLI, and a member's
  Tools list the groups for open agents too; the hint says Grok and the open
  agents get them in full access only, and why (both languages).

Tests
- The orchestrator gives an open agent the gateway in full access only (fails
  with the open agents taken off the list).
- End to end: in full access, the fake OpenCode starts the gateway's program
  from its session's `mcpServers` and calls `mail_send`, which waits in the
  outbox. The fake OpenCode can now call a tool of an MCP server it was given.

Docs (both languages)
- README, the website and `llms.txt`, AGENTS.md, architecture (the gateway
  and Known limitations, with the loopback HTTP route that could lift it,
  #88), sandboxing, open agents, the user guide, the developer guide's test
  list and the e2e README (456 tests, the tool library's 18, each CLI at a
  glance).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
…k start

A schedule now starts with no set times, by Run once now or by a program's
webhook as much as by its times, so "schedule" named only one of the ways it
starts. The UI calls it an automation (自動任務 in Chinese: plain 任務 would
clash with the app's own "task assistant" tagline, where every chat is a task).
Only the words shown change: the API, the code, the data and the hash route
keep their names.

UI (both languages)
- New automation (the sidebar's calendar button, its page and Create
  automation), a chat's Automation button and drawer, Delete automation, the
  Automation tag on the messages it sends, the sidebar clock's tooltips, and
  every hint that named the schedule; the drawer's intro says what starts it.
- The guided tour's step is "Automations", and says what starts one (tour
  still version 17, not released; fingerprint updated).

Server messages (both languages)
- Errors and chat notes (missed, skipped and failed times, retries, the goal
  reached, the chat it opens, the webhook's refusals) say automation.
- Agents' prompts are unchanged.

Docs (both languages)
- User guide: "Automations" (anchor #automations, links updated) says what
  starts one; README, the website and llms.txt likewise.
- Architecture: the schedules section says the UI calls them automations and
  that only the words shown changed; the developer guide and the e2e README
  use the new UI names, the e2e area renamed.

Tests
- Unit and end-to-end tests use the new texts and names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
Removed again in the next commit: the description links them by this commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
…lightning bolt for automations

- The two buttons share the row equally, as New group and Search below them,
  each an icon and its text (14px, centred); a label too long for a wider
  font ends in an ellipsis rather than spilling out.
- New automation's icon is a lightning bolt (ZapIcon), the calendar with a
  plus is gone. In English its text is "Automation", as "New automation"
  does not fit half the row; its accessible name and tooltip stay "New
  automation" (newScheduleLabel, both languages).
- The guided tour's step and the user guide (both languages) name the
  lightning bolt; the tour's fingerprint updated (version 17, not released).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
Removed again in the next commit: the description links them by this commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
- A mail or an invitation waiting in the outbox marks its conversation
  Needs you, as an approval does, but its notification named nobody and
  nothing ("An agent is waiting for your approval"): alertDetail() looked
  for approval cards only. It now names the agent and what it would send, by
  the card's title ("Claude is waiting for your approval / Mail to
  bob@example.com: \"Shipped\""), for push and for the page alike.
- Test: the outbox card's notification detail, and none once it is sent.
- Docs (both languages): the user guide's outbox, architecture's
  notifications and the developer guide's test list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
- On Windows the drawer shows PowerShell's Invoke-RestMethod (cmd.exe takes
  no single quotes), as intended since the third review; the test still
  looked for curl, and the Windows end-to-end job failed on it.
- e2e README (both languages): the row says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
@cyyeh cyyeh changed the title Track goals across days, give every agent Harness Relay's own tools (browser, mail, calendar) through one MCP gateway, and keep what reaches other people in an outbox Track goals across days with automations, give every agent Harness Relay's own tools (browser, mail, calendar) through one MCP gateway, and keep what reaches other people in an outbox Nov 17, 2026

cyyeh commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

A third independent review, automations, and the open agents' tools · 第三次獨立審查、自動任務、開源 agent 的工具

Third independent review · 第三次獨立審查

A new agent reviewed the whole pull request at 0f83b3e: correctness, new problems, test coverage and docs, including the website and the guided tour. It did not write any of the code, and it ran its probes in a worktree of its own.

It confirmed several things are fine:

  • the reformat (382d9a5) is formatting only;
  • the outbox sends at most once;
  • the gateway's tokens, tiers and the CLI's question answered only for exact tool names;
  • the webhook route's checks;
  • the browser's proxy;
  • the mail and calendar parsers.

It found no new security problem. Every finding but the two departures below is fixed in 6fc3160, with a test where it is code.

Finding Severity Fix
A tracked goal followed only the runs the schedule started itself. A scheduled message that waited in the queue, the user's answer to a tracked run's question, and Retry and Continue were not told the goal; their <progress> block stayed in the text, and done did not switch the schedule off. A failed run the user retried was still retried by the scheduler Medium Those runs carry the tracked run on (carriedTracking()): the queued message keeps it (ChatMessage.tracked), a pause keeps it (RunPause.tracked), and each reply keeps its run (messages.tracked, schema version 33) for Retry and Continue, which do not retry by themselves. A planned retry is skipped once a report came after the time that failed
The browser's 10-minute idle timer could close it while a call waited for the user's answer about a host, or while the gateway asked about a click or typing Medium A call holds the browser (hold()/release()) for as long as it lasts, and so does the gateway's question about an act (GatewayTool.asking)
The <progress> parser took quadratic time on a long reply with many unclosed blocks Low It reads only from the last <progress: linear
Harness Relay's own IMAP, SMTP and CalDAV errors, and the outbox's, were English only Low In the request's language (t().conn), with the server's own words after them
Windows: the webhook's curl example fails in cmd.exe and Windows PowerShell 5.1; without Node.js, the desktop app pointed to Settings → Sandboxes, which installs nothing there Low The example is PowerShell's Invoke-RestMethod for a server on Windows; the hint says Node.js 22.12 or later must be on the PATH (no-node-path)
Docs: the architecture still said every run of a tracking chat is told the goal; the shim's location (AGENTS.md, developer guide, gatewayShim.ts); data/browser and the gateway's files missing from sandboxing; the open agents' doc; the website and README said every CLI but the open agents gets the tools (Grok only in full access) Low All corrected, in both languages

Two departures from the issues, not done in this pull request:

Either can follow in a pull request of its own.

Coverage gaps it named, and what was added:

  • tracking through the queue, an answer, Retry and Continue: new unit tests;
  • the browser's idle close and hold: a new unit test with the real browser;
  • the gateway end to end below full access: a new test (see below).

Not added:

  • a scheduled run calling a gateway tool end to end;
  • the browser end to end;
  • Windows' claimOnce with an MCP server restarted mid-turn.

After the review, as asked · 審查之後,依要求所做的改動

Automations · 自動任務

  • No set times (不定時): a kind with no times, sent only by Run once now and its webhook (6fc3160).
    • It has no On and no Missed times.
    • It is saved on, and saving turns it on again after its reached goal switched it off.
    • It comes first, and a new automation starts with it (913b5ff, bce2ef5).
    • The five kinds keep one row, which scrolls sideways where they do not fit (a phone), with the chosen one in view.
  • The UI calls schedules automations (自動任務) (3c54f67).
    • Plain 任務 would clash with the app's own "task assistant" tagline.
    • Only the words shown changed: the API, the code, the data and the hash route keep their names. The architecture doc says so.
    • Updated in both languages: the UI, the server's notes and errors, the tour, the user guide (#automations), the README, the website and llms.txt.
  • In the sidebar, New chat and New automation share the row (18e5cac).
    • New automation has a lightning bolt icon.
    • In English its text is "Automation", as "New automation" does not fit half the row; its accessible name and tooltip stay "New automation".

Harness Relay's tools · Harness Relay 的工具

  • The open agents get them in full access, as Grok does (4a6531c).
    • Below full access, one sandbox holds both their commands and the MCP servers they start, so the program's token could not be opened to the one without the other.
    • Checked end to end with OpenCode's fake, which now starts the gateway's program from its session's mcpServers.
  • Give Grok and the open agents Harness Relay's own tools below full access, over a loopback HTTP MCP endpoint #88 is about lifting that with a loopback HTTP endpoint whose token stays in the CLI's memory. It is planned in two steps:
    • first Grok, OpenCode, Goose and OpenHands;
    • then, once proven with the real CLIs, Copilot, Cursor, Antigravity, Muse Code and Codex, which would then need no Node.js;
    • Claude Code keeps the stdio program, and Cline and Pi stay full-access only.
  • A mail or invitation waiting in the outbox raised "An agent is waiting for your approval" without saying who or what (4b7b036). It now names the agent and what it would send, by its card's title.

CI on Windows · Windows 上的 CI

  • 895a5e6: the gateway's no-Node.js test expected Linux's answer on Windows (no-node-path there).
  • 995fc51: the webhook's end-to-end test expected curl where Windows shows PowerShell's Invoke-RestMethod.

Screenshots · 截圖

  • All retaken at a9bced7, in the description.
  • New ones: the New automation page, the gateway's act card, and the page on a phone.

Tests · 測試

  • npm run format:check, npm run typecheck, npm run desktop:typecheck and npm run build pass.
  • npm test: 3415 pass, 5 fail. The same 5 fail on main too: this container runs as root, and those tests rely on permission bits.
  • New tests:
    • tracking through the queue and an answer;
    • Retry and Continue, and the skipped retry;
    • the browser held past its idle time;
    • the gateway's asking hook, and no-node-path;
    • the parser's time;
    • connector errors in both languages;
    • the PowerShell example;
    • no set times (form, state, sidebar, saving it on again, the default);
    • schema 33;
    • an open agent gets the gateway in full access only (fails with the open agents taken off the list);
    • an outbox item's notification names the agent and what waits.
  • Checked against the old code: the two tracking tests fail without carriedTracking(), and the idle test fails with "The browser closed" without the hold.
  • End to end:
    • new: below full access, the CLI's own question about Harness Relay's tool is answered with no card, and the gateway's own card about adding a calendar event (against a CalDAV stand-in) says what it will do;
    • new: in full access, OpenCode's fake reaches the gateway, and its mail waits in the outbox;
    • the webhook's test now uses an automation with no set times, and expects PowerShell's example on Windows;
    • the phone layout checks that the five kinds keep one row, the chosen one in view.
    • npm run test:e2e (Chromium, Linux): 416 pass, 39 skipped, 0 fail at 6fc3160; after it, the specs each commit touched (456 tests now).
  • On GitHub at 995fc51: CI passed (Node 22 and 24, Windows, the packaged app on Linux and Windows), End-to-end passed (Linux on Node 22 and 24, macOS and Windows), and CodeQL.

Still not tried · 仍未測試

  • Any real CLI.
  • Any real mail or calendar provider.
  • The browser on macOS and Windows.
  • npm run desktop.

Generated by Claude Code

- A conversation whose latest agent reply says its tracked goal is blocked
  (<progress status="blocked">) needs the user: ConversationSummary.blocked,
  from the reply's progress part in memory and in the database, until a
  later reply (to the user's answer, or the next run) says otherwise.
- It is an alert of its own (blocked, a needs kind: push and the page, the
  needs chime), naming the agent and what holds the goal up; a question
  asked as well comes first. The sidebar says "Goal held up" (目標卡住了),
  between a question and a reply in progress, and the tab's title counts it.
- Before, a blocked report only left a note: the user was told only when
  the agent also asked.
- Tests: the alert, its detail and its order; the sidebar's status; the
  summary from memory and after a restart; end to end, a run that reports
  blocked marks the chat until the user's answer is replied to.
- Docs (both languages): the user guide (the tracked goal, the sidebar's
  badges), architecture (tracking, notifications), the developer guide's
  test list and the e2e README (457 tests).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN
- Settings → Tool library, under Browser: "Browser to start", the full path
  of a Chromium, Chrome or Edge executable, checked to be a file when saved
  (400 with the path otherwise); empty finds one by itself again. It comes
  before RELAY_BROWSER, which comes before the system's browsers and
  Playwright's Chromium. The box says which browser is in use, or that none
  was found; chats that start after a change use it.
- The tool library keeps it (browser), and its view says it beside
  RELAY_BROWSER's and the one in use (ToolLibraryView.browser); PUT
  /api/tools takes browser.
- Tests: the library keeps, shows and forgets it (it was not saved at
  first, which the test caught); the HTTP API refuses a path with no file;
  end to end, the field refuses, saves, shows in use and clears.
- Docs (both languages): the user guide's browser, architecture, the
  developer guide (RELAY_BROWSER, the HTTP API, the test list) and the e2e
  README (458 tests).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJpwTRd9eKs9LUrp6QZraN

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment