Skip to content

CONTRACT: feat(ui-server, ui-sdk): a host GitHub API relay for module cron jobs (#4259) - #4265

Merged
schlessera merged 23 commits into
mainfrom
feat/4259-module-github-relay
Nov 20, 2026
Merged

schlessera merged 23 commits into
mainfrom
feat/4259-module-github-relay

Conversation

@schlessera

@schlessera schlessera commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Closes #4259

What changes

A module cron job granted a github.com repository now reaches its GitHub API through a host relay. Granted means listed in the module's repositories and in BRAIN_UI_MODULE_REPOSITORIES, the same grant as the #3380 read mirror. The job's worker never holds a token.

  • Relay (packages/ui-server/src/github/module-relay.ts): a per-run Unix socket in a private server-owned directory.
    • It forwards to https://api.github.com with BRAIN_UI_MODULE_GITHUB_TOKEN and no fallback, and never follows a redirect.
    • Reads: REST GET /repos/<owner>/<repo>/… for a granted repository, and GraphQL queries whose only root field is repository(owner:, name:) on a granted repository. Mutations, other roots, aliases, spreads and second operations are refused. Only a strict subset is relayed: no comments, block strings, escapes or carriage returns, so the relay and GitHub's parser cannot disagree on token boundaries. operationName must name the one query. Below the root, fields that select another repository, owner or account by name (owner, repositories, forks, parent, headRepository, search, viewer and the like) are refused. Deeper traversal (an author's other issues, a cross-referencing issue) is bounded by the token's own scope, as the REST timeline is. By the maintainer's 2026-11-20 ruling, the token's scope is the read boundary there, and the docs require the one shared token to be limited to the union of module grants.
    • Writes: issue_comment and issue_state, each only where BRAIN_UI_MODULE_GITHUB_WRITES enables it for that repository (https://github.com/<owner>/<repo>#<operation>). Bodies are strictly shaped.
    • Bounds: request bodies up to 1 MiB and responses up to 16 MiB, both enforced while streaming, so a larger body is never held; 500 calls per run and 8 in flight (beyond that, relay_busy before anything is read). A write is recorded as soon as GitHub answers, even if its response is then refused.
    • Every refusal comes back before any request leaves the host, with { message, brain_relay_refusal } naming the setting.
  • Launcher (ui-sdk): the maintenance envelope gains githubRelay. The directory is bound read-only at /run/brain-github after the same private-directory and socket-ownership checks the provider relay uses, and BRAIN_MODULE_GITHUB_SOCKET is set. It holds no credential, so a credential-free worker may get it.
  • Cron runner: starts the relay only for a job with granted GitHub repositories, passes its directory to the launch, records each forwarded write as a github_write event on the job's Activity root span and a line in the run's output, and stops the relay when the run ends, after letting calls in flight finish for up to 10 s so their writes are recorded.
  • Secrets: BRAIN_UI_MODULE_GITHUB_TOKEN joins HOST_ONLY_SECRET_ENV, so no escape hatch or spawn can admit it, and HOST_GIT_CREDENTIAL_ENV, so it is stripped from every worker.
  • /etc/environment: every host-view worker, agent and maintenance alike, now covers it. A container writes the cron runner's environment there for pam_env, and before this PR that already exposed GITHUB_TOKEN and the sync token to workers; this PR's token would have joined them.
  • Invalid write entries in BRAIN_UI_MODULE_GITHUB_WRITES are named in the run's output, never dropped silently.
  • Config: BRAIN_UI_MODULE_GITHUB_TOKEN and BRAIN_UI_MODULE_GITHUB_WRITES are declared, read by the cron runner only (cron control env), and never forwarded to a job.
  • Docs: docs/modules.md, the hosting worker reference, the contract index and the package API component (#module-github-relay), the decision record, and the env table.

Deviation from the issue's wording: the ruling said "a per-run loopback endpoint and a per-run bearer". A maintenance worker has its own network namespace with no route to the host's loopback, so the relay is a per-run Unix socket in a private directory bound only into that run's worker, like the provider relay (#1673). Access is that socket's reach, so no separate bearer is needed. The issue is updated to match.

Contract: additive. The relay protocol, the worker socket variable and the two host settings are recorded in docs/integration-contract/package-api.md#module-github-relay and the index, and the commit is prefixed CONTRACT:. Changesets: ui-server minor, ui-sdk minor.

Guard checklist (proportionate containment)

  • What triggers it, and what it does not cover:
    • The relay refuses one call at a time: a repository outside the job's grant, a non-relayed method or path, a GraphQL query outside the strict subset or reaching another repository by name, a write the operator has not enabled, a malformed body, the call budget or in-flight bound, or a missing token.
    • The launcher refuses a relay directory or socket that is not the server's private one.
    • /etc/environment is covered in every host-view worker.
    • Not covered: reads below the granted root that the token's own scope bounds (the maintainer's ruling), and jobs on a host without the worker boundary (the host fallback).
  • What it restricts, and why nothing narrower: a refusal stops one relayed call and answers it with a named code. The job keeps running and can make other calls. A launch refusal concerns one run's private IPC, whose ownership is the only authority the launcher has. The /etc/environment cover hides one file that no worker reads.
  • Restricted mode considered: the relay is itself the restricted mode: read-only by default, with writes only where the operator enables them. Without the token it still runs and refuses each call by name, rather than failing the job.
  • How it clears: automatically on the next call or run. The operator clears it by setting BRAIN_UI_MODULE_GITHUB_TOKEN, BRAIN_UI_MODULE_REPOSITORIES or BRAIN_UI_MODULE_GITHUB_WRITES. Only the operator can widen a grant, by design.
  • Where the cause is recorded:
    • Every refusal's message names its setting and reaches the job.
    • Invalid write entries and every forwarded write are lines in the run's output.
    • Writes are also github_write events on the job's Activity run, recorded even when the answer is lost or the relay stops first.
  • Cross-scope test: module-github-relay.test.ts shows that a refused call leaves the relay serving the next one (BOUND_FREES_AFTER_FINISH, and the granted reads after foreign refusals). cron-module-github-relay.test.ts shows that a job without a GitHub grant runs normally with no relay.

Validation

  • tests/module-github-relay.test.ts (9 tests, loopback GitHub stand-in): granted reads forwarded with the host token only; foreign repository and other paths refused with nothing forwarded; GraphQL query forwarded while mutation, other root, alias, second root, foreign variables and an extra mutation operation are refused; no token refuses and names the setting, with no fallback from GITHUB_TOKEN, the sync token or the tools token; redirect refused; call budget; un-enabled write refused naming the setting; enabled writes forwarded and recorded; malformed write bodies refused; operator-list parsing.
  • tests/cron-module-github-relay.test.ts: through runJob, a job granted a GitHub repository reaches the relay and its write lands on the Activity run, the token is not in the job's environment, and the relay directory is gone after the run. A job without a GitHub grant gets no relay.
  • tests/maintenance-module-github-relay.test.ts (native): a real maintenance worker, launched with the cron runner's own module-job class (cronJobClass, credentialed), sees /run/brain-github/github.sock and reaches the stand-in through it with the host token. Its environment, /proc/self/environ, cmdline and /etc/environment hold no relay token, even when the launch env carried one. This host lacks user namespaces, so hosted CI proves it.
  • Mutations, each restored afterwards; each failed its named assertion:
    • No grant check fails FOREIGN_REPOSITORY_REFUSED.
    • No GraphQL root check fails GRAPHQL_REFUSED: mutation ….
    • No write allow-list fails the write-not-enabled case.
    • No token check fails the no-token case.
    • Not passing the directory to the launch fails the runner case.
    • Never stopping the relay fails RELAY_ENDS_WITH_RUN.
    • Not recording a write that is still unanswered at stop fails UNANSWERED_WRITE_RECORDED_AT_STOP.
    • A stopping relay that takes new calls fails the stop test.
    • No empty-segment guard fails DOUBLE_SLASH_REFUSED.
    • No strict GraphQL subset fails the reproduced escape and comment bypasses (GRAPHQL_REFUSED, COMMENT_REFUSED).
    • No operationName check fails OPERATION_NAME_MISMATCH_REFUSED.
    • A token that is not host-only fails MODULE_GITHUB_TOKEN_EXTRA_REFUSED.
    • A token that is not stripped fails SDK_MAINTENANCE_MODULE_GITHUB_TOKEN_ABSENT.
    • Recording a write only after its body fails ANSWERED_WRITE_RECORDED.
    • Unbounded reads fail OVERSIZED_RESPONSE_REFUSED and CHUNKED_REQUEST_BOUNDED.
    • No nested-traversal check fails GRAPHQL_REFUSED: … owner { repository(name: "barracks") … }.
    • Not covering /etc/environment in agent or maintenance workers fails ETC_ENVIRONMENT_COVERED. The native test also reads the file inside a real worker.
  • bun run typecheck passes.

Collisions

bun scripts/collisions.ts --json --pr 4265 at head 7f974c427: closure-only overlaps with #3054, #3056, #3059, #3069, #3581, #4151, #4270, #4273, #4312, #4314. No path collisions.

Refreshed by a clean merge of origin/main, which includes #4266. The check:pr receipt below is from the last real change, 6086ef669, and the recorded review covers that head plus this clean merge.

{"version":1,"kind":"brain-check-pr-receipt","head":"6086ef6698805a91c4426955fb589bdafb7958ac","base":"origin/main","mode":"focused","startedAt":"2026-11-20T19:03:06.477Z","finishedAt":"2026-11-20T19:04:23.695Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":14045.248717999999},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":108.1235749999978},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":74.51328300000023},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":21.31738100000075},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":62951.393093000006}]}

🤖 Generated with Claude Code

schlessera and others added 3 commits November 20, 2026 14:31
… cron jobs (#4259)

A module job granted a github.com repository reaches its API through a
per-run Unix-socket relay bound read-only into its worker. The relay adds
BRAIN_UI_MODULE_GITHUB_TOKEN (no fallback), relays granted REST reads and
repository GraphQL queries, and writes only what BRAIN_UI_MODULE_GITHUB_WRITES
enables per repository; each write is a github_write Activity event.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ub relay (#4259)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@schlessera schlessera added this to the 0.45.0 milestone Nov 20, 2026
@schlessera schlessera added type: feat A new capability or a change in user-visible behaviour. area: modules First-party content modules and the module seam. area: ui-server Hono app factory: turn coordinator, auth, session catalog, routes, cron. contract Touches the integration contract: CONTRACT: commit, contract doc updated in the same commit. labels Nov 20, 2026

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 0527e27 against base 65883f2. Reviewer: agent. 5 findings: 0 fixed, 0 filed, 0 rejected, 5 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "0527e2707f67852c4966d67f774aff38cafdfcb7",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-server/src/github/module-relay.ts:96 blanks GraphQL comments with #[^\\n]*, but GraphQL also ends a comment at \\r. 'query Q { repository(owner:\"ithaca\",name:\"watchtower\") { id } } # x\\r mutation M { closeIssue(...) }' sent with operationName M (accepted unchecked at :193) passes graphqlQueryRepository (reproduced), and GitHub runs the mutation. The same trick adds a second root on an ungranted repository."
    },
    {
      "summary": "packages/ui-server/src/github/module-relay.ts:96 ends a block string at the first triple quote even when it is backslash-escaped, which GraphQL keeps inside the string. A granted repository query with label(name: &lt;block string holding an escaped triple quote&gt;) and trailing text returns ithaca/watchtower (reproduced). GitHub parses that trailing text as a second root, repository(owner:\"sparta\",name:\"barracks\"), outside the grant."
    },
    {
      "summary": "packages/ui-sdk/src/server/subprocess-env.ts:35 and :247 list BRAIN_UI_MODULE_GITHUB_TOKEN in neither HOST_ONLY_SECRET_ENV nor HOST_GIT_CREDENTIAL_ENV, unlike BRAIN_UI_GITHUB_TOOLS_TOKEN. Naming it in BRAIN_UI_SUBPROCESS_ENV_EXTRA admits it to cron childEnv, agent turns and workers, and no launcher strip removes it. The scope requires it stripped from every worker."
    },
    {
      "summary": "packages/ui-server/tests/maintenance-module-github-relay.test.ts:54 and cron-module-github-relay.test.ts:56 cannot fail: no input env (childEnv {PATH} at :47, the launch env) ever holds BRAIN_UI_MODULE_GITHUB_TOKEN, so no stripping path runs, and removing the env.ts and emit.ts exclusions stays green. Nothing checks the worker's files or process arguments, which the criterion requires."
    },
    {
      "summary": "packages/ui-server/src/github/module-relay.ts:216 refuses an operation outside the set (DELETE, a write with a query string, another issue path) as not_relayed without naming a setting, and graphql_not_allowed at :196 names none either. The criterion wants every out-of-grant refusal to name the setting, and DELETE_REFUSED in module-github-relay.test.ts:54 checks only the status."
    }
  ]
}

…y token host-only, name settings in refusals (#4259)

The relay now relays only a strict GraphQL subset (no comments, block strings,
escapes or carriage returns) and checks operationName against the one query.
BRAIN_UI_MODULE_GITHUB_TOKEN joins the host-only secrets and the stripped
host credentials. Every out-of-grant refusal names its setting. Tests now put
the token in the inputs and check the worker's environ and cmdline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 0527e27 against base 65883f2. Reviewer: agent. 5 findings: 5 fixed, 0 filed, 0 rejected, 0 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "0527e2707f67852c4966d67f774aff38cafdfcb7",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-server/src/github/module-relay.ts:96 blanks GraphQL comments with #[^\\n]*, but GraphQL also ends a comment at \\r. 'query Q { repository(owner:\"ithaca\",name:\"watchtower\") { id } } # x\\r mutation M { closeIssue(...) }' sent with operationName M (accepted unchecked at :193) passes graphqlQueryRepository (reproduced), and GitHub runs the mutation. The same trick adds a second root on an ungranted repository.",
      "disposition": "fixed",
      "commit": "b718919a31231eae83fa8bed7e439b89ef7116d5"
    },
    {
      "summary": "packages/ui-server/src/github/module-relay.ts:96 ends a block string at the first triple quote even when it is backslash-escaped, which GraphQL keeps inside the string. A granted repository query with label(name: &lt;block string holding an escaped triple quote&gt;) and trailing text returns ithaca/watchtower (reproduced). GitHub parses that trailing text as a second root, repository(owner:\"sparta\",name:\"barracks\"), outside the grant.",
      "disposition": "fixed",
      "commit": "b718919a31231eae83fa8bed7e439b89ef7116d5"
    },
    {
      "summary": "packages/ui-sdk/src/server/subprocess-env.ts:35 and :247 list BRAIN_UI_MODULE_GITHUB_TOKEN in neither HOST_ONLY_SECRET_ENV nor HOST_GIT_CREDENTIAL_ENV, unlike BRAIN_UI_GITHUB_TOOLS_TOKEN. Naming it in BRAIN_UI_SUBPROCESS_ENV_EXTRA admits it to cron childEnv, agent turns and workers, and no launcher strip removes it. The scope requires it stripped from every worker.",
      "disposition": "fixed",
      "commit": "b718919a31231eae83fa8bed7e439b89ef7116d5"
    },
    {
      "summary": "packages/ui-server/tests/maintenance-module-github-relay.test.ts:54 and cron-module-github-relay.test.ts:56 cannot fail: no input env (childEnv {PATH} at :47, the launch env) ever holds BRAIN_UI_MODULE_GITHUB_TOKEN, so no stripping path runs, and removing the env.ts and emit.ts exclusions stays green. Nothing checks the worker's files or process arguments, which the criterion requires.",
      "disposition": "fixed",
      "commit": "b718919a31231eae83fa8bed7e439b89ef7116d5"
    },
    {
      "summary": "packages/ui-server/src/github/module-relay.ts:216 refuses an operation outside the set (DELETE, a write with a query string, another issue path) as not_relayed without naming a setting, and graphql_not_allowed at :196 names none either. The criterion wants every out-of-grant refusal to name the setting, and DELETE_REFUSED in module-github-relay.test.ts:54 checks only the status.",
      "disposition": "fixed",
      "commit": "b718919a31231eae83fa8bed7e439b89ef7116d5"
    }
  ]
}

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head b718919 against base 65883f2. Reviewer: agent. 2 findings: 0 fixed, 0 filed, 0 rejected, 2 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "b718919a31231eae83fa8bed7e439b89ef7116d5",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-server/src/github/module-relay.ts:234 buffers the whole upstream body with arrayBuffer() before comparing it to MAX_MODULE_GITHUB_RESPONSE_BYTES, and :155 does the same for a chunked request with no content-length. A granted GET of a large blob (e.g. /repos/ithaca/watchtower/git/blobs/<sha>) or a large chunked body is held in full in the cron runner's memory, so the bounds the issue requires limit only what is relayed, not what the host reads."
    },
    {
      "summary": "packages/ui-server/src/github/module-relay.ts:236 records a write only after the response body was read and passed the size check. When GitHub has already performed the POST/PATCH but reading its body fails or exceeds the cap (:234-235), the handler throws (502 upstream_unreachable or response_too_large) and no github_write event reaches the Activity run, although the issue requires each write to be recorded."
    }
  ]
}

… once GitHub answers (#4259)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head b718919 against base 65883f2. Reviewer: agent. 2 findings: 2 fixed, 0 filed, 0 rejected, 0 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "b718919a31231eae83fa8bed7e439b89ef7116d5",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-server/src/github/module-relay.ts:234 buffers the whole upstream body with arrayBuffer() before comparing it to MAX_MODULE_GITHUB_RESPONSE_BYTES, and :155 does the same for a chunked request with no content-length. A granted GET of a large blob (e.g. /repos/ithaca/watchtower/git/blobs/<sha>) or a large chunked body is held in full in the cron runner's memory, so the bounds the issue requires limit only what is relayed, not what the host reads.",
      "disposition": "fixed",
      "commit": "4d058d61d61107d44e6a9512a9558223e8042fc5"
    },
    {
      "summary": "packages/ui-server/src/github/module-relay.ts:236 records a write only after the response body was read and passed the size check. When GitHub has already performed the POST/PATCH but reading its body fails or exceeds the cap (:234-235), the handler throws (502 upstream_unreachable or response_too_large) and no github_write event reaches the Activity run, although the issue requires each write to be recorded.",
      "disposition": "fixed",
      "commit": "4d058d61d61107d44e6a9512a9558223e8042fc5"
    }
  ]
}

…over /etc/environment in every worker (#4259)

Below the granted repository root, fields that reach another repository,
owner or account are refused. A container's /etc/environment carries the
cron runner's credentials for pam_env; every host-view worker now covers it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 4d058d6 against base 65883f2. Reviewer: agent. 2 findings: 0 fixed, 0 filed, 0 rejected, 2 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "4d058d61d61107d44e6a9512a9558223e8042fc5",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-server/src/github/module-relay.ts:132 checks only the GraphQL root field. A query rooted at a granted repository can nest owner { repository(name: \"barracks\") { issues { nodes { title } } } } (or owner.repositories, forks, parent) and read a repository outside the grant with the shared host token. The ruling limits reads to the granted repositories, so a job reads repositories granted only to another module. No test covers nested reach."
    },
    {
      "summary": "packages/ui-server/src/cron/emit.ts:323 adds BRAIN_UI_MODULE_GITHUB_TOKEN to CRON_CONTROL_ENV_NAMES, so brain-ui-cron environment writes it into /etc/environment. A maintenance worker ro-binds / (ui-sdk worker-launcher.ts:668) and never masks /etc/environment, so a credential-free module job can read the token from a file, which the criterion forbids. maintenance-module-github-relay.test.ts never reads /etc/environment."
    }
  ]
}

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 4d058d6 against base 65883f2. Reviewer: agent. 2 findings: 2 fixed, 0 filed, 0 rejected, 0 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "4d058d61d61107d44e6a9512a9558223e8042fc5",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-server/src/github/module-relay.ts:132 checks only the GraphQL root field. A query rooted at a granted repository can nest owner { repository(name: \"barracks\") { issues { nodes { title } } } } (or owner.repositories, forks, parent) and read a repository outside the grant with the shared host token. The ruling limits reads to the granted repositories, so a job reads repositories granted only to another module. No test covers nested reach.",
      "disposition": "fixed",
      "commit": "7b8eccffd206e6661f8e1ad8bd48c5ede9bc5ff6"
    },
    {
      "summary": "packages/ui-server/src/cron/emit.ts:323 adds BRAIN_UI_MODULE_GITHUB_TOKEN to CRON_CONTROL_ENV_NAMES, so brain-ui-cron environment writes it into /etc/environment. A maintenance worker ro-binds / (ui-sdk worker-launcher.ts:668) and never masks /etc/environment, so a credential-free module job can read the token from a file, which the criterion forbids. maintenance-module-github-relay.test.ts never reads /etc/environment.",
      "disposition": "fixed",
      "commit": "7b8eccffd206e6661f8e1ad8bd48c5ede9bc5ff6"
    }
  ]
}

…readable covered file

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 4922acc against base 65883f2. Reviewer: agent. 1 finding: 0 fixed, 0 filed, 0 rejected, 1 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "4922accd5517c55e34611c773884d8a2b7852b65",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-server/src/github/module-relay.ts:135/:159 blocks cross-repository traversal by field name, but the list misses author { ... on User { issues / pullRequests / gists / organizations } }, pullRequests { nodes { headRepository } } and CrossReferencedEvent source { ... on Issue { body } }. graphqlQueryRepository accepts each as ithaca/watchtower (reproduced), so a job reads other repositories' issues through the relay, contrary to docs/decisions/governed-writable-workers.md."
    }
  ]
}

…e more repository-selecting fields (#4259)

The field denylist refuses fields that select another repository, owner or
account by name; deeper traversal is bounded by the token's scope, which the
docs now require the operator to limit to the granted repositories.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 4922acc against base 65883f2. Reviewer: agent. 1 finding: 1 fixed, 0 filed, 0 rejected, 0 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "4922accd5517c55e34611c773884d8a2b7852b65",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-server/src/github/module-relay.ts:135/:159 blocks cross-repository traversal by field name, but the list misses author { ... on User { issues / pullRequests / gists / organizations } }, pullRequests { nodes { headRepository } } and CrossReferencedEvent source { ... on Issue { body } }. graphqlQueryRepository accepts each as ithaca/watchtower (reproduced), so a job reads other repositories' issues through the relay, contrary to docs/decisions/governed-writable-workers.md.",
      "disposition": "fixed",
      "commit": "000c1811bd10da9ed890f81c79f9c322b41fb010"
    }
  ]
}

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 000c181 against base 65883f2. Reviewer: agent. 2 findings: 0 fixed, 0 filed, 0 rejected, 2 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "000c1811bd10da9ed890f81c79f9c322b41fb010",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-server/src/github/module-relay.ts:135 and :160 forward a query rooted at a granted repository that reaches other repositories: issues{nodes{author{... on User{issues(first:50){nodes{title body}}}}}} and a CrossReferencedEvent source{... on Issue{body}} both return ithaca/watchtower. The fix is a token limited to granted repositories (env.ts:211), but one host token covers all modules, so job A reads repositories granted only to module B."
    },
    {
      "summary": "packages/ui-server/src/github/module-relay.ts:160 puts \"node\" and \"topic\" in CROSS_REPOSITORY_FIELDS, so a granted query in the standard connection form, repository(owner:\"ithaca\",name:\"watchtower\"){issues(first:5){edges{node{number}}}}, returns null and is refused as graphql_not_allowed. Neither field selects another repository or owner by name, so the relay refuses in-grant reads that docs/modules.md says are allowed."
    }
  ]
}

… token-scope ruling (#4259)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 000c181 against base 65883f2. Reviewer: agent. 2 findings: 1 fixed, 0 filed, 1 rejected, 0 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "000c1811bd10da9ed890f81c79f9c322b41fb010",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-server/src/github/module-relay.ts:135 and :160 forward a query rooted at a granted repository that reaches other repositories: issues{nodes{author{... on User{issues(first:50){nodes{title body}}}}}} and a CrossReferencedEvent source{... on Issue{body}} both return ithaca/watchtower. The fix is a token limited to granted repositories (env.ts:211), but one host token covers all modules, so job A reads repositories granted only to module B.",
      "disposition": "rejected",
      "reason": "Maintainer ruling 2026-11-20 on #4259: below the granted root the shared token's scope is the read boundary; docs now require the token limited to the union of module grants."
    },
    {
      "summary": "packages/ui-server/src/github/module-relay.ts:160 puts \"node\" and \"topic\" in CROSS_REPOSITORY_FIELDS, so a granted query in the standard connection form, repository(owner:\"ithaca\",name:\"watchtower\"){issues(first:5){edges{node{number}}}}, returns null and is refused as graphql_not_allowed. Neither field selects another repository or owner by name, so the relay refuses in-grant reads that docs/modules.md says are allowed.",
      "disposition": "fixed",
      "commit": "8b4771e7a8aae825d98dec242fc967995130cdee"
    }
  ]
}

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 6b3296c against base 65883f2. Reviewer: agent. 1 finding: 0 fixed, 0 filed, 0 rejected, 1 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "6b3296cf5579cc92b1be13b824213406759e7dae",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-server/src/cron/run-job.ts:336 records a relayed write only through recorder?.event, and the event at :221 swallows a failed append. With tracking unavailable (:277-281, or startRecord returning null) or a failed append, the relay still sends the POST/PATCH to GitHub and the write is recorded nowhere, not even in stderr. #4259 requires each write on the job's Activity run, and the fail-closed rule requires the cause recorded durably where the owner can see it."
    }
  ]
}

… relayed write in the run output (review of #4256/#4259)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 6b3296c against base 65883f2. Reviewer: agent. 1 finding: 1 fixed, 0 filed, 0 rejected, 0 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "6b3296cf5579cc92b1be13b824213406759e7dae",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-server/src/cron/run-job.ts:336 records a relayed write only through recorder?.event, and the event at :221 swallows a failed append. With tracking unavailable (:277-281, or startRecord returning null) or a failed append, the relay still sends the POST/PATCH to GitHub and the write is recorded nowhere, not even in stderr. #4259 requires each write on the job's Activity run, and the fail-closed rule requires the cause recorded durably where the owner can see it.",
      "disposition": "fixed",
      "commit": "55326618f5c7658d993c1f56f2e2666bd93215dc"
    }
  ]
}

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 5532661 against base 65883f2. Reviewer: agent. 2 findings: 0 fixed, 0 filed, 0 rejected, 2 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "55326618f5c7658d993c1f56f2e2666bd93215dc",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-server/src/github/module-relay.ts:282-284 (also :274 and :265) refuses a write field outside the fixed set, e.g. PATCH /repos/ithaca/watchtower/issues/7 {state:\"open\",title:\"Renamed\"}, as 400 invalid_body with a message that names no setting. #4259 counts any other field as outside the grant and requires every out-of-grant refusal to name the setting; STATE_EXTRA_FIELD_REFUSED and COMMENT_EXTRA_FIELD_REFUSED (module-github-relay.test.ts:163-164) check only the status."
    },
    {
      "summary": "packages/ui-server/src/cron/run-job.ts:414 stops the relay with server.stop(true) (module-relay.ts:337) as soon as the worker exits, without waiting for calls in flight. If a job exits or is killed while its POST comment is with GitHub, the handler is still awaiting fetch when brain-ui-cron.ts calls process.exit, so observe (module-relay.ts:301/305) never runs. The write GitHub performed reaches neither a github_write event nor stderr, though #4259 requires each write to be recorded."
    }
  ]
}

…e edit-path test; relay settles in-flight writes and names settings (review of #4256/#4259)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 5532661 against base 65883f2. Reviewer: agent. 2 findings: 2 fixed, 0 filed, 0 rejected, 0 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "55326618f5c7658d993c1f56f2e2666bd93215dc",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-server/src/github/module-relay.ts:282-284 (also :274 and :265) refuses a write field outside the fixed set, e.g. PATCH /repos/ithaca/watchtower/issues/7 {state:\"open\",title:\"Renamed\"}, as 400 invalid_body with a message that names no setting. #4259 counts any other field as outside the grant and requires every out-of-grant refusal to name the setting; STATE_EXTRA_FIELD_REFUSED and COMMENT_EXTRA_FIELD_REFUSED (module-github-relay.test.ts:163-164) check only the status.",
      "disposition": "fixed",
      "commit": "3886c6d4b6b6d72a0c4f980e671cd247c1eab404"
    },
    {
      "summary": "packages/ui-server/src/cron/run-job.ts:414 stops the relay with server.stop(true) (module-relay.ts:337) as soon as the worker exits, without waiting for calls in flight. If a job exits or is killed while its POST comment is with GitHub, the handler is still awaiting fetch when brain-ui-cron.ts calls process.exit, so observe (module-relay.ts:301/305) never runs. The write GitHub performed reaches neither a github_write event nor stderr, though #4259 requires each write to be recorded.",
      "disposition": "fixed",
      "commit": "3886c6d4b6b6d72a0c4f980e671cd247c1eab404"
    }
  ]
}

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 3886c6d against base 65883f2. Reviewer: agent. 1 finding: 0 fixed, 0 filed, 0 rejected, 1 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "3886c6d4b6b6d72a0c4f980e671cd247c1eab404",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-server/tests/module-github-relay.test.ts:73 cannot fail: fetch normalizes /repos/ithaca/watchtower/../../sparta/barracks to /repos/sparta/barracks before sending, so it is refused as repository_not_granted. The dot-segment guard it claims to cover (module-relay.ts:258) cannot be reached either, since new URL(request.url) at :255 already removed the segments. Deleting that guard leaves the test green, and the assertion is only not.toBe(200)."
    }
  ]
}

…efuses empty segments (#4259)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 3886c6d against base 65883f2. Reviewer: agent. 1 finding: 1 fixed, 0 filed, 0 rejected, 0 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "3886c6d4b6b6d72a0c4f980e671cd247c1eab404",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-server/tests/module-github-relay.test.ts:73 cannot fail: fetch normalizes /repos/ithaca/watchtower/../../sparta/barracks to /repos/sparta/barracks before sending, so it is refused as repository_not_granted. The dot-segment guard it claims to cover (module-relay.ts:258) cannot be reached either, since new URL(request.url) at :255 already removed the segments. Deleting that guard leaves the test green, and the assertion is only not.toBe(200).",
      "disposition": "fixed",
      "commit": "c3b47ec872e96a26cee4136665ee209de27f70d2"
    }
  ]
}

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head c3b47ec against base 65883f2. Reviewer: agent. 2 findings: 0 fixed, 0 filed, 0 rejected, 2 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "c3b47ec872e96a26cee4136665ee209de27f70d2",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "docs/integration-contract/package-api.md:1045 records the relay's 503 refusals as `unavailable` (no token) and `relay_busy` only. 3886c6d4b added a third, 503 `relay_stopped` for a call arriving after the run ended (packages/ui-server/src/github/module-relay.ts:324), and it ships without its contract record, the same gap the cfc2226 review found and fixed for relay_busy."
    },
    {
      "summary": "packages/ui-server/tests/module-github-relay.test.ts:201 is titled 'stopping lets a write in flight finish and be recorded, and takes no new call' but never sends a call after stop(), so deleting the stopping guard at packages/ui-server/src/github/module-relay.ts:324 (relay_stopped) leaves every test green. No test proves that a call arriving while the relay settles is refused."
    }
  ]
}

)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head c3b47ec against base 65883f2. Reviewer: agent. 2 findings: 2 fixed, 0 filed, 0 rejected, 0 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "c3b47ec872e96a26cee4136665ee209de27f70d2",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "docs/integration-contract/package-api.md:1045 records the relay's 503 refusals as `unavailable` (no token) and `relay_busy` only. 3886c6d4b added a third, 503 `relay_stopped` for a call arriving after the run ended (packages/ui-server/src/github/module-relay.ts:324), and it ships without its contract record, the same gap the cfc2226 review found and fixed for relay_busy.",
      "disposition": "fixed",
      "commit": "68ded67a74577b65cf7c3ae001036a4113b09d0b"
    },
    {
      "summary": "packages/ui-server/tests/module-github-relay.test.ts:201 is titled 'stopping lets a write in flight finish and be recorded, and takes no new call' but never sends a call after stop(), so deleting the stopping guard at packages/ui-server/src/github/module-relay.ts:324 (relay_stopped) leaves every test green. No test proves that a call arriving while the relay settles is refused.",
      "disposition": "fixed",
      "commit": "68ded67a74577b65cf7c3ae001036a4113b09d0b"
    }
  ]
}

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 68ded67 against base 65883f2. Reviewer: agent. 1 finding: 0 fixed, 0 filed, 0 rejected, 1 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "68ded67a74577b65cf7c3ae001036a4113b09d0b",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-server/src/github/module-relay.ts:347 gives in-flight calls only 10 s (Promise.race with Bun.sleep), then server.stop(true). runJob finishes and brain-ui-cron exits, and observe (:305/:309) runs only after fetch (:298, no timeout) settles. A POST comment or PATCH state GitHub performs after the window reaches neither a github_write event nor stderr; #4259 requires each write recorded. Record a pending write before sending or when stop gives up."
    }
  ]
}

…4259)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 68ded67 against base 65883f2. Reviewer: agent. 1 finding: 1 fixed, 0 filed, 0 rejected, 0 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "68ded67a74577b65cf7c3ae001036a4113b09d0b",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-server/src/github/module-relay.ts:347 gives in-flight calls only 10 s (Promise.race with Bun.sleep), then server.stop(true). runJob finishes and brain-ui-cron exits, and observe (:305/:309) runs only after fetch (:298, no timeout) settles. A POST comment or PATCH state GitHub performs after the window reaches neither a github_write event nor stderr; #4259 requires each write recorded. Record a pending write before sending or when stop gives up.",
      "disposition": "fixed",
      "commit": "7e98e6a32572d789a908d2f87ecad8bea34a379b"
    }
  ]
}

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 7e98e6a against base 65883f2. Reviewer: agent. 1 finding: 0 fixed, 0 filed, 0 rejected, 1 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "7e98e6a32572d789a908d2f87ecad8bea34a379b",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "docs/modules.md:192 says a redirect is refused before any request leaves the host. It is not: module-relay.ts:321 refuses a redirect (502 redirect) only after the request was sent and GitHub answered, and the other 502 refusals (response_too_large, upstream_unreachable) also come after sending. The doc misstates when the guard acts, though the contract text in package-api.md describes it correctly as never following a redirect."
    }
  ]
}

…owed (#4259)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 7e98e6a against base 65883f2. Reviewer: agent. 1 finding: 1 fixed, 0 filed, 0 rejected, 0 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "7e98e6a32572d789a908d2f87ecad8bea34a379b",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "docs/modules.md:192 says a redirect is refused before any request leaves the host. It is not: module-relay.ts:321 refuses a redirect (502 redirect) only after the request was sent and GitHub answered, and the other 502 refusals (response_too_large, upstream_unreachable) also come after sending. The doc misstates when the guard acts, though the contract text in package-api.md describes it correctly as never following a redirect.",
      "disposition": "fixed",
      "commit": "dd3faa4b13ac83831dfcef34c87660060184b210"
    }
  ]
}

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head dd3faa4 against base 65883f2. Reviewer: agent. 1 finding: 0 fixed, 0 filed, 0 rejected, 1 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "dd3faa4b13ac83831dfcef34c87660060184b210",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "docs/integration-contract/package-api.md:1043-1045 says every other request is refused before anything leaves the host, with status 400, 403, 413, 429, 502 or 503. The 502 refusals (redirect, response_too_large, upstream_unreachable at module-relay.ts:321-324, :346) come only after the request was sent to GitHub. The contract record has the same misstatement the dd3faa4 fix corrected only in docs/modules.md."
    }
  ]
}

…ed (#4259)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head dd3faa4 against base 65883f2. Reviewer: agent. 1 finding: 1 fixed, 0 filed, 0 rejected, 0 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "dd3faa4b13ac83831dfcef34c87660060184b210",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "docs/integration-contract/package-api.md:1043-1045 says every other request is refused before anything leaves the host, with status 400, 403, 413, 429, 502 or 503. The 502 refusals (redirect, response_too_large, upstream_unreachable at module-relay.ts:321-324, :346) come only after the request was sent to GitHub. The contract record has the same misstatement the dd3faa4 fix corrected only in docs/modules.md.",
      "disposition": "fixed",
      "commit": "43142ab923bf3df502d78bc938d279ec9187806a"
    }
  ]
}

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 43142ab against base 65883f2. Reviewer: agent. 2 findings: 0 fixed, 0 filed, 0 rejected, 2 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "43142ab923bf3df502d78bc938d279ec9187806a",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-server/src/cron/emit.ts:323 adds BRAIN_UI_MODULE_GITHUB_TOKEN to CRON_CONTROL_ENV_NAMES, so `brain-ui-cron environment` writes it into the world-readable /etc/environment. The PR covers that file only inside workers. A module job that run-job.ts:347 spawns as a host process when boundary.isolated() is false can read the token there, despite env.ts saying it is never forwarded to a job. No test covers that path."
    },
    {
      "summary": "packages/ui-sdk/src/server/worker-launcher.ts:647 reservedRuntimePaths lists WORKER_PROVIDER_RELAY_DIR but not the new WORKER_MODULE_GITHUB_DIR (/run/brain-github). validateRuntimePlacement therefore does not refuse a runtime or read path at or around the module relay's mount point, which the bind at :506 can shadow or collide with. The same guard covers the provider relay directory."
    }
  ]
}

…st-fallback limit of the relay token (#4259)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 43142ab against base 65883f2. Reviewer: agent. 2 findings: 1 fixed, 0 filed, 1 rejected, 0 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "43142ab923bf3df502d78bc938d279ec9187806a",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "packages/ui-server/src/cron/emit.ts:323 adds BRAIN_UI_MODULE_GITHUB_TOKEN to CRON_CONTROL_ENV_NAMES, so `brain-ui-cron environment` writes it into the world-readable /etc/environment. The PR covers that file only inside workers. A module job that run-job.ts:347 spawns as a host process when boundary.isolated() is false can read the token there, despite env.ts saying it is never forwarded to a job. No test covers that path.",
      "disposition": "rejected",
      "reason": "Without the worker boundary, repository jobs run as host processes with the runner's access (documented host fallback, GITHUB_TOKEN already there); the relay runs only in workers. The setting's docs now state this limit."
    },
    {
      "summary": "packages/ui-sdk/src/server/worker-launcher.ts:647 reservedRuntimePaths lists WORKER_PROVIDER_RELAY_DIR but not the new WORKER_MODULE_GITHUB_DIR (/run/brain-github). validateRuntimePlacement therefore does not refuse a runtime or read path at or around the module relay's mount point, which the bind at :506 can shadow or collide with. The same guard covers the provider relay directory.",
      "disposition": "fixed",
      "commit": "6086ef6698805a91c4426955fb589bdafb7958ac"
    }
  ]
}

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 6086ef6 against base 65883f2. Reviewer: agent. 1 finding: 0 fixed, 0 filed, 0 rejected, 1 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "6086ef6698805a91c4426955fb589bdafb7958ac",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "PR #4265 body (guards in packages/ui-server/src/github/module-relay.ts:262-300, packages/ui-sdk/src/server/worker-launcher.ts:407-420 and :716-720) adds fail-closed guards but never answers the docs/decisions/proportionate-containment.md:89-99 checklist (trigger and gaps, narrowest scope, restricted mode, clearing, where the cause is recorded, cross-scope test), which the AGENTS.md 'Fail closed, proportionately' hard rule requires in the PR body."
    }
  ]
}

Copy link
Copy Markdown
Owner Author

Independent review

Reviewed head 6086ef6 against base 65883f2. Reviewer: agent. 1 finding: 0 fixed, 0 filed, 1 rejected, 0 without a disposition.

{
  "version": 1,
  "kind": "brain-review-receipt",
  "pr": 4265,
  "head": "6086ef6698805a91c4426955fb589bdafb7958ac",
  "base": "65883f2d5332220db8a17fd1ddba0f926a1888be",
  "reviewer": "agent",
  "outcome": "findings",
  "findings": [
    {
      "summary": "PR #4265 body (guards in packages/ui-server/src/github/module-relay.ts:262-300, packages/ui-sdk/src/server/worker-launcher.ts:407-420 and :716-720) adds fail-closed guards but never answers the docs/decisions/proportionate-containment.md:89-99 checklist (trigger and gaps, narrowest scope, restricted mode, clearing, where the cause is recorded, cross-scope test), which the AGENTS.md 'Fail closed, proportionately' hard rule requires in the PR body.",
      "disposition": "rejected",
      "reason": "Not a code defect: the PR body now answers the proportionate-containment checklist in its Guard checklist section; no code change is needed."
    }
  ]
}

@schlessera
schlessera marked this pull request as ready for review November 20, 2026 19:14
@schlessera
schlessera merged commit 134c0ee into main Nov 20, 2026
61 of 63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: modules First-party content modules and the module seam. area: ui-server Hono app factory: turn coordinator, auth, session catalog, routes, cron. contract Touches the integration contract: CONTRACT: commit, contract doc updated in the same commit. type: feat A new capability or a change in user-visible behaviour.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ui-server: a scheduled module job has no governed GitHub API access to its granted repositories

1 participant