Repository navigation
Description
Context
A module's scheduled job runs in a maintenance worker that holds no Git or
GitHub credential (HOST_GIT_CREDENTIAL_ENV,
packages/ui-sdk/src/server/subprocess-env.ts:247). #3380 (through #4008)
added a read path for Git content only: a module asks for a repository with the
core-owned repositories key, the operator allow-lists it in
BRAIN_UI_MODULE_REPOSITORIES, and the host fetches a mirror the worker can
clone (grantModuleRepositories and moduleRepositoryWorkerAccess,
packages/ui-server/src/brain/module-repositories.ts:67-113;
docs/modules.md).
A scheduled job that must talk to the GitHub API of an allow-listed
repository has no supported path. A repository "heartbeat" is one example: a
module job that, every 30 minutes, reads the repository's recently closed
issues (REST and GraphQL), comments on an issue closed without a reason, and
reopens it. Telemachus's ithaca/watchtower would run that check. With no
credential, every API call fails, and the job either cannot run or needs a
token injected into the worker, which the governed-worker rules forbid.
The hosted chat already solved the same problem for turns with fixed host
tools that hold the credential (#3791, BRAIN_UI_GITHUB_TOOLS_TOKEN, a
policy allow-list for writes and owner approval). Those cannot serve a module
job as they stand: a scheduled job has no owner to approve a card, and its
operations are not the four chat tools.
Scope
Per the 2026-11-20 maintainer ruling (option 1: a host GitHub API relay for
module jobs):
- Grant. A job gets the relay only for the repositories the mirror path
already grants it (its module'srepositories∩BRAIN_UI_MODULE_REPOSITORIES).
The worker receives a per-run Unix socket, bound read-only from a private
server-owned directory into that run's worker only, never a GitHub token. - Credential. A new host-only variable,
BRAIN_UI_MODULE_GITHUB_TOKEN
(final name in the PR), with no fallback toGITHUB_TOKEN, the sync
credential orBRAIN_UI_GITHUB_TOOLS_TOKEN. It is stripped from every
worker. Without it, the relay refuses every call, naming the setting. - Reads. REST
GETunder/repos/<owner>/<repo>/…for a granted
repository. GraphQL queries only (no mutations or subscriptions) whose
single root field isrepository(owner:, name:)naming a granted
repository. Anything else is refused before a request leaves the host. - Writes. A fixed set of operations, each enabled per repository by an
operator allow-list in host configuration (for example
BRAIN_UI_MODULE_GITHUB_WRITES, final name in the PR), so editing
brain.config.tscannot widen it. The first set isissue_comment
(POST /repos/<r>/issues/<n>/comments, body only) andissue_state
(PATCH /repos/<r>/issues/<n>with onlystate/state_reason).
Any other method, path or field is refused. - Bounds and record. Request and response sizes and a per-run call budget
are bounded. Each write is recorded on the job's Activity run with its
repository, operation and target number, never the token.
Out of scope
- Chat-turn GitHub tools (Epic: hosted turns read and file GitHub issues through governed host tools #3791), which are delivered.
- Git pushes from module jobs.
- Any change to the read-only mirror path from CONTRACT: feat(ui-server): fetch allow-listed repositories for module cron jobs on the host #4008.
Acceptance criteria
- A module job granted
https://github.com/ithaca/watchtowercan read its
issues and post an issue comment through the host, and a test against a
loopback GitHub stand-in proves both. No credential appears in the worker's
environment, files or process arguments, and a test asserts that. - A call to a repository or operation outside the grant is refused before any
request leaves the host, with a message that names the setting. A test covers
each. - A GraphQL mutation, a query rooted outside a granted
repository, and a
write operation the operator list does not enable are each refused without
a request, and a test covers each. - The relay without
BRAIN_UI_MODULE_GITHUB_TOKENrefuses every call, and
the token is never read from any other variable, proven by a test. docs/modules.mdand the environment reference describe the grant, the
allowed operations and the credential.
Verification
Integration tests with a loopback GitHub stand-in. No network and no real
token.
Contract impact
Additive: a new module-job capability, its host configuration and its
documented operations.
2026-11-20: Scoped by the maintainer ruling (option 1) recorded in the comment below.
2026-11-20: The relay endpoint is a per-run Unix socket rather than a loopback port with a bearer: maintenance workers have no route to the host's loopback.
Activity
schlessera commentedon Nov 20, 2026
Decision (maintainer, 2026-11-20): option 1, a host GitHub API relay for module jobs. The grant follows the existing mirror grant. A dedicated host-only credential with no fallback is never placed in a worker. Reads are limited to the granted repositories (REST
GET, and GraphQL queries rooted at a grantedrepository). Writes are a fixed operation set (issue_comment,issue_state) enabled per repository by an operator allow-list in host configuration. Options 2 (a token in the worker) and 3 (no kit support) were not taken. The body now carries the scope and acceptance criteria.schlessera commentedon Nov 20, 2026
Claimed for implementation. Claim token:
claim-cc55e738. Branch:feat/4259-module-github-relay.No path collisions expected; new relay beside the provider relay.
schlessera commentedon Nov 20, 2026
2026-11-20 implementation note: a maintenance worker has its own network namespace with no route to the host's loopback. The relay is therefore a per-run Unix socket in a private server-owned directory, bound read-only only into that run's worker, like the CLI provider relay (#1673). The socket's reach replaces the "per-run bearer" in the scope. Everything else in the ruling is unchanged. Implementation: #4265.
fix(ui-server, ui-sdk): close GraphQL parsing bypasses, keep the rela…
fix(ui-server): bound relay reads while streaming, and record a write…
12 remaining items
fix(ui-server): name the right refusals and launch class (review of #…
fix(ui-server): record the real cause of a refused sync review; every…
fix(ui-server): record the real cause of a refused sync review; every…
fix(ui-server): record a sync policy read failure by its cause; nativ…
fix(ui-server): record a sync policy read failure by its cause; nativ…
test(ui-server): drop an assertion that cannot fail; the path guard r…
fix(ui-server): record relay_stopped in the contract and prove it (#4259
fix(ui-server): record a write still unanswered when the relay stops (#…
docs(modules): a redirect is refused after GitHub answers, never foll…
docs(contract): the relay's 502 refusals come after a call is forward…
CONTRACT: feat(ui-server, ui-react): review a sync's incoming governa…
fix(ui-sdk, ui-server): reserve the relay's mount point; state the ho…
CONTRACT: feat(ui-server, ui-sdk): a host GitHub API relay for module…
schlessera commentedon Nov 20, 2026
Delivered by #4265, squash
134c0eee935f1c88ddbef5f1f59aee8b2363fe3a, milestone 0.45.0 (rulings 2026-11-20: host relay; the token's scope bounds reads below the granted root).A module cron job granted a
github.comrepository reaches its API through a per-run Unix-socket relay (BRAIN_MODULE_GITHUB_SOCKET).BRAIN_UI_MODULE_GITHUB_TOKEN, which has no fallback, is host-only and is stripped from every worker./etc/environmentis now covered in every host-view worker.GETunder a granted repository, and strict-subset GraphQL queries rooted at a granted repository.issue_commentandissue_state, only whereBRAIN_UI_MODULE_GITHUB_WRITESenables them.A module needs no kit helper: send ordinary GitHub API requests to the socket (see
docs/modules.md).